[XP] Creations - A Multi-Player Building Game

Started by Wizered67, February 22, 2012, 12:54:56 am

Previous topic - Next topic


July 06, 2017, 01:34:52 am #60 Last Edit: July 06, 2017, 01:39:31 am by Wizered67
Quote from: amjrl on July 04, 2017, 10:28:09 pm
Hello, I like this system you made in rpg maker xp , I wanted to know if you have a demo, or anything, I'm trying to make the same thing and just wanted to ask if you can share this project with me. Or if you can show me how you made it, Thank You

Hello! Unfortunately I haven't worked with RPG Maker in several years and don't have a demo available. I'm also not very active on these forums anymore although I do check in from time to time.

I can't help much, but maybe I can point you in the right direction. First, check out this script. This was the script that originally inspired this project (over 6 years ago, holy cow!). If you look at the add_map method in that script, it has code for copying tiles or events from one map to another. At the beginning of this project I would do the same thing, but with only a single tile. When a player placed a tile I would copy it from another map (which had all the possible tiles laid out on it) into the current map, save the map to a file, and send the file to the server. Then when a player changed maps or was on a map when someone else made a change, the server sent them the map file and the client loaded the file and replaced the whole map with it.

Do you see the problem here? I was foolish at the time so it took quite a while for me to realize the problem. Sending an entire map file just for a single change is insanity! It caused a ton of lag because the entire map got reloaded for every single change. Eventually I did catch on and somewhat fixed the problem. Here's what you would probably ideally do: When a player makes a change, send *only that change* to the server and have the server send it to the rest of the clients on the map. The server could edit the map file to save the change to a file, but what you want to avoid is sending an entire map file every time there's a change. When a player changes maps/logs in, sending the map file from the server is probably fine because it's a one time thing, but for every other tile placement find a way to send just those changes to the clients on the map and have them change the affected tiles.

In effect:

When a player logs in or changes map, the server sends them a map file to load the map from.

When a player places a tile, send that change (which tile to place and where) to the server. The server should save the change to a file to make it permanent and so new players can get the most recent map. This part might be tricky with the default rmxp map files. I'm not sure if you can easily make a single change like that without loading the whole file, changing it, and resaving it. Ideally you should consider making your own format for saving/loading maps. In addition to saving the change to a file, send the change (just the change) to all players on the same map and alter their map.

Hope that helps a bit, it's probably the best I can do at this point.

Edit: Also just remembered and stumbled across this script, which could be helpful, especially for autotiles.