[Logo]
 
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Booster: Fixed but not fixed  XML
Forum Index -> Druids RPG Development
Author Message
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

I'm coding a separate module that should sufficiently fix Booster. I had all sorts of problems originally making it part of DruidsRPG (the biggie being that there's three places so far I've run into that seem to require a package name before certain class calls, and then another bug/log spam impacting bots that reoccurred somewhere along the line even when the booster fix was it's own mod - that I think I *may* have fixed but I can't be sure yet).

The remaining problem right now is that in my testing (on a test server), it runs fast. Very fast. Faster than it should. Eats 100 or so adren in about 15 seconds. The original is supposed to run twice that. Here's what I have so far:

class BotComboDefensive extends Combo;

Originally I just extended ComboDefensive but I ran into some wierd bugs that cleared up when I just copied ComboDefensive's code.

Tick() is included from Combo. On my test box, I think that's the culprit - it's running superfast and the math is resulting in rounding errors (0.2 rounded to 1, every like 0.06 seconds).

It's 11:00 now and I've been working on this quite some time - like 6 hours. The next thing to try is to overwrite Tick() to include a global var float that keeps track of fractional adren and then only decriments when there's more than 1 whole adren to decriment.

Anyways, a zip of the source is attached if anyone wants to download it and play with it. Let me know what you see.

EDIT: REMOVED OLD SOURCE.

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
TheDruidXpawX

Wicked Sick!
[Avatar]

Joined: 12/19/2004 18:32:13
Messages: 1946
Offline

Wow nice work bot. Does this override the regular Booster combo then?

Also, you might consider using a timer instead of a tick as to avoid the rounding errors.

There's got to be some way to suck the package name off a class object or something so as to prevent the naming problem.

Dru

Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page

The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.

The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

TheDruidXpawX wrote:
Wow nice work bot. Does this override the regular Booster combo then? 

Oh yes. Very much yes. Back back back back and all that. Except that with greater than SuperMax (which is start+99) health, I would start getting shield. The catch being that with Tick not working the way it's supposed to apparently work (or working a bit fast), I can't go from 0 shield to 150 shield with 100 adren. I end up in the 90s.

I could swear that I easily got 150 (with adren to spare) going from SuperMax health and 0 shield to start with the original Booster.

TheDruidXpawX wrote:
Also, you might consider using a timer instead of a tick as to avoid the rounding errors. 

Hmmm ... I may just do that - overwrite Tick so that it does nothing; there's already a Timer in use ...

Tick is used to do the work on the adren and is part of the parent Combo class, but Timer is used to mess with Health and Shield. It wouldn't be too much to extend it so that it does the Adren work too ...

I think they use Tick for the adren though so it's a "smoother" progression (IE, with the defaults, if Tick is around 1/(100/30) seconds - or .3 sec, you loose 1 adren every Tick and it updates that often). With the Timer that's in use, I think it will equate out to 3 adren every .9 seconds. No biggie in the grand scheme of things I guess.

TheDruidXpawX wrote:
There's got to be some way to suck the package name off a class object or something so as to prevent the naming problem. 

I couldn't find it. Mind you I didn't want it to be some huge roadblock for me at the time and it was a minor issue when compared to the other problems I was running into - and since my bed time is usually 9:00pmish, and I posted at 11:15pmish, I was starting to get a little study-drunk (forgetting if I saved out a class for a reload, or "Did I compile this version of that class in yet?", that kind of thing). I may pursue it later.

In the grand scheme of things, as its own mod, it's only two classes: the mutator class and then the booster, and all the "picky" strings wanting the mutator name in the string are in the mutator class.

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
Szlat

Wicked Sick!

Joined: 05/18/2005 18:32:41
Messages: 2124
Location: UK
Offline

Would it be possible to set it so that when your shield is full, the combo exits - rather than waiting until your adrenaline runs out?
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

Szlat wrote:
Would it be possible to set it so that when your shield is full, the combo exits - rather than waiting until your adrenaline runs out? 

Certainly.

The next question is: Dru, do you want it that way?

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
Szlat

Wicked Sick!

Joined: 05/18/2005 18:32:41
Messages: 2124
Location: UK
Offline

By the way, well done Bot. Just tried it out and it seems to work ok. Regened my shield even tho my health was at 450.
(Lots of timer warnings for duration and adrenaline - but that was just debug which you will no doubt be removing before submitting). Didn't check the rate at which it was using adrenaline tho.

As an aside, the two artifacts HealingBlast and SphereHealing currently check for players running a 'ComboDefensive', and will not heal those players. If we add BotBooster instead of ComboDefensive, that code is still probably ok. In this case it will heal the player - which is ok (since the player will be running a 'BotBooster' not a 'ComboDefensive').
Szlat

Wicked Sick!

Joined: 05/18/2005 18:32:41
Messages: 2124
Location: UK
Offline

BotFodder wrote:

Szlat wrote:
Would it be possible to set it so that when your shield is full, the combo exits - rather than waiting until your adrenaline runs out? 

Certainly.

The next question is: Dru, do you want it that way? 

I suppose it ought to actually check for health and shield being full, just in case someone starts off the booster, then picks up 150 shield. It would be sad if it exited with them only having 50 health.
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

Szlat wrote:
I suppose it ought to actually check for health and shield being full, just in case someone starts off the booster, then picks up 150 shield. It would be sad if it exited with them only having 50 health. 

Actually the way it's written originally, it doesn't increment shield or even check shield strength until Pawn.Health >= Pawn.SuperHealthMax

Changes to code (not tested - still at work - will test when I get home):

Code:
 function Timer()
 
 {
 	local Pawn P;
 	local bool ShieldNotFull;
 
 // We need to default this to True, so that we don't stop unless it's false.
 	ShieldNotFull = True;
 	P = Pawn(Owner);
 	if (P == None || P.Controller == None)
 	{
 		Destroy();
 		return;
 	}
 
 	if (P.Role == ROLE_Authority)
 
 	{
 
 		P.GiveHealth(5, P.SuperHealthMax);
 
 		if ( P.Health >= Pawn(Owner).SuperHealthMax )
 // AddShieldStrength returns True if ShieldStrength is changed
 // We won't react to the change in ShieldNotFull until after adren is eaten.
 
 			ShieldNotFull = P.AddShieldStrength(5);
 // Flag Carriers loose adren twice as fast!
 		if (P.Controller.PlayerReplicationInfo != None && P.Controller.PlayerReplicationInfo.HasFlag != None)
 		{
 			P.Controller.Adrenaline -= 6;
 		}else
 		{
 			P.Controller.Adrenaline -= 3;
 		}
 		if (P.Controller.Adrenaline <= 0)
 		{
 			P.Controller.Adrenaline = 0;
 			Destroy();
 			return;
 		}
 // If Shield is full, then stop.
 		if (!ShieldNotFull)
 		{
 			Destroy();
 			return;
 		}
 	}
 }
 
 // Overwrite Combo's Tick - adren use now in Timer
 simulated function Tick(float DeltaTime)
 {
 	// Do nothing.
 }

Things to note:

It won't stop eating adren when it bumps your shield to full - it will only stop when your shield is already full (and takes another dose of adren, muahahahaha!). If your shield goes full, and you take damage before Timer is called again (0.9 sec if I read the original code right), Booster will bump your shield again and keep running.

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

Szlat wrote:
As an aside, the two artifacts HealingBlast and SphereHealing currently check for players running a 'ComboDefensive', and will not heal those players. If we add BotBooster instead of ComboDefensive, that code is still probably ok. In this case it will heal the player - which is ok (since the player will be running a 'BotBooster' not a 'ComboDefensive'). 

Actually the class is BotComboDefensive - the mod is BotBooster (no relation to the character ).

If you're doing some kind of regular expression check, it might still detect it properly. But as you noted, still not a big deal even if it does not; the healing won't kill the Booster like the original ComboDefensive would.

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

TheDruidXpawX wrote:
There's got to be some way to suck the package name off a class object or something so as to prevent the naming problem. 

I have Googled until my fingers bled. Still have not found a solution to this issue.

If the current revision works as desired, I'll just keep it as it's own mod. This way if there are problems, we don't have to extract it from DruidsRPG or recompile DruidsRPG - you'd just have to specify its non-usage.

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
Szlat

Wicked Sick!

Joined: 05/18/2005 18:32:41
Messages: 2124
Location: UK
Offline

It looks like everytime you use "BotBooster.BotComboDefensive" it is as a string. Can you just have a UT2004RPG.ini config variable that contains that string? Then the package can be changed in the ini file without recompiling?
Not perfect, but better than hard coded.
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

Szlat wrote:
It looks like everytime you use "BotBooster.BotComboDefensive" it is as a string. Can you just have a UT2004RPG.ini config variable that contains that string? Then the package can be changed in the ini file without recompiling?
Not perfect, but better than hard coded. 

As small as it is, I doubt I'll be tweaking it any. It's 3 classes - two of which required "BotBooster." calls.

Oh yeah, btw: WORKS PERFECT NOW. Near as I can tell, anyway.

The key it turns out is that Booster was getting replaced on the server, but not the clients. This would result in both Boosters being run at the same time - which explains the adren drain!

I found some code that does a *lot* of combo reworking and borrowed what I needed to successfully replicate the combo change to the player. Compiled mod and source attached.
 Filename BotBooster.zip [Disk] Download
 Description
 Filesize 7 Kbytes
 Downloaded:  186 time(s)


I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
TheDruidXpawX

Wicked Sick!
[Avatar]

Joined: 12/19/2004 18:32:13
Messages: 1946
Offline

as for disabling tick, in PostNetBeginPlay()

just Engine.disable('tick');

Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page

The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.

The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

Something occurred to me this morning while I was getting ready for work.

Are there other combos we'd want to remove or possibly replace?

The final clues as to how to replicate the changes to the client I got from a mod called No Invisibility that was written by the Speaker Projects Development Team. No Invisibility as a name is misleading - the mod is configurable and contains code that:

  • Allows for removing (completely - not just replacing) any combo, even in dedicated server situations, bots included.
  • Contains four new combos, including a fix for Speed, which they say is broken.

    Unfortunately, the one thing No Invisibility does not have is a fixed Booster/Defensive combo. So, I see a couple of options:

  • If Booster is the only one we're concerned about, then just use the current incarnation of BotBooster
  • If we have other combos we'd like to remove, we could use No Invis, configure it to remove the combos we want removed, and write an extension of No Invis to replace Booster
  • Write a similar/customized mod of our own to do what we want. This would eat up a solid weekend day for me. The benefits of doing this are that we'd have a smaller mod; No Invis does contain a lot of extra code (mod replacements) that we wouldn't use.

    Now, while a lot of code in whatever solution we come up with will be important for use with DruidsRPG, I think there's a bit of wisdom keeping this as a separate mod. First off, it can more easily be removed from usage if we spot a bug and can't exactly figure out where it's occurring. I originally had this mod as part of DruidsRPG, but I encountered bugs that resulted mainly in a greater than average spewing of log file lines (these lines did not contain the usual info such as the mod/package/class that triggered the line - but they were apparently bot related lines regarding InstigatorData). These bugs initially went away when the code was migrated to it's own mod (admittedly during testing the spewing reoccurred apparently based on when the mod implemented relative to other mods, but I haven't seen the problem since, and there may be clues on how to avoid/resolutions to this problem in No Invis - I'd have to look).

    I'll be starting a discussion in the DC forum allowing the general community to weigh in on the idea of replacing other adren combos.

  • I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
    WM: (DC)BotFodder 170
    MM: (DC)BotDoctor 141
    AM: (DC)BotBooster 147
    http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
    Twitter: http://twitter.com/ericdives
    [WWW] aim icon [MSN]
    BotFodder

    Wicked Sick!
    [Avatar]

    Joined: 01/13/2006 15:23:41
    Messages: 1239
    Location: Florida
    Offline

    TheDruidXpawX wrote:
    as for disabling tick, in PostNetBeginPlay()

    just Engine.disable('tick'); 

    Actually now that I've gotten the removal of the combo working for both client and server, the code is greatly reduced, and adren usage is back to being done by XGame.Combo's inherited Tick. And it looks like a player's Adren is considered a float anyway. So what I'm guessing was happening wasn't that the adren usage was getting rounded, but that there actually were two combos running at the same time, resulting in double the adren drain.

    Now we only need to figure out if we want to create/use a more expansive combo modifying mod, or just stick with BotBooster.

    I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
    WM: (DC)BotFodder 170
    MM: (DC)BotDoctor 141
    AM: (DC)BotBooster 147
    http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
    Twitter: http://twitter.com/ericdives
    [WWW] aim icon [MSN]
     
    Forum Index -> Druids RPG Development
    Go to: