MantisBT - Zandronum
View Issue Details
0001501Zandronum[All Projects] Suggestionpublic2013-09-12 08:302014-06-16 08:57
mifu 
 
normalminorN/A
closeddenied 
 
 
0001501: ACS - Ablity to Get the system date from the server/client and use it in a script
I would like to request a feature that can be useful for mappers. Wondering if it is possible to allow ACS to be able to query the Server Box or the clients machine for the system date on the box then use that to allow the script to do stuff based on the date (so like ROTT style stuff however using it to do things in game rather then pretty custom screens like ROTT has)

For example, a use for this could be.

if (Get_Date() == Date)
then
Changemap blah
else
Changemap nextmapinmapinfo

This will allow mappers to create secret levels and make them only accessible depending on the date or even allow map changes if it is a certain date.

Suggestions on how to implement this would be making a command on zandronum to query the box that the server (or the game) is running on for the date, then allow ACS to use it as a function (like Get_Date() or something) so ACS can pull it down and use it as a value.

acs, Multiplayer
Issue History
2013-09-12 08:30mifuNew Issue
2013-09-12 15:29XsnakeNote Added: 0007174
2013-09-12 16:27Blzut3Note Added: 0007175
2013-09-12 19:26Edward-sanNote Added: 0007180
2013-09-13 04:39mifuNote Added: 0007183
2013-09-13 04:42mifuNote Edited: 0007183bug_revision_view_page.php?bugnote_id=7183#r4025
2014-06-14 17:57WatermelonNote Added: 0009338
2014-06-16 00:18WatermelonNote Added: 0009497
2014-06-16 00:18WatermelonStatusnew => closed
2014-06-16 00:18WatermelonResolutionopen => denied
2014-06-16 00:18WatermelonNote Deleted: 0009338
2014-06-16 00:18WatermelonNote Edited: 0009497bug_revision_view_page.php?bugnote_id=9497#r4994
2014-06-16 00:18WatermelonNote Edited: 0009497bug_revision_view_page.php?bugnote_id=9497#r4995
2014-06-16 00:19WatermelonNote Edited: 0009497bug_revision_view_page.php?bugnote_id=9497#r4996
2014-06-16 00:52mifuNote Added: 0009499
2014-06-16 00:52mifuStatusclosed => feedback
2014-06-16 00:52mifuResolutiondenied => reopened
2014-06-16 02:01Blzut3Note Added: 0009501
2014-06-16 03:15WatermelonNote Added: 0009503
2014-06-16 03:16WatermelonNote Edited: 0009503bug_revision_view_page.php?bugnote_id=9503#r4998
2014-06-16 03:16WatermelonNote Edited: 0009503bug_revision_view_page.php?bugnote_id=9503#r4999
2014-06-16 03:17mifuNote Added: 0009504
2014-06-16 03:17mifuStatusfeedback => new
2014-06-16 08:57DuskStatusnew => closed
2014-06-16 08:57DuskResolutionreopened => denied

Notes
(0007174)
Xsnake   
2013-09-12 15:29   
More than an ACS function, a Cvar that returns the local time of the client/server (depending on which side the GetCvar function is called) would be nice, if it doesn't exist already. This would allow modders to build custom random functions based on the current time.
(0007175)
Blzut3   
2013-09-12 16:27   
No.

'http://forum.zdoom.org/viewtopic.php?f=18&t=24327 [^]'
'http://forum.zdoom.org/viewtopic.php?f=18&t=25708 [^]'

Also, I'm not sure what RNG algorithm you're going to implement in ACS that works better than the Mersenne twister algorithm that random() uses. If it's not working properly there may be an issue elsewhere.

Net demo sync could also be destroyed if used in client side scripts.
(0007180)
Edward-san   
2013-09-12 19:26   
Why don't you make a modded sv_periodoftime which you can set in console and its value is read inside ACS?
(0007183)
mifu   
2013-09-13 04:39   
(edited on: 2013-09-13 04:42)
I do not see why graf No'ed this apart from the "abuse" he thinks people will use it for.

It honestly does not need to be advanced, It would just be good if Zandronum can just get the date. (It does not need the time) and use that to either run checks to see what to do on a map in terms of behavior either as a cvar or anything really.

It does not even have to work client side either. For example, decide which map to go to in multiplier if it is on a certain date.

(0009497)
Watermelon   
2014-06-16 00:18   
(edited on: 2014-06-16 00:19)
We talked a lot on IRC about the solution to this. If we introduce access to system time, it is possible for a coder to add in ACS which will make wads not work before/after/at a certain date. This resulted in an automatic no.

All is not lost, it is possible to sum up the number of tics to get a unique time (knowing that 1 tic is 28 ms, you can go from there). You could set a default time in game and also go from there.

Blzut also said that there may be a way to get the time from when the database was created, which would exclude ACS being used to mess with a wad (and thus give you your time mechanism).


Therefore, if you're interested in the above and want to pursue a different route with this ticket, post to unlock this topic.

(0009499)
mifu   
2014-06-16 00:52   
I think we can pursue a different route as watermelon explained.
This should be good.
(0009501)
Blzut3   
2014-06-16 02:01   
To clarify I didn't say you could get the time from the database. I said that you could accumulate the time using the database in order to store the amount of time that passed in the world across server starts. Which is all you need for some real time system. If you manually input date, you could put time easter eggs in.
(0009503)
Watermelon   
2014-06-16 03:15   
(edited on: 2014-06-16 03:16)
Sorry for my misinterpretation. I need to stop speed reading (fatal flaw of mine).





Therefore Mifu how I'd do it is:

Script loops until the level exits (use UNLOADING or something), and sum up the number of tics with Timer().

Multiply this by 28 to get how many milliseconds has passed. If you have an intermission screen, add on some time (right now there is no way AFAIK to count how many tics passed during the intermission screen, this could go in another ticket).

Another solution would be to allow ACS modders access to the 'gametic' integer, which *should* be incremented during intermission.

A possible issue is if the server locks up when no one is in. I'm unsure if gametic still gets +1'd or not when no human is in the server.



This is where we have to go from here.


The last step is writing a near exact time in the database and then adding it to that, thus giving you a virtual time. It probably won't be perfect, but could be reasonable.

(0009504)
mifu   
2014-06-16 03:17   
Yea that should be fine Blzut3. :)