Project RDX is a mod based on the IDTech3 engine. The goal is to make the game more complex, and balanced between the "ol' school" and "realistic" games.

Report article RSS Feed NPCs development in progress

With MD5 models still somewhat rough yet defined, the next big goal is creating non-player characters --- AI controlled entities crucial to coop and singleplayer modes, with somewhat different mechanics compared to the already present bots.

Posted by Nubstrike on Nov 7th, 2011

Why embark in this messy bunch of work? I've asked myself the same thing a few times. But *drum rolls* The time has come, and the benefits of coding NPCs in have piled up with each day of development, and so did inspiration.

The goal is to make AI-controlled entities different from the bots that we already have, that can be interfaced with script files and/or the map editor.

-Singleplayer campaign
Sounds far-fetched? Maybe, but as always I'll start with small steps. A simple mission or two, on the same wavelength of the tomb tutorial map. Think Sauerbraten, they have some fun singleplayer missions to play alongside multiplayer.

-Cooperation / Zombie mode
This is an even more important reason. Using dumbed-down bots as zombies is both limiting and wasteful.

-The reasons why bots aren't suitable
Many.
1) The bot AI is built with one purpose in mind: emulating a player as well as they can - the default OA bots manage that well enough. That means considerable thinking depth and independence, working in teams, following the goal of every game mode -- which can imply many things other than blowing someone to smithereens. The bot AI is very complex.

All while the singleplayer/Coop AI would need (for the moment) pretty much two things: Following a script (such as patrolling waypoints) and fighting the player(s) and/or other NPCs. That is true for anything from the final boss to the lowliest cannon fodder.
Merging these two things would probably do more harm than good.

2) Even outside of their AI, bots are coded in every respect like players. Again, the core server code that handles clients (players and bots) is pretty arcane and better just left alone. What to send to whom, etc.
Also, even the game mechanics (not the core, the .vm) would need extensive modifications to accomodate that. Just scratching on the surface, the respawn mechanics.
I did experiment a bit on the bots before moving on to understand this.

3) NPCs should be spawned in relatively large numbers, at the beginning, via map layout, or via scripts, and just be removed at the end of a level or when they die. The clients need, again, some complicated pathways for that to happen.

=== Progress ===
Surprisingly, getting them to spawn without crashing was relatively painless.
Models are still behind however:

Mr. Armor Shard firing his invisible gun.

Using the armor shard as a placeholder. You see a NPC relentlessly firing an invisible gun, complete with invisible infinite, magic-reloaded ammo.

Mr. Armor Shard reaps another kill

Yeah. That used to be me. Now they can target you and hit you with surprising (read: too much) accuracy. However, as of now (7 nov) they can't move, except for falling. They're much like turrets.

Movement, AI, and graphics are the next steps.

(9 nov) Adding movement proved disastrous. Despite having "Fatal errors" in the AI, the Angry Armor Shard o' Doom was teleporting around the map mowing me down with its unlimited ammo, impossible to hit and sometimes to see.
(11 nov) Movement somewhat fixed, but still far from done.
(11 nov, 2) Basic movement (A to B) works
(13 nov) Moving on to weapon usage
(14 nov) NPCs now have a target detection algorithm that considers field of view, target distance, target speed and how much in front of them the target is.
(16 nov) NPCs will now pick a weapon taking into account enemy distance, ammo left and preference (similar, but not exactly like bot weights). Strangely head aim is a bit disappointing now. It will stay off for the moment.
(19 nov) Aiming issues fixed, now giving them a model.
(20 nov) Models are working (the headlessness will be addressed soon)
Enough with these armor shards
(20 nov, 2) Hitboxes work. Wow, it's been quick.
(26 nov) They can now hear sounds. On to map scripting (already partially done).

(30 jul) huge break in the news, but it's still going (albeit a bit slowly).
Now the game will load an additional file alongside the map .bsp (e.g. q3dm1.npcdef) that will contain info about any NPCs used in the map - e.g. hit points, model, speed, acceleration, how you'll interact if you use your action key on them, etc. so that in different maps you can have drastically different enemies - currently up to 8 types, but it'd be really trivial to raise that limit should the need arise.

The rest is done via map editor - their weapon, what to do when spawned, waypoints to follow, etc.
What needs to be done is deaths of NPCs "firing their targets", that is, activating something like a button activates a door. So when you've defeated that boss, the exit door will conveniently open by force of plot.

Additional mapping features (keys, multiple switches to open one door, skill level-based events such as more enemies spawning, ...) are a bit lacking and are on their way in. Already made keys in the classic doom style (blue yellow and red).
The keys could also be used in MP team mode, since the two teams could be made to carry the respectively color-coded key by default...

Post comment Comments
pvt.Johnson
pvt.Johnson Nov 7 2011, 11:43pm says:

Looking good so far, keep up the great work!

+1 vote     reply to comment
Nubstrike Author
Nubstrike Nov 11 2011, 2:19pm replied:

Thanks I hope the time spent will be worth it.

The next update is going to be pretty big anyway :D

+1 vote   reply to comment
thewonderboy
thewonderboy Nov 8 2011, 5:43am says:

I like how in "hunt" mod you was able to smash in 300 enemy AI's before the framerate dipped in 3 fps (my processor is either way only 1.9ghz)

And i have seen some pretty neat optimization between How smart and big amounts they were (CS, Z-bot, you was basicly able to put in 50 bots with good framerate but they acted smart)

Curious to see how zombies work in the game :P

+1 vote     reply to comment
Nubstrike Author
Nubstrike Nov 11 2011, 2:19pm replied:

The numbers I'm hoping to get in coop(zombie)/SP mode is more or less 100 at once (although in SP some will be dormant until you find them), without noticeably denting FPS.
Along the way I'll also add some functions to the bots like looking for and using cover.

+1 vote   reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
Quake III Arena Icon
Platforms
Windows, Mac, Linux
Developed By
Nubstrike
Contact
Send Message
Release Date
TBD
Mod Watch
Track this mod
News
Browse
News
Report Abuse
Report article
Related Mods
Project RDX (Quake III Arena)
Project RDX Quake III Arena - Single & Multiplayer First Person Shooter
Related Games
Quake III Arena
Quake III Arena Single & Multiplayer First Person Shooter