Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Counting turf flags possessed by frequency

 
Post new topic   Reply to topic Printable version
 View previous topic  Request Post :: Post How would I do this?...  View next topic  
Author Message
SamHughes
Server Help Squatter


Joined: Jun 30 2004
Posts: 251
Location: Greenwich
Offline

PostPosted: Mon Jan 31, 2005 1:58 am    Post subject: Counting turf flags possessed by frequency Reply to topic Reply with quote

I am making a MERVbot plugin to use in place of the base wars plugin. How should I detect if a team possesses all of the turf flags?

I have considered three options:

1. Every time there's an EVENT_Tick, iterate through the flag list, comparing each flag's team with the team of list's first flag. Once we find one that doesn't match, we stop. If all have the same team, then that team possesses all the turf flags.

2. The same, but on EVENT_FlagGrab, instead.

3. Store a map of frequencies and how many flags each possesses, and update the map every EVENT_FlagGrab.

I have abandoned the third option, since it requires storing which team _used_ to own each flag.

So that leaves the first two options. I will now ask my real question: Is EVENT_FlagGrab reliable? Is there any chance of missing a touching of a flag, due to lost packets or phases of the sun, moon, and/or space station? For if the bot missed the touching of the team's final flag, it would not notice that team's victory, should I choose option two.

Which do you recommend?
Back to top
View users profile Send private message Add User to Ignore List
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Mon Jan 31, 2005 4:37 am    Post subject: Reply to topic Reply with quote

There is a packet just for turf flags. I don't know how merv handles it.

If you've noticed EVENT_FlagGrab getting signalled lots of times in a short space of time then merv may be turning the turf packet into individual flag grab events. This is unlikely though.

What is more likely is merv already stores the flag states and calls the flag grab event if a owner changes after a flag pickup or turf packet.

If it doesn't do either of those I would make it count the flags every 5 seconds.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Guest



Offline

PostPosted: Mon Jan 31, 2005 9:56 am    Post subject: Reply to topic Reply with quote

Quote:
Is EVENT_FlagGrab reliable?


Yes. And if it weren't, your other options wouldn't work either.

Code: Show/Hide

case EVENT_FlagGrab:
{
   Player *p = (Player*)event.p[0];
   Flag *f = (Flag*)event.p[1];
   
        int team = f->team;
        bool victory = true;

        _listnode <Flag> *parse = flaglist->head;
   
        while (parse)
        {
            Flag *g= parse->item;
   
            if (g->team != team)
            {
                       victory = false;
                        break;
            }
   
                 parse = parse->next;
         }

          if (victory)
          {
            // team possesses all of the turf flags
          }
}
Back to top
SamHughes
Server Help Squatter


Joined: Jun 30 2004
Posts: 251
Location: Greenwich
Offline

PostPosted: Mon Jan 31, 2005 12:22 pm    Post subject: Reply to topic Reply with quote

Thank you for your answers.
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can 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 can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 146 page(s) served in previous 5 minutes.

phpBB Created this page in 0.471117 seconds : 29 queries executed (94.3%): GZIP compression disabled