bike speed limit

What do you want to see in Armagetron soon? Any new feature ideas? Let's ponder these ground breaking ideas...
Post Reply
User avatar
galaxy invader
On Lightcycle Grid
Posts: 29
Joined: Sun Jun 12, 2011 9:31 pm

bike speed limit

Post by galaxy invader »

I just finished compiling my new 'SPEED LIMIT' game feature controlled by the following two commands
CYCLE_SPEED_LIMIT
CYCLE_SPEED_LIMIT_DECAY

Once the players bike speed is >= CYCLE_SPEED_LIMIT the acceleration is altered by CYCLE_SPEED_LIMIT_DECAY

Ive set the default value for CYCLE_SPEED_LIMIT 99999 so that it will not effect the game play if the commands are not in the server configs

For testing I set CYCLE_SPEED_LIMIT 100 and CYCLE_SPEED_LIMIT_DECAY -1 , this made the game play normally as long as I kept my speed below the limit but once I had exceeded it my bike accelerated wildly causing it to crash and explode which is exactly what I was trying to achieve, no more speeders in my server !

I just tested it on some friends with lan and got many WTF?'s / LOL's and on the whole everyone enjoyed it once they had got used to it :lol:

The code is based on the cycle_speed_decay_above stuff thats already in there, I wasnt sure what the nConfItemVersionWatcher::Group_Bumpy was all about so I copied it as is into my new variables and it seems to work but let me know if it needs changing

so heres my mods that I added to gCycleMovement.cpp

variables

Code: Select all

// galaxy invader add speed limit variable
REAL sg_speedCycleLimit = 99999;
static nSettingItemWatched<REAL> c_sl("CYCLE_SPEED_LIMIT",
                                       sg_speedCycleLimit,
                                       nConfItemVersionWatcher::Group_Bumpy,
                                       8);

// galaxy invader add speed limit acceleration factor
REAL sg_speedCycleLimitDecay = -1;
static nSettingItemWatched<REAL> c_sld("CYCLE_SPEED_LIMIT_DECAY",
                                       sg_speedCycleLimitDecay,
                                       nConfItemVersionWatcher::Group_Bumpy,
                                       8);
code added to gCycleMovement::CalculateAcceleration() ( the last 3 lines are mine )

Code: Select all

REAL baseSpeed = sg_speedCycle * SpeedMultiplier();
    if ( verletSpeed_ <= ( sg_correctAccelerationScaling.Supported() ? baseSpeed : sg_speedCycle ) )
        acceleration+=( baseSpeed - verletSpeed_) * sg_speedCycleDecayBelow;
    else
        acceleration+=( baseSpeed - verletSpeed_) * sg_speedCycleDecayAbove;

    // galaxy invader top speed limit changes
    if ( verletSpeed_ >= sg_speedCycleLimit )
        acceleration+=( baseSpeed - verletSpeed_) * sg_speedCycleLimitDecay;
I'll need to add some help text to english_base etc, please let me know of any changes I should make to this code if its not correct

Thanks
Image
User avatar
Phytotron
Formerly Oscilloscope
Posts: 5041
Joined: Thu Jun 09, 2005 10:06 pm
Location: A site or situation, especially considered in regard to its surroundings.
Contact:

Re: bike speed limit

Post by Phytotron »

You know, there's already a CYCLE_SPEED_MAX command. I suppose that doesn't provide quite the amusement you get from your more punitive approach, though.
User avatar
galaxy invader
On Lightcycle Grid
Posts: 29
Joined: Sun Jun 12, 2011 9:31 pm

Re: bike speed limit

Post by galaxy invader »

Phytotron wrote:You know, there's already a CYCLE_SPEED_MAX command....
I tried that command before I made the mod but it didnt seem to have any effect on the game ?
Image
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Re: bike speed limit

Post by Jonathan »

In the Netherlands there is no default speed limit for bikes. Can you exempt me?
ˌɑrməˈɡɛˌtrɑn
User avatar
Phytotron
Formerly Oscilloscope
Posts: 5041
Joined: Thu Jun 09, 2005 10:06 pm
Location: A site or situation, especially considered in regard to its surroundings.
Contact:

Re: bike speed limit

Post by Phytotron »

You understand that the value is a factor of CYCLE_SPEED? For example, if your base CYCLE_SPEED is 10 and you want the speed limit to be 50, you would set CYCLE_SPEED_MAX 5.
User avatar
galaxy invader
On Lightcycle Grid
Posts: 29
Joined: Sun Jun 12, 2011 9:31 pm

Re: bike speed limit

Post by galaxy invader »

ah thanks for that info , I just tried it and it works

so I re-invented the wheel in a funnier way :mrgreen: , btw if you set my decay to positive value its like slamming on the brakes when you hit the limit but I prefer negative values for the lol factor :)
Image
User avatar
galaxy invader
On Lightcycle Grid
Posts: 29
Joined: Sun Jun 12, 2011 9:31 pm

Re: bike speed limit

Post by galaxy invader »

Jonathan wrote:In the Netherlands there is no default speed limit for bikes. Can you exempt me?
i'll try ;)
Image
User avatar
Phytotron
Formerly Oscilloscope
Posts: 5041
Joined: Thu Jun 09, 2005 10:06 pm
Location: A site or situation, especially considered in regard to its surroundings.
Contact:

Re: bike speed limit

Post by Phytotron »

galaxy invader wrote:btw if you set my decay to positive value its like slamming on the brakes when you hit the limit
http://forums3.armagetronad.net/viewtop ... 741#p62741
Tank Program wrote:Stopping from overheating would be too advantageous in tunneling situations...
User avatar
galaxy invader
On Lightcycle Grid
Posts: 29
Joined: Sun Jun 12, 2011 9:31 pm

Re: bike speed limit

Post by galaxy invader »

omg are those posts really 2006 or is there something wrong with my laptop flux capacitor ?
Image
User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1876
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Re: bike speed limit

Post by kyle »

also you probably should use -1 instead of 9999, -1 usually is disabled in those settings that really should not be < 0
Image
User avatar
galaxy invader
On Lightcycle Grid
Posts: 29
Joined: Sun Jun 12, 2011 9:31 pm

Re: bike speed limit

Post by galaxy invader »

kyle wrote:also you probably should use -1 instead of 9999, -1 usually is disabled in those settings that really should not be < 0
yeah it was a quick hack, i'll add a check for 0 or less and use that to disable it thanks
Image
Post Reply