I just want to see what 64D's take on this subject would be. My current objective is to manage monsters and AI server side and there's many ways to accomplish this. What's the most efficient way? The server is staying GM based, for this is a challenge of my own. I want to make a feasible GM server. I've thought about C++ servers, but I like trying to accomplish things with GM that everyone says can't be done.
Looking up topics and discussions about this led me to this thread: http://gmc.yoyogames.com/index.php?showtopic=413819 which proved to be a bit useful. Some feedback such as:
Quote:
That's exactly what I'm doing. The problem here isn't how to synchronize the monsters with the client, its the most effective way to implement server sided monsters so that they can do pathfinding and collisions correctly. Regardless of what method is chosen, in order for the monster's to be server sided they must act and be created server sided (the host) and sent to the clients.I've come up with a few different solutions for this.1. Copy the game map into the server.- Now for my last game (Katzenjammer Krusade) I used this method. A bare-bones copy of the room for gameplay is also added to the server. This bare-bones copy only contains boundary objects used in collision checking. The monsters are spawned into this map, and handle collisions and pathfinding accordingly.The flaw to this method is that it will not work with multiple rooms because the server can only be in one room at once.2. Set a player to be a monster host.-The first player in the room is assigned to be the "monster host" and handles and sends all monster packets to the server, where they are then sent to the clients. This method allows for multiple rooms.The flaw to this method is that it is dependent on a clients fps and upload speeds, which may or may not be stable.3. Use server sided clients to handle monster collisions and pathfinding.-This is the method I'm currently experimenting with. A server-sided client creates and sends the monsters packets to server, and the server sends the packets to clients. This client also recieves the player data from the server, as would a typical client. In order for me to utilize this method with multiple maps, I'm saving the maps externally from the game, copying them to server, and then the server sided client loads and creates a copy of the map. This too allows for multiple rooms.The flaw to this method is that with the server and multiple server sided clients open for each map, this could use a lot of system resources and cause lag.
Quote:
Depending on your world size, your server could use a big room that merge every map of the world. So if you have 4 2000*2000 maps, the server's room would be 8000*8000. Then, you will be able to keep track of monster's x and y position.I hope that helpsEDIT: even better, you can make up a server just like if it was a minimap in an RTS. so instead of having objects placed over a 8000*8000 room, it could be miniaturized and use 500*500 instead. You will need to tryout some things. The server definately need to know where are monsters (x and y), in other case, if a new player joins, the server won't know which position to send.Another solution is that the server keeps track of monster's ending path position. So whenever you need a monster to move, the server only knows his goal position, then when a new player joins, the monster will appear on his goal position. (This is not the most accurate thing to do though). I think the best solution is still to merge every map into a big room. If you efficiently use this system, it could be very good. Some hints using this method:Your server needs to create object and things needed to compute paths only when there is players in that room. So for example, you have 4 room of 2000px*2000px, then your server's room is 8000px*8000px (depending if you miniaturized it or not). But there is only players in the first room. Then the server will create obstacle in the first room, so only 2000px*2000px will contain objects and monsters. In other words, don't create object on your server if they arent used.I hope that helps,MigEDIT2:In order to complete this idea of optimizing, whenever a room is empty (meaning there is no players in it) but monsters moved because player have been there already. You could save the last state of this map (monsters x and y… every object's status) on a text file. so whenever a player re-enter this room, thye server will simply load this stuff and send it to the client.
True Valhalla, who has posted some examples here (and #FF'ed my twitter a little while ago ^_^) is probably the leading expert in making a GM MMORPG right now is doing his server in C++ but had a plan for it in GM also (which he pretty much is still using for the C++ one, generally speaking anyway). He made the combat grid based to effectively multiply the results of your second quote by 32 or whatever cell-size he uses.
I've also thought about the 2nd solution mentioned in the first quote but ehh… it's risky. And I can guarantee if the game gets big enough someone will be controlling monsters. (though they'd still be limited assuming they could only do it when they were the first player in a room or whatever)Aanndd another thing I just thought of is to run the AI like cellular automata and have them taking minimal readings from their environment and opponent which they store - then one overall controller runs through every enemy and has set action results for the various combinations of states found in the readings.Thanks, I've played TV's online games. I noticed he had it working so I knew it was possible. I already started to implement a system similar to the suggestion in quote two and it seems promising. I might continue with it.