Look at these lovely little piggies:
I realize, again, that it’s hard to get a real sense of what’s happening here since it’s a still frame but the boar models are moving around in a random pattern. Every 1 second the server sends an update to every client with the new location of each boar. Each boar moves a random amount in the x and z directions and stays within a certain range. This is super basic functionality but it’s neat because it’s controlled by the server so every player sees the randomly placed boars in the same places. Eventually I’ll need some actual “intelligence” in the ways the boars move around, but for now this is ok.
You may have noticed there’s no player character in the screenshot above. I’m still struggling with getting that working on my secondary machine that I’m using today. Also, the boars don’t react to the terrain. That opens a can of worms I’ll have to handle eventually, specifically how much of the game is running on the server and how much is in the client. For instance, should the server somehow load the entire world and make decisions about collision detection, terrain height, etc., or should I leave much of that to the client to just tell the server what the world is like? I’m guessing it will end up as some sort of hybrid between the two, but that’s definitely a design topic I haven’t tackled mentally or in the code, so it will be fun to figure out eventually.
Lastly, I installed Forever on my server so that I can leave the Node server running all the time. Since the next release will include multiplayer (and now some random boars) it becomes dependent on the server running all the time, and Forever allows me to do that.