Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Thu Mar 28, 2024 12:22 pm
All times are UTC + 0
In-game timer memory address
Moderators: Ares Support Team at PPM, Global Moderators, Red Alert 2 Moderators
Post new topic   Reply to topic Page 1 of 1 [10 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
ROMaster2
Vehicle Driver


Joined: 21 Jan 2016

PostPosted: Mon Feb 19, 2018 9:49 pm    Post subject:  In-game timer memory address Reply with quote  Mark this post and the followings unread

I figured that if anyone might know what controls the timer displayed at the end of a mission, the Ares developers would.

I've been trying to solve a number of problems in speedrunning some of the older C&C games and went digging around the game for anything resembling game time. I did find a few addresses, but they almost always are desynced with the time that's displayed on the score screen. Often times it's longer than the recorded real time for the mission from start to end.

Does anyone know what addresses/functions that control the time displayed on the score screen? I'd appreciate the help.

Edit: No problem. While I'm here I may as well also mention the request for an ingame timer display from years ago: https://blueprints.launchpad.net/ares/+spec/ingame-timer-display -- I'd have bumped it if I knew how. This would be even better, especially if it can be used on vanilla without impacting other parts of gameplay.

Last edited by ROMaster2 on Mon Feb 19, 2018 11:50 pm; edited 1 time in total

Back to top
View user's profile Send private message Visit poster's website
AlexB
Commander


Joined: 31 May 2010
Location: Germany

PostPosted: Mon Feb 19, 2018 10:43 pm    Post subject: Reply with quote  Mark this post and the followings unread

Sorry, I did see this too late. I can take a look tomorrow.

_________________

Back to top
View user's profile Send private message
AlexB
Commander


Joined: 31 May 2010
Location: Germany

PostPosted: Mon Feb 26, 2018 2:52 am    Post subject: Reply with quote  Mark this post and the followings unread

Sorry, it took some time. There's a timer, but it doesn't start from 0 and count game frames. It counts real time, and starts at the then-current time Thus, to get the correct time, you need to call the function that gets the current time and subtract the start value of the timer.

The function that gets the current time in seconds is at 0x6C8C40 (GetTime()). It is implemented as "return timeGetTime() >> 4;".

The timer is located at offset 0x614 (ElapsedTimer) after dereferencing the pointer at 0xA8B230 (the Scenario data). It has two useful members at 0x0 (int TimeStart) and 0x8 (int TimeLeft).

The formula to get the elapsed time is
Code:
auto elapsed = &Scenario->ElapsedTimer;
auto time = elapsed->TimeLeft;
if(elapsed->TimeStart != -1) {
  time = GetTime() - elapsed->TimeStart + elapsed->TimeLeft;
}


If I read the code correctly, you need to divide then number by 60 to get the seconds.

_________________

Back to top
View user's profile Send private message
MRMIdAS
Energy Commando


Joined: 17 Jul 2008

PostPosted: Mon Feb 26, 2018 3:25 am    Post subject: Reply with quote  Mark this post and the followings unread

AlexB wrote:

If I read the code correctly, you need to divide then number by 60 to get the seconds.


60 seconds in a minute, seems like a safe assumption.

_________________
MIdAS - Turning wages into beer since 2002

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Mon Feb 26, 2018 1:21 pm    Post subject: Reply with quote  Mark this post and the followings unread

ROMaster2 wrote:
request for an ingame timer display

You could create a SHP for this.
Then place a Neutral dummy building on the map using the timer SHP.

It just needs 2 ActiveAnims
[IngameTimer]
ActiveAnim=Seconds
ActiveAnimX=20 ;move the seconds a few pixel to the right (make it match the size of the 2 numbers in the SHP)
ActiveAnimTwo=Minutes

[Seconds]
Image=NUMBERS ;new SHP with numbers 00-59
LoopStart=0
LoopEnd=60
LoopCount=-1
Rate=60 ;every second, the SHP frame is raised

[Minutes]
Image=NUMBERS ;new SHP with numbers 00-59
Start=0
End=60 ;feel free to use 2nd SHP with more frames if you have longer games
Rate=1 ;every minute, the SHP frame is raised



\Edit
or add a custom dummy SuperWeapon with a very high charge duration and give this to a dummy Neutral building.
When the map starts, you'll see the SW timer that counts down. At the end of a match, just calculate the difference between current timer and the max duration that you've set.

_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
ROMaster2
Vehicle Driver


Joined: 21 Jan 2016

PostPosted: Tue Feb 27, 2018 4:30 am    Post subject: Reply with quote  Mark this post and the followings unread

Thanks a bunch for that. That helped me figure out the desync between actual real time and game time: the in-game timer runs at 104.16667% the speed of real time. Now to test the effects of lag since that did affect one level I did vs someone else's.

This will be really helpful going forward, thank you!

Lin Kuei Ominae wrote:

or add a custom dummy SuperWeapon with a very high charge duration and give this to a dummy Neutral building.
When the map starts, you'll see the SW timer that counts down. At the end of a match, just calculate the difference between current timer and the max duration that you've set.


Sounds like that could be done by injecting an invisible indestructible building with those properties at the very edge of the map upon load. I also have no idea how the injections work so I could be completely wrong.

Back to top
View user's profile Send private message Visit poster's website
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Tue Feb 27, 2018 10:43 am    Post subject: Reply with quote  Mark this post and the followings unread

Isn't every map using at least one simple light post? Just add the code to that building.Wink

_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
Graion Dilach
Defense Minister


Joined: 22 Nov 2010
Location: Iszkaszentgyorgy, Hungary

PostPosted: Tue Feb 27, 2018 11:03 pm    Post subject: Reply with quote  Mark this post and the followings unread

A good amount of RA2 maps don't use lightposts.

_________________
"If you didn't get angry and mad and frustrated, that means you don't care about the end result, and are doing something wrong." - Greg Kroah-Hartman
=======================
Past C&C projects: Attacque Supérior (2010-2019); Valiant Shades (2019-2021)
=======================
WeiDU mods: Random Graion Tweaks | Graion's Soundsets
Maintainance: Extra Expanded Enhanced Encounters! | BGEESpawn
Contributions: EE Fixpack | Enhanced Edition Trilogy | DSotSC (Trilogy) | UB_IWD | SotSC & a lot more...

Back to top
View user's profile Send private message Visit poster's website ModDB Profile ID
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Wed Feb 28, 2018 6:43 am    Post subject: Reply with quote  Mark this post and the followings unread

Graion Dilach wrote:
A good amount of RA2 maps don't use lightposts.

I'm not a fan of using lightposts in general, the level lighting already adds some terrain variance, and getting the overall ambient lighting right seems more important. I only use them on a few specialty maps where I'm deliberately trying to make it unnatural...

_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
OmegaBolt
President


Joined: 21 Mar 2005
Location: York, England

PostPosted: Wed Feb 28, 2018 12:30 pm    Post subject: Reply with quote  Mark this post and the followings unread

Except level lighting looks like crap.

Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [10 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 0.1484s ][ Queries: 11 (0.0074s) ][ Debug on ]