1)
I'm confused on what the best way to do this is. When the player beats a level, the next map in line needs to be saved in a file and then the player should go to the town instead. The reason I want it saved is so that after the player has bought all the weapons etc he needs from town, and is ready to fight again, he can go to the warp gate and select which level to go to. The next map he would have gone to is the default, but below that is a list of all the other maps he's beaten, which he can replay for gold and experience if he wants to.
a) The first step is easy in its simplest form: just append the next map's name to the maplist file (maplist.tsav). But here's my first question: how do I keep different saved games separate? For example, if I'm playing through the e2 maps, and I save my game, and then my brother gets on and starts a new game, my map list file will be deleted as soon as he beats the first level. So, I need to keep different files separate for different instances of the game.
Should I generate a random number between 1 and 2 billion at the beginning of the game, and use that to identify all the client and maplist save files, so they have a very low chance of conflicting?
Perhaps I could save the files based on the date and time the player started? Is there a command in DP to get that info?
b) The second step is displaying the contents of that file. I could traverse the file *every* time I want to refresh the menu, but all too often files = evil because disk access is so slow. So, my guess is that when the player enters the menu, the file is read once and a linked list of entities is created, each holding the map name in "netname" and other values such as times played, best time, secrets found, monsters killed, etc in various .floats. This can create a lot of entities (assuming the player has beaten the ID1 campaign and a host of other custom campaigns), but it's the best solution I've thought of so far.
2)
My friends and I played Conquest in single player, and it was lots of fun, except for two frustrations. One, DP was crashing on map change, but I think that's because I'm using an old version of DP and I forgot to download the new one over the weekend. The game was also not deleting some entities (for some clients: lost net messages?), so we'd get some interesting things like the tesla mine leaving behind bits of its lightning. Probably something wrong my code.
The second problem was that I had not set up Coop's gameplay very well. When one of us died, we respawned with the same shields, weapons and money we had when we started the map. This was annoying because of it takes time to re-buy weapons and ammo and such, assuming you even have the money to do so. They also had to walk all the way back to where they were when they died, so we had to wait around for them in the mean time. Thus, I really need to figure out a good system for coop.
a) One idea is to let the player keep everything when he dies. His shields, weapons, items, armor, money, etc are not lost, and he respawns with 100 health.
b) Alternately, every time the player touches a shop, it updates his save file, kind of like a check-point. So, when the he dies, he starts at the last shop he contacted, with all the stuff he had at that time (losing anything gained afterwords). I'll have to make sure there's a limit on how often the shop updates (otherwise it'll be re-writing the file 60 times a second or so when the player is near a shop), or maybe I could make it cost the player something to set a checkpoint, and he has to consiously set them with some command at the shop (open the shop menu, press 9, close the shop menu).
What does everyone think? Any other ideas on either subject?