Server Help

Bot Questions - p->flash

Anonymous - Mon Aug 30, 2004 10:32 pm
Post subject: p->flash
is there a simple way to have the bot react only when a player warps, and not when the player changes ships or teams or something?
D1st0rt - Mon Aug 30, 2004 11:36 pm
Post subject:
lol, somebody get creative with title editing? or was it like that?
Anonymous - Mon Aug 30, 2004 11:40 pm
Post subject:
what?
CypherJF - Mon Aug 30, 2004 11:47 pm
Post subject:
You'll need a custom plugin, I'd imagine.
Anonymous - Tue Aug 31, 2004 12:13 am
Post subject:
im making one, im just seeing if there's any code tricks to detect if someone flagged p->flash because they were warping, rather than freq switching or ship switching
D1st0rt - Tue Aug 31, 2004 12:26 am
Post subject:
Just check for p->flash whenever you get a position packet
Mr Ekted - Tue Aug 31, 2004 1:31 am
Post subject:
Save their previous ship/freq. When you get p->flash, compare old to current. If they are the same, then it's a warp. You also need to know if they died, so you can differentiate a warp from a spawn.
Dr Brain - Tue Aug 31, 2004 9:55 am
Post subject:
Don't forget about cloak.
Anonymous - Tue Aug 31, 2004 12:05 pm
Post subject:
do any of you know where theres a good tutorial or sample bot dll of how to set up linklists of players in the bot? i guess thats the only way to do it, even though i was trying to avoid it (im not that good at programming yet)
50% Packetloss - Tue Aug 31, 2004 12:58 pm
Post subject:
Most people use catid's linklist class, but creating your own linklist is the best solution and most efficient. But since you dont know how, ill explain the class.

struct Bob
{
int joe;
};

_linkedlist <Bob> BobList;

//to add a node
Bob *NewBob= new Bob;
NewBob->joe=2;
BobList.append(NewBob);

//then to cycle through the list

_listnode <Bob> *parse= BobList.head;
while(parse != NULL)
{
printf("%i\n",parse->item->joe);
parse= parse->next;
}

//to delete a node

_listnode <Bob> *parse= BobList.head;
while(parse != NULL)
{
if(parse->item->joe == 2)
{
BobList.kill(parse);
break;
}
parse= parse->next;
}
Bak - Wed Sep 01, 2004 8:42 pm
Post subject:
50% Packetloss wrote:
creating your own linklist is the best solution and most efficient.


a hash table or a binary search tree is faster lookup than a linked list

an expanding array (vector) uses less space than a linked list
50% Packetloss - Thu Sep 02, 2004 12:48 am
Post subject:
It depends on what you are doing, if you have an unknown number of "items" that you have to keep track of, then linklist might be the best solution. Arrays are fast but not if you have to keep allocating/deallocating memory to fit everything in it. We are talking about a PC, a bot using a linklist isnt exactly going to take up cpu cycles unless you are managing a huge amount of data. Huge amounts of data should be handled efficiently by mysql or something, you cant have a lot of data taking up memory.
Cyan~Fire - Thu Sep 02, 2004 6:19 am
Post subject:
Vectors take longer appending data and linkedlists take longer accessing data. So basically, you should almost always use vectors unless you're constantly adding/deleting objects.
CypherJF - Thu Sep 02, 2004 10:06 am
Post subject:
Shrug, for bot's, I just use w/e works... :-p
Bak - Fri Sep 03, 2004 1:31 pm
Post subject:
vectors shouldn't take longer appending data on average.
Cyan~Fire - Fri Sep 03, 2004 2:17 pm
Post subject:
Why not? With a vector, even when you have extra allocated space, you're still going to have to reallocate and copy some later. With a linkedlist, you just keep on appending items or changing some pointers to insert.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group