Frikbots in QW?
Moderator: InsideQC Admins
26 posts
• Page 1 of 2 • 1, 2
Frikbots in QW?
How can I get these nifty little guyz in my QW server.
Problem: When a bot is in the server and a human player connects the server crashes.
I think it has something to do with slots or something?
If there are humans on the server and I add a bot everything works. If a player connects after there are bots, then it crashes.
Any help would be greatly appreciated.
Problem: When a bot is in the server and a human player connects the server crashes.
I think it has something to do with slots or something?
If there are humans on the server and I add a bot everything works. If a player connects after there are bots, then it crashes.
Any help would be greatly appreciated.
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
When a client connects to a QuakeWorld server, the client's player entity is fully cleared. ClientConnect is called a few frames later (ie: not instantly).
This results in frikbot's playerslot links being corrupted (usually an infinite loop).
You can 'fix' it the lame way by regenerating the list every time, instead of simply editing it. This will give small periods where not all players can be targetted by bots.
A more correct way to fix it is to just remove the list entirely, and use nextent or something to walk it instead.
This results in frikbot's playerslot links being corrupted (usually an infinite loop).
You can 'fix' it the lame way by regenerating the list every time, instead of simply editing it. This will give small periods where not all players can be targetted by bots.
A more correct way to fix it is to just remove the list entirely, and use nextent or something to walk it instead.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
redrum wrote:Found a simple fix.
I've been asking bout this for years, surprised nobody came up with this solution.
Anyone interested?
I'd be interested in this. I've been updating Open Quartz 2 with frikbots by default, and adding QW to it would be a blast.
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
-

Chip - Posts: 575
- Joined: Wed Jan 21, 2009 9:12 am
- Location: Dublin, Ireland
So, the problem seemed to be that when a player entered the server that had a bot already in it the server would crash.
Apparently the player was overlapping the bots client slot which would cause the server to crash.
So I thought what if I moved the bots client slot a bit further up the list?
I looked into bot_qw.qc and found float() ClientNextAvailable(), made one small change and wala!
Simple as that!
Now there could be an issue if too many people join the server and a player tries to fill that 9th slot, but so far so good!
Apparently the player was overlapping the bots client slot which would cause the server to crash.
So I thought what if I moved the bots client slot a bit further up the list?
I looked into bot_qw.qc and found float() ClientNextAvailable(), made one small change and wala!
- Code: Select all
float() ClientNextAvailable =
{
local float clientno;
clientno = 0; // I want to do this top down, but QW won't let me - FrikaC
while(clientno < max_clients)
{
clientno = clientno + 8; // changed from 1 to 8, so it adds the bot into the 9th slot (if there's 1 player on server) - Redrum
if(!ClientIsActive(clientno))
return clientno;
}
return -1;
};
Simple as that!
Now there could be an issue if too many people join the server and a player tries to fill that 9th slot, but so far so good!
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
redrum wrote:So, the problem seemed to be that when a player entered the server that had a bot already in it the server would crash.
Apparently the player was overlapping the bots client slot which would cause the server to crash.
So I thought what if I moved the bots client slot a bit further up the list?
I looked into bot_qw.qc and found float() ClientNextAvailable(), made one small change and wala!
- Code: Select all
float() ClientNextAvailable =
{
local float clientno;
clientno = 0; // I want to do this top down, but QW won't let me - FrikaC
while(clientno < max_clients)
{
clientno = clientno + 8; // changed from 1 to 8, so it adds the bot into the 9th slot (if there's 1 player on server) - Redrum
if(!ClientIsActive(clientno))
return clientno;
}
return -1;
};
Simple as that!
Now there could be an issue if too many people join the server and a player tries to fill that 9th slot, but so far so good!
I see 2 problems in your solution:
1) first, you're assuming that bot will always start from a fixed slot (9th). I suspect that if maxplayers changes to less than 16 your code may crash;
2) your checking loop is using an increment by 8 starting from 0, so the check order will be: 8, 16, 24, 32, etc. The correct would be start from N and use an increment by 1.
So, I suggest you to do this way instead:
- Code: Select all
float() ClientNextAvailable =
{
local float clientno;
clientno = max_clients / 2; // now this can change and our code won't fail
while(clientno < max_clients)
{
clientno = clientno + 1; // back to unit increment
if(!ClientIsActive(clientno))
return clientno;
}
return -1;
};
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
maxplayers in quakeworld is 32, always.
maxclients and maxspectators is variable, but there are _always_ 32 slots.
Your bots will still crash if more than 8 people join the server. Or the same one in a join/qportchange/rejoin flood (you can ban them, but they still can consume multiple slots from a single ip).
maxclients and maxspectators is variable, but there are _always_ 32 slots.
Your bots will still crash if more than 8 people join the server. Or the same one in a join/qportchange/rejoin flood (you can ban them, but they still can consume multiple slots from a single ip).
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Spike wrote:When a client connects to a QuakeWorld server, the client's player entity is fully cleared. ClientConnect is called a few frames later (ie: not instantly).
This results in frikbot's playerslot links being corrupted (usually an infinite loop).
You can 'fix' it the lame way by regenerating the list every time, instead of simply editing it. This will give small periods where not all players can be targetted by bots.
A more correct way to fix it is to just remove the list entirely, and use nextent or something to walk it instead.
The Quakeworld version of Frikbot doesn't use the linked list for players. It sets it up yes, but it never walks that list in QuakeWorld. It uses nextent instead.
- FrikaC
- Site Admin
- Posts: 1026
- Joined: Fri Oct 08, 2004 11:19 pm
Also I should mention that it definitely used to work (it was broken in 0.09 and I made a point of fixing it in FBX). So either some subtle bug creeped in before the last release of FrikBot or it's a bug with the QuakeWorld server you are running. Does it outright crash, hang or spit out a QuakeC error?
- FrikaC
- Site Admin
- Posts: 1026
- Joined: Fri Oct 08, 2004 11:19 pm
When it crashed there were bot related errors, don't remember exactly what they were.
So now that I got the little bastards on the server, I'm trying to tweak their fighting skills in bot_weapon_switch().
What does this line of code mean?
The thing is that the bot will sometimes be in your face but he won't pull out the axe and start hacking away, just stands there for an easy kill?
So now that I got the little bastards on the server, I'm trying to tweak their fighting skills in bot_weapon_switch().
What does this line of code mean?
- Code: Select all
it = self.items & 127;
The thing is that the bot will sometimes be in your face but he won't pull out the axe and start hacking away, just stands there for an easy kill?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
26 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest