Advertisement

Game Engine for a 2D fighting Game

Started by March 29, 2020 11:21 PM
4 comments, last by Captain_Absol 4 years, 7 months ago

Hey, I want to make a game engine for a 2D Fighting Game but everywhere I look, I don’t get that much tips on how to start with bootstraping, or any of the later things you need too like higher set language or CPU.

This engine will have a networking layer and multiplayer support, and I’m making this engine because while I like other engines like unity, unreal engine 4, game maker, stuff like that, it just doesn’t suit me, and I’m really want to make this, this is my first game but I have experience with coding and currently I’m using C++.

I don’t know how to use OpenGL and currently I’m using Visual Studio to make this engine, so can anyone give me any tips? Thanks

I wrote a large post about making your own 2D engine here, now that you have a concrete game in mind, I can give you some more hints to research for.

The ultimate base in a combat game like Street Fighter or Mortal Combat is, that you are bound to timing and input precision. Trigger combos needs a quite good event system to handle your input messages so that there isn't too much delay and players don't get frustrated at all.

It depends on your platform in a way, that Mobile Platforms are less good at reacting fast to input as PC or Console. It is a hardware limitation of the touch display. Console Platforms have their own input systems so you need to adapt your engine to them if you want to launch on them one day. Again, it depend on the hardware how good your input precision is; Nintendo Joy-Cons are quite slow in input too.

On PC, your best bet is something hardware near. XInput2 is quite good but if you want to target multiple platforms or simply hate being bound to DirectX (like me), there is also still the HID hardware layer you could use. It is fast but you have to handle anything on your own, which means for example mapping keybord controls to buttons, handling input axis of controllers and so on. It is quite easy to use if you understand how it works.

Don't try to handle input via OS message pump like Godot does, it can cause input lags and hitches. HID still pushes messages to the OS message pump but you just need to copy the input states of a frame to a buffer and handle them in your event system if needed without stalling to much on the OS event queue.

To generate your combat system, you could use a state mashine. Each control causes the state mahine to change it's state and either go further to more complex combos or break by pressing a wrong button. There was also a post here in the Forum some time ago, maybe you can find it for further read.

You mentioned language by the way, did you mean localization?

Last but not least network is quite difficult in combat games. You need a quite good timing handling to not have one player be frustrated and the other win fights easily. If you don't care about cheaters too much, simply send the commands with a timestamp from one client to another and let those clients act as if two players sit next to each other on the same device should work well to start

Advertisement

@Shaarigan Thanks for the tips! But any suggestions on what I should do if I care about cheaters?

Then you have to process the network messages to validate for sanity. Either on the client side on each client or server side

@Shaarigan Thanks, although this is extremely late, is it possible to add 3v3’s and 2v2’s later in the game as an update?

This topic is closed to new replies.

Advertisement