News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

Doom 3 AI from scratch

Started by motorsep, May 18, 2015, 10:37:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

motorsep

So far I had no luck finding any AI programmer who would even wanted to look at Doom 3 (mostly a principle of things - it's not Unity, I am not touching it) :(

Therefore I wonder if we should do a community project - writing Doom 3 AI scripts from scratch. This way whoever is interested in the subject matter would help shaping this "course".

I won't be GPL, BielBdeLuna, sorry :)

Basically the first step would be to identify core structure of AI scripts (like all AI starts with ::init() following by ::Begin() ), mandatory built-in functions and order of calls, and making a template script for AI. It would probably make a lot of sense to not separate  enemy AI and NPC AI. This would allow for enemy to become NPC and vice versa.

Next step would be spawning a basic entity and have it do basic action. For example spawn AI that idles and looks/turns at/to player, when player is in a certain radius around AI.

What do you think ?

BielBdeLuna

do you mean you will make your AI completely free? why not GPL?
I agree on not separating the AI from NPC and enemies as it should be the right direction ,so NPC can become enemies

this way you could do factions, and those change sides with the Avatar
we should introduce a way to add lists for AI's ( via a c++ function maybe?)

maybe you could load the combat function only when antagonising with other NPCs or the Avatar? so the AI load is smaller when not antagonized? it could be great to upload and download versions of a certain state, so the AI load could be more flexible

motorsep

Free, but not GPL. Just need to find a decent license that can be used commercially and proprietary, if people would like to do so.

I don't really want to screw around with C++ code, and I don't have any plans about going crazy with AI :) I simply want to learn AI scripting for idTech 4, and provide a solid foundation for anyone who wants to use idTech 4 for their commercial projects. This way people can just use what we make and not worry about Doom 3 EULA.

With the way original AI scripts are written it's hard to add anything beyond what Doom 3 has and the behavior of AI is abysmal. New AI should be designed in a way to allow accommodating new enemy types that aren't 2-legged or 4-legged monsters.

And I really want to assert that it should be implemented step-by-step, with documentation. Not "oh, maybe we can make self aware AI that populates truly living world" :) This kind of stuff is outside of the scope of this community project.

Actually, this AI won't power any of the Doom 3 enemies or NPCs. I think that would fall under Doom 3 mod and will have to be covered by EULA. That's why it can only cover a new entities, not Doom 3 enemies (I am sure new entities can have same functionality as Doom 3 monsters).

BielBdeLuna

what about LGPL, but don't worry about it, if you do it free, I can make a copy and keep it in my repository in Github licensed as GPL so we can all benefit form it, at least my copy will be safe from proprietary hands.  :P

I have a whole AI in a single file entity that I did when investigating the AI(a ball projectile that creates a enemy entity, sort of like the phantoms of the hexen's Wraithverge projectile)

it all works around a combat state that gets initiated in the begin state

all attacks and movements go back to the combat state which decides what to do, and all other functions are elaborated checks for the combat state

on the legs thing, we cannot do lists, so we cannot treat the legs as separate objects (if we could we could check the amount of elements of the lists and automatize the AI depending on that amount) and have  NPCs gain limbs in their lifetime (The Thing anyone?)  :)

I have an idea for an implementation (the idea but I haven't gone yet to the lengths of implementing it all) to give the AI an attitude (at least on the combat side) where the NPC is given some pre-accorded spawnargs that the scripting uses to "show" the attitude within combat, are those NPCs knowledgeable weapons-wise? are they easily scared? are they sloppy? this should effect the way the AI reloads their weapon, and the pauses they should do between actions, and if they are military grade  combatants or street wise gang members, so the same 3D models could act very different because the script that governs their animations makes different decisions given those spawnargs.

and in my GPL AI thread I'm implementing the vector stuff on the movement side of things (but now I'm working on the IdTech python API for the Blender IdTech mapper and I've not touched the code for a while now) it will give the movement a somewhat finer control, specially with third person Avatar games, and specially along gamepad gameplay. it should allow a freer movement and different control schemes to even change during gameplay. (but for me it comes first the Blender stuff)

there is also the idea of the hookl that I was playing around when I was thinking on implementing objects in idTech scripts (but objects in the script system doesn't exists, at least that I know, so if someone wants to "attack" me... go ahead!) so I resorted to create new entities
the idea was to implement some entity that saves the "hooked" enemies in it's spawnarg variables (somewhat how the quake4 implements the tetranode repair bots but make it all script controlled) and so this hooks represented clusters of enemies, so another active entity that is a sidekick of the player could attract those clustered enemies, and have the player dictate orders to that sidekick (which I planed to be a dog) so the idea was that the hook steered the hooked enemies sort like a cooperative hive, the hook could have a direction, that would influence the AI of those hooked NPCs either by steering their direction of movement but also dictating the general actions to the whole group, do they have to run? do they have to attack a specified entity?
all this pretty hard to implement on a list-less scripting language but should be doable.


Radegast

Yea, Modwiki could use a section about AI life cycle and a lot of code snippets dealing with the basic NPC stuff.

I am too afraid to complete the main storyline in Doom by myself alone, so I am programming an AI buddy to help me fight the demons. Currently, he is mentally challenged so only thing he knows how to do is to follow me and stop when I tell him to.

BielBdeLuna

interesting, you used the alphalabs2 scientist code as an example? 

Radegast

No, I originally got the idea from Allied Marine Squadmates mod which does exactly what I am working on, but I wanted to do it myself to learn from the experience. I am simultaneously writing a simple tutorial on this subject for beginners like me, which I am going to post on this forum when I am done.

The AI is quite simplistic in Doom 3, but I think there is a potential to improve it even without touching C++. It's already possible to teach AI how to retreat, find cover, react to sound, visibility and damage. It's all we need for semi-intelligent bots.

Btw, I am looking forward to see results from your work on Blender->Doom project.

BielBdeLuna

a cover system for the bots would be great! I've not been able to come out with a way to implement it so I'm eager to see that tutorial! :)