Server Help

Bot Questions - Recreating the MusicLock bot, but there is a error

50% Packetloss - Sun Nov 23, 2003 2:55 pm
Post subject: Recreating the MusicLock bot, but there is a error
Ive looked over my source and I just cant see the error. It works just fine when its just me and another player, but i tested it in a zone with a huge population and it messes up somewhere. It starts locking freq when anyone picks up a flag. It works fine for a while but then someone does something that messes it up, havent found out what yet. Could be a confict with another plugin on that zone's bot.

Explaination of how it works. Instead of guessing the total number of flags like MusicLock bot, it has a file were somone specifies the number. Every time a person picks up a flag, it calculates the number of flags they own on the flaglist and the total number of flags thier team members are carring. Once they reach the total number of flags, it records thier names. If anyone changes ships/leaves/specs and they have flags, the freq is unlocked becuase of nuet. If a player kill another player with flags, the freq is unlocked if its winning and the bot runs Event_FlagGrab for the killer.

Any help you can provide is greatly appritiated. Source code attached
Cyan~Fire - Mon Nov 24, 2003 6:10 pm
Post subject:
I'm thinking it would be a lot easier to make a separate linkedlist of Player structs, instead of making a new Flagger struct. This would allow you to eliminate GetPlayer() and simplify many other operations you perform. As linkedlists are only pointers, this actually would (I think) take up less memory. You can also use flaglist->total instead of making a new variable for it. Also, it seems a little more reliable to me to use the flaglist for GetFlagCount() instead of playerlist:
Code: Show/Hide
Uint16 botInfo::GetFlagCount(Uint16 Freq)
{
   int count = 0;
   for(_listnode <Flag> *parse = flaglist->head; parse; parse=parse->next)
   {
      if (parse->item->team == Freq)
         count++;
   }
   return count;
}


Try making these modifications, and you might find your problem easier to track down.
50% Packetloss - Mon Nov 24, 2003 6:41 pm
Post subject:
the Flagger struct i made only includes the name of the player, char[20]. But in a Player struct, it has more than 40 different variables. So in memory spaced, the smaller struct would be more efficient and smaller. CMPSTR() function is much faster for just comparing names than comparing 2 entire Player structs.
flaglist->total does get the total number of flags on there, but it also has UNASSINED(0xFFFF) variables on there for flags that were nueted or havent been picked up. So the only way to do it is to increment a variable for the flaglist. Although a bool might work in there, so the bool will be false if the team doesnt own the entire flaglist but if they do, it will add flaglist->total to the total number of flags they have. Although it may be quicker, i would be using one more variable and there is still that bug i havent found icon_sad.gif
50% Packetloss - Mon Nov 24, 2003 6:43 pm
Post subject:
Quote:
Try making these modifications, and you might find your problem easier to track down.

yah, lol, a function there would probably make it easier to look at
Cyan~Fire - Mon Nov 24, 2003 7:39 pm
Post subject:
Cyan~Fire wrote:
linkedlists are only pointers
So, it would actually take less memory.
I'm not just making up this method without trying it. I use something like it in my capital plugin. If you just use a standard == operator, it will be comparing two pointers which will point to the same memory address if they are equal. It's cool how it works out icon_razz.gif

About the flaglist. Even if a flag is UNASSIGNED in the list, the total should still show it. I don't think the flag entries are actually killed when it is neuted.
The reason I suggested this is not only for simplicity but because of the fact that flag numbers can be random. I haven't thoroughly looked at your code, so I don't know if you accounted for this.

I'm attaching a spawn.h and spawn.cpp with my modifications. I haven't tested them, so they're just to demonstrate what I mean and to implement only if you think it's ok. icon_razz.gif

Ahh, and just wondering: why did you name your project default??
50% Packetloss - Mon Nov 24, 2003 9:29 pm
Post subject:
lol, i dont know how to change the name of the dll that VC++ pumps out, never really cared. I can just change it anyway.
50% Packetloss - Mon Nov 24, 2003 9:38 pm
Post subject:
oh yah, that pointer thing you said makes sence, ill start using that
Cyan~Fire - Tue Nov 25, 2003 5:33 pm
Post subject:
Oh, and also if you use the Player linkedlist, you can just take out the method DelPlayer() and use "FlaggerList.kill(p)" instead, since it doesn't have to search for the name.
Cyan~Fire - Tue Nov 25, 2003 6:18 pm
Post subject:
Here's a new version of all three files. I figured out more ways with already-existing linkedlist functions to simplify.

Sorry if I'm "taking your job" but I find playing with others' code very fun icon_razz.gif
SideBurn - Tue Nov 25, 2003 7:56 pm
Post subject:
well i figured summut major wrong about this plugin, like it locks a freq if they got all flags, but if u on a private freq it actually says in arena the freq, so then after that freq is unlocked, every1 knows ur freq, unless this bug has been sorted since i last seen it in action
50% Packetloss - Tue Nov 25, 2003 8:19 pm
Post subject:
your talking about catid's musiclock bot. I have a fixed version of that bot if you want it. Just fixed it from telling the priv freq and added some small useful stuff for sysops to it
50% Packetloss - Tue Nov 25, 2003 8:33 pm
Post subject:
Because your dead sexy cyan, you can try out my rampage plugin.
Cyan~Fire - Wed Nov 26, 2003 11:49 am
Post subject:
OK, I'll sexily take a look. icon_razz.gif

Did my modifications work out right?
Cyan~Fire - Wed Nov 26, 2003 2:06 pm
Post subject:
About the rampage: Catid's way of doing his rampage bot is much easier. Instead of creating a new playerlist, all you do is make a player tag for each player with their kills.

I'm guessing your major improvement on this would be adding in a lot more detail per rampage message. I'm attaching my mod of Catid's rampage that does sounds, I think it would be easier to modify that, instead.
50% Packetloss - Wed Nov 26, 2003 4:47 pm
Post subject:
Player tags are the same thing as what i was doing. Instead of making your own struct you're using the existing taglist to do the same work. Which works just as good.
I wanted the recipiant of the bot to be able to use any amount of kills for the killing spree, to be able to edit the messages any way they wanted, be able to prize people, and be able to ignore bots(added in the one that will be on catid's website). Although it is easier to set up catid's rampage.ini, the extra additions in my plugin may come in handy to some zone sysops.

Oh yah, your
if (kills % 3 != 0 && kills <= 30)
{
kills /= 3;
//ect.....

was pretty smart, lol, very sexy

Have a happy thanksgiving (that is if you live in the US)
Cyan~Fire - Wed Nov 26, 2003 9:52 pm
Post subject:
Lol ya I do, thanks, you too.

I suggested PlayerTags because they already have been set up by Catid. I just think they'd be a bit easier to work with.

And I wasn't suggesting not using any of your improvements, just saying build on the Catid system instead of writing your own.

Lol and yes, my code is awesomely sexy. icon_wink.gif
D1st0rt - Thu Dec 04, 2003 2:38 pm
Post subject:
in VC++.net, you go to Project>Properties and theres a place where you specify the output file
Cyan~Fire - Thu Dec 04, 2003 4:20 pm
Post subject:
Actually, what I do is just copy deafult's source to a new folder and create a new project myself. I find it a bit cleaner.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group