Project X Forums



It is currently Sun Apr 28, 2024 3:21 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: DebugErr - Game Speed Manipulation Utilities
PostPosted: Mon Aug 18, 2014 7:46 pm 
Offline

Joined: Mon Aug 18, 2014 6:49 pm
Posts: 15
Hi there,

I crafted out a library which allows you to get and set the game speed. The game speed is the game parameter which can be set to 150% in the lobby by the /150 command or manipulated by the number rows in replays. I also wrote two utilities to play around with it. They also allow you to change the physics speed or the sound speed separately.

Please note that there's still a bug that it doesn't reset the game manipulations, so you probably have to restart your game if you quitted it while a speed manipulation was active. If someone knows how to catch the event of the game being (abruptly) closed, please tell me.

It requires hack_utils by Steps (included in the download) to allow process memory editing and manipulation of game code.

As a general note before going into details about the libs attached, I put methods and variables under "namespaces"; they're prefixed with my acronym "deb_" and the library name. For example, if I mentioned the method "SetGameSpeed(int value)" here, it's actually deb_gamespeed_SetGameSpeed(int value). That's because of the global namespace clutter PX generates.
The deb_gamespeed_priv_* methods are of no interest to you and may only be used by the library itself internally.

deb_gamespeed
This is the core of the game speed manipulation. The following behavior is triggered at game start when using this library:
  • Preparing the games code to allow direct editing of the game speed.
  • Resetting the gamespeed to 0x10000 (= default 100% speed)

The following methods are provided by the library for you to use:
  • GetGameSpeed(): Returns the current game speed (synchronized physics and sound speed), where for example 0x10000 is default speed, 0x20000 double speed and 0x05000 half speed. If physics and sound speed are different, the physics speed will be returned.
    GetPhysicsSpeed(): Returns the current physics speed, not including the sound speed. 0x10000 is default speed.
    GetSoundSpeed(): Returns the current sound speed, e.g. the pitch of the voices, explosions and other stuff. 0x10000 is default speed.
  • SetGameSpeed(int speed): Sets the physics and sound speed as stated before. As a minimum it will be clamped to $1500, as any lower value freezes the game speed completely and doesn't allow a frame to come to set it back again. A maximum value is not enforced as the limit is only your processor speed.
  • SetPhysicsSpeed(int speed): Sets the physics speed as stated before. Also limited to $1500.
  • SetSoundSpeed(int speed): Sets the sound speed as stated before. Also limited to $1500.
  • ResetGameSpeed(): Does the same as calling SetGameSpeed($10000), e.g., resets the speeds back to normal.
  • ResetPhysicsSpeed(): Does the same as calling SetPhysicsSpeed($10000), e.g., resets the physics speed back to normal.
  • ResetSoundSpeed(): Does the same as calling SetSoundSpeed($10000), e.g., resets the sound speed back to normal.

Technical details:
To allow the manipulation of the game speed with the current hacking possibilities, the opcode which retrieves the speed is manipulated to not return the value at address x, but a constant modified by you:
Original code: WA+0x4FBB1A - MOV EAX, [ESI+4C720000];
Hacked code: WA+0x4FBB1A - MOV EAX, <deb_gamespeed_physicsSpeed>; NOP;

Another opcode is manipulated which retrieves the sound sample rate to allow pitching of the sounds.
Original code: WA+0x545AB1 - MOV EAX, [EBX+B80B0000];
Hacked code: WA+0x545AB1 - MOV EAX, <deb_gamespeed_soundSpeed>; NOP;

As you might have guessed this is not the "official" method call to change the game speed as this isn't possible with the current hacking tools.

ManipulateOpcode(bool enable) keeps track of the opcode state and must not be called by you. Even though the library is protected against dumb usage as much as possible, this doesn't include some users dumbness.

Right now, this opcode stays manipulated even after leaving the game, so if the speed hasn't been reset, even normal, non-PX games will have the last speed set (but other players won't see that except as lags since they don't run a manipulated WA executable). Restart the game to fix this. Replays may also not be toggled in speed anymore after using a game speed manipulating weapon if you're playing offline.


deb_slowmotion
Provides a small test utility to be used in game. It halfs the game speed if used and duplicates it if used again. At the turns end, it is reset anyways.

deb_lsd
This provides a slightly advanced testing utility which "wobbles" the game speed when used, it gets faster and slower and faster and over and again, as if you're on LSD, but without the nice colors (still writing the deb_palette lib for global color modifications yet). Resets the effect when the turn ends or the utility is used again.

I also attached a small PX scheme to test out the utilities instantly, they replace laser sight and invisibility.

Greetards


Attachments:
deb_gamespeed.zip [11.64 KiB]
Downloaded 526 times


Last edited by DebugErr on Mon Mar 02, 2015 6:36 pm, edited 3 times in total.
Top
 Profile  
Reply with quote  
 Post subject: Re: DebugErr - Game Speed Manipulation Utilities
PostPosted: Mon Aug 25, 2014 10:01 am 
Offline

Joined: Wed Jul 31, 2013 4:03 pm
Posts: 35
Location: Ukraine
ahahahahahahahhaha :D
that's funny a lot :D
great libs for kaos scheme!!! :!:


Top
 Profile  
Reply with quote  
 Post subject: Re: DebugErr - Game Speed Manipulation Utilities
PostPosted: Mon Aug 25, 2014 10:06 am 
Offline

Joined: Wed Jul 31, 2013 4:03 pm
Posts: 35
Location: Ukraine
btw, your idea with namespace is super great. there are so much mess with this PX globals that i can't stand it D: PX community must consider this issue i think! we must follow some conventions... no entuser - no moderator of coding style :|


Top
 Profile  
Reply with quote  
 Post subject: Re: DebugErr - Game Speed Manipulation Utilities
PostPosted: Tue Aug 26, 2014 5:33 pm 
Offline

Joined: Mon Aug 18, 2014 6:49 pm
Posts: 15
Noone can tell me how to code! :D

Would be nice to rewamp some libs by putting them into namespaces.
I don't know if my rules are perfect yet.


Top
 Profile  
Reply with quote  
 Post subject: Re: DebugErr - Game Speed Manipulation Utilities
PostPosted: Mon Mar 02, 2015 6:35 pm 
Offline

Joined: Mon Aug 18, 2014 6:49 pm
Posts: 15
Updated, you can now separately set, get and reset physics and sound speed. The game speed still does both synchronized, so your old scripts stay compatible.


Top
 Profile  
Reply with quote  
 Post subject: Re: DebugErr - Game Speed Manipulation Utilities
PostPosted: Tue Mar 03, 2015 9:56 am 
Offline

Joined: Mon Jul 30, 2012 9:45 am
Posts: 194
Wow, completely forgot about this xD Fucking awesome that you're still updating it!

_________________
http://twitch.tv/wormsdotam | http://worms.am/hl | http://worms.am/zombieshopper | http://worms.am/golf | http://worms.am/holywar


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 42 guests


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Skin by Lucas Kane