Page 1 of 2

Saving players state in co-op

Posted: Fri Dec 14, 2012 2:35 pm
by R.Alex
Hi everybody !

I'm quite new on this forum. I just re-discovered Doom and all its engine, and I am trying to set up a co-op server.

I would like to know if it is possible to save the players state when they leave, to restore it when they come back ?
It would be better to remember their weapons, instead of let them restart only with the pistol, at the late levels wich are quite hard.

Or, if the above is not possible, is it possible to set a default package (weapons, ammo and armor) that each player receive as they connect ?

Thank you by advance.

Please apologies for english mistakes, as this is not my native language.

RE: Saving players state in co-op

Posted: Fri Dec 14, 2012 3:10 pm
by one_Two
You could set a once only spawn room with weapons ammo and armor. There are ways of remembering a player on a server, usually quite complicated but you could maybe take their name string and have a condition that gives them weapons etc.. when that name comes on again. There are ways to enforce a specific player getting their things, you could do a pw system in acs. Hopefully when/if an account system gets created this will be a lot easier. Still I could probably help you if you have a specific idea.

RE: Saving players state in co-op

Posted: Fri Dec 14, 2012 3:16 pm
by R.Alex
Thank you for the response.

But I have to admit that I am quite a newbie in doom world, so I don't understand a lot of terms you used : acs, pw system, account system, and so on.

I tried to read the wiki about all these, but I don't think I understand everything.

Identifying players by their name string seems a good idea, as there will be 8 players max on the server, always the same players (the server is private).
Is there a way to save their stuff when they disconnect, and give it to them when they reconnect ?

Thank you again for your help.

RE: Saving players state in co-op

Posted: Fri Dec 14, 2012 4:45 pm
by one_Two
I did a bit of reading and it turns out you can have multiplayer save games in Zdoom - http://zdoom.org/wiki/Multiplayer#Savegames though it looks pretty complicated. I suppose a lot of the problems with saving player positions would be preventing people from messing about with it, but if you know and trust who your playing with it might be easier. Although I get the feeling your not intending to make your own maps, so any kind of save functionality would have to be in acs script (acs is a modern doom language, used in zdoom and zandronum and a few others, it's pretty easy and is documented on the zdoom wiki). If you tell me exactly what you want I'll try and make it for you.

RE: Saving players state in co-op

Posted: Fri Dec 14, 2012 5:52 pm
by R.Alex
Thank you for your proposition, i completely accept it !

I will play on official wads (doom, doom2, tnt, plutonia) for now, so i won't make my own maps, as you guessed.

What i want is :
- a player connect to the server, play some levels and disconnect.
- the weapons the player had, and munitions (and optionnaly the armor), are saved, preferentially server side, but it is not a big problem if it is not.
- others players connect and play. Possibly, the map change as they complete it.
- the first player connect again, and the server give him the same stuff (weapon, ammo and maybe armor) that he had when he left.

Obviously, i need this to be done for each player, not only one. And if needed, i remember this is for coop only.

Is it ok for you, or do you need more informations ?

Thank you anyway.

RE: Saving players state in co-op

Posted: Fri Dec 14, 2012 8:18 pm
by Llewellyn
R.Alex wrote: Thank you for your proposition, i completely accept it !

I will play on official wads (doom, doom2, tnt, plutonia) for now, so i won't make my own maps, as you guessed.

What i want is :
- a player connect to the server, play some levels and disconnect.
- the weapons the player had, and munitions (and optionnaly the armor), are saved, preferentially server side, but it is not a big problem if it is not.
- others players connect and play. Possibly, the map change as they complete it.
- the first player connect again, and the server give him the same stuff (weapon, ammo and maybe armor) that he had when he left.

Obviously, i need this to be done for each player, not only one. And if needed, i remember this is for coop only.

Is it ok for you, or do you need more informations ?

Thank you anyway.
While possible with scripting (called ACS) it's highly doubtful that someone will make it for you right away.

RE: Saving players state in co-op

Posted: Mon Dec 17, 2012 9:39 am
by R.Alex
I can try it by myself, but I have absolutely no idea how to do it. That's why I really appreciate the proposition of one_Two. But if he can't or does not have the time to do it it, I won't be angry.

Is there any exemple of ACS that I can found, which could help me understand this ?

RE: Saving players state in co-op

Posted: Mon Dec 17, 2012 6:26 pm
by Watermelon
Basically you need to decide:

1) Save if server stays up
or
2) Save if server is restarted

Then we can go from there.

RE: Saving players state in co-op

Posted: Sat Feb 02, 2013 1:53 am
by Skrell
I would also love the ability for the server to save the player states! I would prefer allowing the server to restart so that on really love maps, a friend and i could save our game midway!

RE: Saving players state in co-op

Posted: Tue May 21, 2013 10:41 pm
by Blachinowhy
Sorry to necro an old thread but I'm also interested in this subject, I'm running a RGA2 server and it's very irritating to play for 2 - 3 hours, get up to rank 20 and then have to go and come back to be level 1 again with no weapons. Since this is a 24/7 server the saves could be stored in ram and dumped when the server resets, no need to create say a text file with player inventories. I was hoping there might be a way to link to the menu open event that way the server stores a players inventory, rank, and weapons upon opening the menu to say, close the game. What is the most likely way to accomplish this? Wad or server side script? Suggestions and script help would be nice, I'm still just learning to program myself so I need as much information as I can get.

RE: Saving players state in co-op

Posted: Sat May 25, 2013 3:51 pm
by Watermelon
There is 3 ways of saving

1) Write ACS to save your x/y/z position and your inventory, then write it with your name to the server .ini file and have it restore when you join (prone to bugs/exploit with someone using the same name)
2) Get a server mod to record by IP, but if your IP changes you'r screwed
3) Write an intricate ACS login system (I had one working at one time but its thousands of lines of code)

or the secret option

4) Make a custom binary build with the above




For my third option, the danger is that whatever password you enter on the server can be probably read by any rcon users, so it's not great.

RE: Saving players state in co-op

Posted: Sat May 25, 2013 10:06 pm
by katZune
I dont know but, dont would be great to add an acount system? I mean something basic like, save ammo, hp, armir, weapons and inventory, and let mods to add their custom things, tbh that would be hard (?) but would make zandronum unique

RE: Saving players state in co-op

Posted: Sat May 25, 2013 10:11 pm
by Ænima
katZune wrote: I dont know but, dont would be great to add an acount system? I mean something basic like, save ammo, hp, armir, weapons and inventory, and let mods to add their custom things, tbh that would be hard (?) but would make zandronum unique
http://zandronum.com/tracker/view.php?id=1176

RE: Saving players state in co-op

Posted: Sat May 25, 2013 10:29 pm
by katZune
Nice, hope it will be added

RE: Saving players state in co-op

Posted: Sun May 26, 2013 1:26 am
by Blachinowhy
Option 1 sounds the easiest to do, not to concerned with people copying names or exploiting, also location isn't so important to the save either. Just want people to spawn on the default spawn for that level upon rejoining with their inventory intact, keys excluded. So what do I do with this ACS, is it going in a pwad or do I just plug the code directly into the server .ini?

RE: Saving players state in co-op

Posted: Sun May 26, 2013 3:32 pm
by Watermelon
Blachinowhy wrote: Option 1 sounds the easiest to do, not to concerned with people copying names or exploiting, also location isn't so important to the save either. Just want people to spawn on the default spawn for that level upon rejoining with their inventory intact, keys excluded. So what do I do with this ACS, is it going in a pwad or do I just plug the code directly into the server .ini?
This is how I'd do it:

Code: Select all

#define MAXPLAYERS 64

global int 0:weapondata[MAXPLAYERS];

script 100 ENTER
{
    // Restore based on .ini here
    while (true) 
    {
        // Record inventory bitmask for weapondata[playernumber];
        // This would be like dmflags, where the first bit is the shotgun, 2nd is ssg... however you want
        delay(1);
    }
}

script 101 (int playernumber) DISCONNECT
{
    // Construct player name to a string with StrParam();
    // Use ConsoleCommand to store the name in the .ini
    // Store with corresponding weapondata[playernumber] into the .ini
}
Probably missing a lot of key concepts and such but this should be a good start. Of course people can easily name steal though.

RE: Saving players state in co-op

Posted: Sat Aug 16, 2014 3:42 am
by Tomslucky7
Necroing an old thread again. I would like to know how to implement this into a Doom 2 Tower Defense server that I am hosting. Is there any way I could save the file like I normally would in singleplayer on a multiplayer server? Not sure if this mod would support an ACS system due to when someone dies that would end up crashing the server. I found this out because a buddy of mine and I played for a couple hours and when he died then I died the map reset and both the game and server crashed. I had it set to survival co-op mode as attempting to set it to skulltag (which is required by the mod) was not staying when the server was created via doomseeker (would set skulltag in options then it would just reset to cooperative).

I would just like to know how I could go about getting a saving system into this mod for multiplayer so we don't end up constantly losing our progress.

RE: Saving players state in co-op

Posted: Sat Aug 16, 2014 3:49 am
by Watermelon
If your server crashed it might be a bug.

You will need ACS to save stuff. Most likely you will need to code it yourself or with the help of someone who knows what they're doing.

RE: Saving players state in co-op

Posted: Sat Aug 16, 2014 4:08 am
by Tomslucky7
Any suggestions on who I could talk to?

RE: Saving players state in co-op

Posted: Sat Aug 16, 2014 3:04 pm
by Lollipop
#zamapping on IRC is filled with geniouses, who know practically anything with their combined knowledge.