AI craft – day 2: game engine design
After reading Dnode, Socket.IO modules, I decided to go ahead and make the game engine. I guess not doing enough research and blindly go into coding will bite me back later. But I don’t want to be researching forever and not being able to do a bit implementation at all.
This article talks about author’s personal experience of doing NodeJS multiplayer games: http://smus.com/multiplayer-html5-games-with-node
First thing I notice is that he ran into same problem as I did: trying to figure how to sync between server and clients. He describe two ways:
1. Same game engine runs in browser and on server simultaneously, and sync them periodically.
2. All game logic on server, and browser syncs with the server side according to rendering fps (I was doing this with my GO code).
So I guess this time I should make it right, one game engine, runs both in browser and on server, and they sync with each other once a while. But… Wait a second! The author’s situation is total different here with AI craft. His game probably would have players control by users in browser. But A.I craft would have players control by user submit codes. And those code could run on server. So the server is really just doing two things: run user code, broadcast player animations.
So I will be doing something new here: