Bot bug
Moderator: InsideQC Admins
5 posts
• Page 1 of 1
Bot bug
Hello there.
I have a little problem with my bots... I've tried to make them get client entity instead of spawn() to display colors in GLQuake. And when I spawn the bot with client entity, I see trough the bot's eyes, and when I jump or fire, The bot is controlled by me and I guess that my true body disappears from the map.
If you want the bot's spawn code to get an idea, please tell me and I'll post here.
Thx...
I have a little problem with my bots... I've tried to make them get client entity instead of spawn() to display colors in GLQuake. And when I spawn the bot with client entity, I see trough the bot's eyes, and when I jump or fire, The bot is controlled by me and I guess that my true body disappears from the map.
If you want the bot's spawn code to get an idea, please tell me and I'll post here.
Thx...
-

Orion - Posts: 476
- Joined: Fri Jan 12, 2007 6:32 pm
- Location: Brazil
Hey, the bug is another now...
I've tried to fix myself and now the bot don't think, don't move, nor cycle trough frames. E. g. when it dies, it keeps in the first death frame. Here's the bot's spawning code:
I've tried to fix myself and now the bot don't think, don't move, nor cycle trough frames. E. g. when it dies, it keeps in the first death frame. Here's the bot's spawning code:
- Code: Select all
void() PutBotInServer =
{
local entity bot, spot, save;
local float i, cno;
if (bot_spawner)
remove(bot_spawner);
cno = clientNextAvailable();
bot = getClientEntity(cno);
bot.fClientNo = cno;
BotConnect (bot);
if (!bot.fClientNo)
remove(bot);
// bot = spawn ();
if (!deathmatch)
spot = SelectCoopSpawnPoint ();
else if (deathmatch == 10)
spot = SelectTeamSpawnPoint (self.team_no);
else
spot = SelectSpawnPoint ();
p_count = p_count + 1;
bot.classname = "bot";
bot.health = 100;
bot.takedamage = DAMAGE_AIM;
bot.movetype = MOVETYPE_WALK;
bot.solid = SOLID_SLIDEBOX;
bot.max_health = 100;
bot.air_finished = time + 12;
bot.dmg = 2; // initial water damage
bot.super_damage_finished = 0;
bot.radsuit_finished = 0;
bot.invisible_finished = 0;
bot.invincible_finished = 0;
bot.effects = 0;
bot.invincible_time = 0;
bot.yaw_speed = 50;
bot.button0 = 90;
bot.button1 = 12;
bot.fSkill = floor(random()*4);
bot.enemy = world;
bot.temp_cells = 0;
bot.turns = 0;
bot.nextframe_time = time;
if (random() < 0.5)
bot.rl_pref = 1;
else
bot.rl_pref = 0;
if (random() < 0.5)
bot.lg_pref = 1;
else
bot.lg_pref = 0;
if (bot.rl_pref)
bot.lg_pref = 0;
if (bot.lg_pref)
bot.rl_pref = 0;
bot.items = IT_SHOTGUN | IT_AXE | IT_NONKILLY;
bot.ammo_shells = 25;
bot.weapon = IT_SHOTGUN;
bot.attack_finished = time + 0.3;
bot.th_pain = bot_pain;
bot.th_die = BotDie;
if (deathmatch == 10)
{
i = floor(random()*3);
if (i == 0)
{
bot.armortype = 0.3;
bot.armorvalue = 50;
bot.items = bot.items | IT_ARMOR1;
}
if (i == 1)
{
bot.armortype = 0.6;
bot.armorvalue = 75;
bot.items = bot.items | IT_ARMOR2;
}
if (i == 2)
{
bot.armortype = 0.8;
bot.armorvalue = 100;
bot.items = self.items | IT_ARMOR3;
}
}
bot.deadflag = DEAD_NO;
bot.deathframe = 0;
bot.netname = BotSetName ();
msgUpdateNameToAll (bot.fClientNo, bot.netname);
if (deathmatch == 10 || deathmatch == 11)
bot.team_no = self.team_no;
bot.origin = bot.oldorigin = spot.origin + '0 0 1';
bot.angles = spot.angles;
bot.ideal_yaw = bot.angles * '0 1 0';
bot.ideal_pitch = bot.angles * '1 0 0';
bot.nextthink = time;
bot.think = BotThink;
bot.pausetime = time + 0.1 + random()*0.5;
// oh, this is a hack!
setmodel (bot, "progs/eyes.mdl");
modelindex_eyes = bot.modelindex;
setmodel (bot, "progs/player.mdl");
modelindex_player = bot.modelindex;
setsize (bot, VEC_HULL_MIN, VEC_HULL_MAX);
save = self;
self = bot;
bot_stand1 ();
self = save;
makevectors(bot.angles);
spawn_tfog (bot.origin + v_forward*20);
spawn_tdeath (bot.origin, bot);
if (deathmatch == 4)
{
bot.ammo_shells = 255;
bot.ammo_nails = 255;
bot.ammo_rockets = 255;
bot.ammo_cells = 255;
bot.items = IT_SHOTGUN | IT_SUPER_SHOTGUN | IT_NAILGUN | IT_SUPER_NAILGUN | IT_GRENADE_LAUNCHER
| IT_ROCKET_LAUNCHER | IT_LIGHTNING | IT_AXE;
bot.items = bot.items | IT_ARMOR3;
bot.armorvalue = 200;
bot.armortype = 0.8;
bot.health = 250;
bot.items = bot.items | IT_INVULNERABILITY;
bot.invincible_time = 1;
bot.invincible_finished = time + 3;
}
if (deathmatch == 11 && !match_begun)
{
bot.ammo_shells = 255;
bot.ammo_nails = 255;
bot.ammo_rockets = 255;
bot.ammo_cells = 255;
bot.items = IT_SHOTGUN | IT_SUPER_SHOTGUN | IT_NAILGUN | IT_SUPER_NAILGUN | IT_GRENADE_LAUNCHER
| IT_ROCKET_LAUNCHER | IT_LIGHTNING | IT_AXE | IT_NONKILLY;
bot.health = 1000;
bot.items = bot.items | IT_INVULNERABILITY;
bot.invincible_time = 1;
bot.invincible_finished = 999999;
}
if (deathmatch == 11 && match_begun)
{
bot.armortype = 0.8;
bot.armorvalue = 200;
bot.items = bot.items | IT_ARMOR3;
bot.skin = 3;
}
save = self;
self = bot;
W_BotSetCurrentAmmo ();
BotSay (": -d\n");
self = save;
bot.talk_subject = 4;
bot.talk_time = time + 3;
if (deathmatch == 12)
{
bot.frags = 5;
msgUpdateFragsToAll (bot.fClientNo, bot.frags);
}
};
-

Orion - Posts: 476
- Joined: Fri Jan 12, 2007 6:32 pm
- Location: Brazil
Your first problem, as you probably figured out, is you were using your (the player) entity for the bot and not properly marking entities being used by real players when in use.
Your second problem I covered in the FBX dissection and on QIP -- unconnected clients have no physics run on them, that means, .think for the entity is never called, and they don't move. Simply put, you can use a client entity to represent the bot, but you can't use it AS the bot, unless you completely emulate the physics (as FBX does).
Your second problem I covered in the FBX dissection and on QIP -- unconnected clients have no physics run on them, that means, .think for the entity is never called, and they don't move. Simply put, you can use a client entity to represent the bot, but you can't use it AS the bot, unless you completely emulate the physics (as FBX does).
- FrikaC
- Site Admin
- Posts: 1026
- Joined: Fri Oct 08, 2004 11:19 pm
Because the shirt/pants color thing was more or less a feature of the renderer in software quake: it could dynamically recolor the shirt/pants palette colors as it drew to the screen.
Under GLQuake, all the graphics need to be upsampled to 32 bit images and cannot simply be recolored on render, as the textures need to be uploaded to their final state to the video card. As a hack, one texture (a version of the player.mdl skin) is uploaded to the video card for each client on the server. That alone is not much of a problem - except for the fact it prevents recoloring of other models if, for example, the player can morph - the major problem arises that whoever programmed this system neglected to even look at the colormap value. Rather than referencing the colormap to assign the appropriate texture for each client, it instead uses their entity number directly to find that client's texture. This breaks the primary use of colormap, namely showing the correct colors on dead bodies and further prevents us bot coders from using it to display the correct client colors on our bots. This is why this 'feature' is listed on QIP.
Under GLQuake, all the graphics need to be upsampled to 32 bit images and cannot simply be recolored on render, as the textures need to be uploaded to their final state to the video card. As a hack, one texture (a version of the player.mdl skin) is uploaded to the video card for each client on the server. That alone is not much of a problem - except for the fact it prevents recoloring of other models if, for example, the player can morph - the major problem arises that whoever programmed this system neglected to even look at the colormap value. Rather than referencing the colormap to assign the appropriate texture for each client, it instead uses their entity number directly to find that client's texture. This breaks the primary use of colormap, namely showing the correct colors on dead bodies and further prevents us bot coders from using it to display the correct client colors on our bots. This is why this 'feature' is listed on QIP.
- FrikaC
- Site Admin
- Posts: 1026
- Joined: Fri Oct 08, 2004 11:19 pm
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest