Introduction
You want to create your own Realtime Multiplayer FPS?
Are you mad? Don't realise how incredibly complicated it is?!Why is it so complicated? I've written a single-player FPS before!
It's more complicated than a non-networked FPS for essentially one reason: so that when a player presses "move forward" on their keyboard, their view moves forward instantly, but also the server remains in control.Because this needs to be instant, it means the client software must process the keypress itself, before it has had any time to confirm any details with the server (like "is there anything in the way?"). This means it has to essentially run the same game as the server. However, this then causes two further problems: the client could potentially cheat, and also what happens if the client determines that one outcome happened (e.g. moves the player's avatar forwards), but the server (or another client) determines another (e.g. there's a wall in the way!)?
To avoid this kind of problem, the server is treated as authoritative. This means that it has final say on the state of the game, and if any client thinks differently, they had better get back in sync as quickly as possible, but still maintaining a seamless experience for the player. So, the bulk of the additional code over-and-above a simple FPS is keeping clients and server in sync.
Is there any good news?
Yes! SteveTech1 is designed exactly to solve all of these problems for you. It still won't be that easy (as writing anything in 3D never is), but it will be a lot easier than it would be without it.Ingredients
To make this example game, you will need the following:-- Java
- SteveTech1
- Various assets (3D models and textures), although you can use the ones I used by downloading the repository for this tutorial (https://bitbucket.org/SteveSmith16384/multiplayertowerdefence)
- An IDE; I use Eclipse
Setting Up the Project
I'd recommend downloading the repository associated with this tutorial. Even if you want to write all the code by hand, it will save you a bit of time when you can copy-and-paste some boilerplate code.Once you have your favourite IDE open, create a new project and link it to the SteveTech1 code. You will also need to link it to all the jars in the libs folder, since these are required for SteveTech1 to work. These jars include libraries like jMonkeyEngine, which we use for the 3D, and Kryonet for the networking, as well as some more which will prove useful.
Once you've done that, you should have a clean project with no errors. SteveTech1 should "just work", so please leave a comment if you have any problems.
In the next section, we'll be writing some actual code!
This is amazing!
ReplyDeleteIt's at https://github.com/SteveSmith16384/SteveTech1 . Where are you looking?
ReplyDeleteI've just seen where the links are wrong. Thanks for letting me know.
ReplyDelete