Coop Stats (Beta 2): Save your weapons & everything else before disconnecting

Maps, modifications, add-ons, projects, and other releases for Zandronum. Also includes announcers.
Post Reply
Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

Coop Stats (Beta 2): Save your weapons & everything else before disconnecting

#1

Post by Konda » Wed Aug 20, 2014 2:58 am

WARNING: THIS PROJECT HAS BEEN DISCONTINUED AS OF ZANDRONUM 1.3 IN FAVOR OF THE NEW DATABASE SYSTEM. THIS MOD IS NO LONGER GUARANTEED TO WORK!

DOWNLOAD (Beta 2): http://www.[bad site]/download?file= ... ats_b2.pk3
How to use:
Load this mod after all other mods. The rest is done automatically. There are commands you can use to tweak things to you liking, or simply to balance the game in some maps/mods.
Spoiler: Commands (Open)
Taken from about.txt inside the pk3:

Code: Select all

Coop Stats provides optional features that can be activated/deactivated via console commands:
==Server Commands==
* coopstats_savedatabetweenmaps [values: 0 or 1][default: 0] - If set to 1, the mod keeps players' data even after the map is changed. This doesn't apply for players' positions in the map. This doesn't work if the map is changed via the "map" command - use "changemap" instead.
* coopstats_nosavepos [values: 0 or 1][default: 0] - If set to 1, the mod doesn't save players' positions in the map before they disconnect

==Player Commands==
* coopstats_getnewid [no value] - This mod works by giving each player a unique id, and associating data with that id. The id is the same for all servers. If necessary, use this command to generate a new id for yourself. By doing this you will lose all data on other servers. If executed this command in a server, the player's data in that server won't be lost. The player must be in game for this command to work.
Spoiler: changelog.txt (Open)

Code: Select all

Legend:
+: New
-: Removed
!: Bugfix
*: Change
===============

Changes from b2:
+ Added a command that lets the server save player data between maps: coopstats_savedatabetweenmaps
+ Added a command that lets the server specify whether player position should be saved or not: coopstats_nosavepos
+ Added a command that lets the players assign themselves a new id if needed: coopstats_getnewid

+ Added data saving support for keys
+ Added data saving support for currently selected weapon
+ Added data saving support for player position, angle, and pitch, which can be disabled by the server. Also, player position data is reset on map change regardless of coopstats_savedatabetweenmaps

- Removed unnecessary files & folders from the pk3

! Fixed the "runaway script 782 terminated" bug
! Saving and checking a new player's id didn't work properly. Fixed.
! If a player spectated and joined while being dead, they wouldn't die again if they had spawn invulnerability. Fixed.

* Major changes in the code to fix the bugs
* Slowed down the logging in process - it's required to fix some bugs
* Players' ids are now hashed before being stored on the server

+ added about.txt
+ added changelog.txt
===============

Description:
This is a multiplayer mod. It saves players' weapons, ammunition, health, armor, keys, and position in map (optional) in case they leave the server, and restores everything to them when they come back.

Credits:
Special thanks to Positron for implementing the MD5 hash function in ACS.

Limitations:
  • Stats saving supports only one million distinct players.
  • Stats are not saved on server shutdown. (I will be adding a feature that enables the admins to manually save the stats. Unfortunately I can't make it work automatically)
  • Only Doom/Doom2 weapons, ammo types, armor types, and keys are supported. Unknown armor types will be replaced with blue armor after rejoining. Modders will have to modify coop-stats to enable support for custom weapons/ammo-types/armor-types/keys/etc.
Risks:
  • This mod gives every player a unique ID and saves it in the ini. The player uses the same ID for every server, so don't give your ID to anyone. This mod gives no ways to the server host to access their players' IDs. If you suspect that someone is playing under your id, use the coopstats_getnewid command while in game to get a new id.
Planned features:
  • Support for stats saving before server shutdown
  • Support for more game modes like Survival & Invasion
  • A version of the coop stats mod designed for stronghold servers
Spoiler: Reminders for OP (Open)
  • Add notes & tips in the code for modders who want to use this in their mods
  • Add license.txt
Known bugs:
No known bugs so far. Feel free to report bugs in this thread.

How it works:
Since this is for Zandronum 1.2.2, it doesn't utilize the database feature that's available for Zandronum 1.3+. Instead, everything is done via ACS.

Every player that runs the mod for the first time gets assigned an ID. The ID is made by adding a string of 32 random characters next to the player's name, and putting the whole mess through an MD5 hashing function. The output of the function is the player's ID. On the server side, when a player joins, their ID is being associated with data (stored on the server side) which contains information about the player's weapons, health, armor, ammo, and ammo capacity, and is being automatically updated. When the player leaves the server, the data remains on the server. Once the player rejoins, they get their stuff back from the data associated with their ID.

Because I don't want to wait for Zandronum 1.3. And beacause it's fun.
Last edited by Konda on Sat Sep 05, 2015 10:28 am, edited 1 time in total.

Code: Select all

<Synert> fuck
<Synert> plugged in my memory stick and got a bsod

User avatar
Zeberpal
Forum Regular
Posts: 458
Joined: Mon Jun 04, 2012 6:55 am

RE: Coop stats saving (works in Zandronum 1.2.2)

#2

Post by Zeberpal » Wed Aug 20, 2014 5:54 am

Oh yes, waiting for a server to test it out!

I guess I could make players save their data at the certain place on map instead of //constantly recording player's data*/ with this!

:hearts:

P.S I wonder why there are some folders left. Does it save graphic/sound data in Pk3 too?
Last edited by Zeberpal on Wed Aug 20, 2014 5:59 am, edited 1 time in total.
Image Image

Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

RE: Coop stats saving (works in Zandronum 1.2.2)

#3

Post by Konda » Wed Aug 20, 2014 12:00 pm

Zeberpal wrote:P.S I wonder why there are some folders left. Does it save graphic/sound data in Pk3 too?
No... When I make new projects I use a bash script that automatically creates the PK3 structure inside a folder, including empty acs/loadacs lumps, decorate and sndinfo. I forgot to remove the unneeded lumps & folders :v
Last edited by Konda on Wed Aug 20, 2014 12:02 pm, edited 1 time in total.

Code: Select all

<Synert> fuck
<Synert> plugged in my memory stick and got a bsod

User avatar
Zeberpal
Forum Regular
Posts: 458
Joined: Mon Jun 04, 2012 6:55 am

RE: Coop stats saving (works in Zandronum 1.2.2)

#4

Post by Zeberpal » Wed Aug 20, 2014 7:12 pm

Wanna try it but no server yet, even on BE. Quite a number asked for this function, and just two replies on this /:
Reminds me when everyone asked for 3D floors in competitive modes, yet all we got is few singlelevel and MXU teamgame wads with it.

nvm, I'm just excited.
Last edited by Zeberpal on Wed Aug 20, 2014 7:26 pm, edited 1 time in total.
Image Image

Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

RE: Coop stats saving (works in Zandronum 1.2.2)

#5

Post by Konda » Fri Aug 22, 2014 12:01 am

I just want to let people know that I'm still working on this despite the lack of interest. OP has been updated, marking the planned features which will be available in the next beta. After I fix the "runaway script terminated" bug I'll release beta 2.

Code: Select all

<Synert> fuck
<Synert> plugged in my memory stick and got a bsod

Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

RE: Coop Stats (Beta 2): Save your weapons & everything else before disconnecting

#6

Post by Konda » Sat Aug 23, 2014 8:31 pm

Beta 2 is out, with bugfixes and new convenient features. Check the first post for more information.

Code: Select all

<Synert> fuck
<Synert> plugged in my memory stick and got a bsod

User avatar
Ænima
Addicted to Zandronum
Posts: 3480
Joined: Tue Jun 05, 2012 6:12 pm

RE: Coop Stats (Beta 2): Save your weapons & everything else before disconnecting

#7

Post by Ænima » Sat Aug 23, 2014 8:41 pm

Should I use this code as the basis for the Mercenaries "save your guns and items and money for later" feature or should I just wait for the next next version of Zandronum? D:
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay twists for survival / coop !


ZandroSkins
: a pack made by our community

Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

RE: Coop Stats (Beta 2): Save your weapons & everything else before disconnecting

#8

Post by Konda » Sat Aug 23, 2014 9:21 pm

Ænima wrote: Should I use this code as the basis for the Mercenaries "save your guns and items and money for later" feature or should I just wait for the next next version of Zandronum? D:
If Zandronum 1.3 will come out soon, then I think it's better if you wait for it. Unless you want players who don't have accounts to save their stuff too. But even then I think you should wait for 1.3 because I'll use some of its new features to replace the godawful clientside scripts (which I only use for cvar reading/storage) and make this mod much more stable. Not to mention that this mod didn't get proper public testing, so there may still be bugs. Also, it's easy to fuck things up for the player id storage and make players unnecessarily generate new ids and disconnect them from their data on other servers. Unless you touch only the parts which save and restore the player's items.

If you do end up using this code, now or in the future, I suggest that you make your mod generate its own ids for the players under a different cvar than what coop-stats uses, just to be safe.
Last edited by Konda on Sat Aug 23, 2014 9:27 pm, edited 1 time in total.

Code: Select all

<Synert> fuck
<Synert> plugged in my memory stick and got a bsod

User avatar
Zeberpal
Forum Regular
Posts: 458
Joined: Mon Jun 04, 2012 6:55 am

RE: Coop Stats (Beta 2): Save your weapons & everything else before disconnecting

#9

Post by Zeberpal » Fri Sep 12, 2014 5:58 pm

Do you plan to implement this feature in other game modes in perspective? Hmm..let's say TeamGame?
Image Image

Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

RE: Coop Stats (Beta 2): Save your weapons & everything else before disconnecting

#10

Post by Konda » Wed Sep 17, 2014 12:03 pm

Zeberpal wrote: Do you plan to implement this feature in other game modes in perspective? Hmm..let's say TeamGame?
I don't plan to implement support for each individual game mode but if I can make it work with gamemodes that have countdowns before rounds begin, then I automatically make it work on most of Zan's gamemodes, if not all. It should be fairly easy to do that.

On a side note, I was expecting Zandronum 1.3 to come out by now (rendering this mod obsolete) since everyone has been saying that it is going to be released very soon but that no longer appears to be the case from my perspective. Then I guess I'll start working on a coop stats version for stronghold once I get some time. That should be more interesting to the players (including me) than this.
Last edited by Konda on Wed Sep 17, 2014 12:05 pm, edited 1 time in total.

Code: Select all

<Synert> fuck
<Synert> plugged in my memory stick and got a bsod

Post Reply