Ok, so, last time I talked about the fact that I wanted to make a game. I'm not trying to build the game of the year, I'm just trying to build a multiplayer game with some blockchain stuffs.
So, I decided to buy a pack of game assets, that way I don't have to worry about 3D modeling right away. I bought this pack, it's made by the Synty studios, these guys create low poly 3D game assets that look amazing. Also, since it's low poly stuffs, I can easily add my own game assets later on when I can focus more on 3D modeling.
I then looked for a network library for Unity. It appears that Unity doesn't really offer a networking solution out of the box. They deprecated their own a few years ago to work on a brand new library, but in the meantime you have to use 3rd party tools. I looked for a library that has a big community so I went with the Mirror library. It is basically a fork of the Unity networking solution that has been deprecated. The community fixed it and improved it. I think that'll do the job for now. (I'm not sure about the performances yet but so far it's been working fine)
Next, I started building a very simple playground; a road, a few obstacles and a few buildings, a few lights, just so that I don't show only cubes and capsules in the demos.
And, finally, I started working on the programming part. I built a simple AI (look for a target in range, if found one, follow it). I then fired up a host (server + client), a client and 50 networked zombies and played with latency. At first, it was very very laggy with only 10 zombies on the map. I optimized the networking synchronization and now it looks ok with 40-50 zombies.
Here's a video showing the prototype:
- 1 host on the left (server + client)
- 1 client on the right
- 50 zombies
- server authoritative mechanic (the server always has the last word on your inputs)
On this video you can see:
- the character movements mechanic (simple click to move)
- the camera movements (hold the mouse to turn the camera, mouse wheel to zoom)
- the green circle on the floor is the target/destination of the character. It is displayed right when you click but the character only starts moving once the server has validated the move. That's where you'll see some input latency.
- a bunch of zombies (50). They are networked zombies. For now they don't do much (only follow you when in a specific range)
- the ping of the client (top left corner of the right window). The first part of the video is with a 3g simulated network (Down:1600kbit/s Up:768kbit/s RTT:150ms) and the second part of the video (after you see the console) is a dsl network (Down:1500kbit/s Up:384kbit/s RTT:25ms). My goal is to make this game work smoothly on a dsl connection. The 3g should only be the worst case scenario and I don't think I'll try to make it perfect.
- you'll see how the network react when there are sync issues. I've created a basic sync algorithm that follows the "rubber-banding" principle. If your character is too far compare to what's on the server, the character gets teleported to the server's position (when on the video you see zombies or players being teleported, that's when the server took over and forced the clients to re-sync their positions)
- some basic zombie shooting, no animations, no sounds, nothing :) (just a simple "delete the zombie from the scene when a player click on it")
That's all for now.
I'm going to work on improving the networking part of the project. Then, I want to start adding some animations and effects as well as some UI elements.
Still far from even an alpha version, but still, the journey should be fun!