Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
printz

Have single player or cooperative bots been attempted?

Recommended Posts

I'm curious if anyone has seriously programmed Doom bots for solving levels in single player or cooperative (player vs environment) mode. If so, can these bots win, or do they just mill around aimlessly? If they exist, can they still be tried?

I tried looking for 'bot' in the Doom wikia, but it showed nothing.

Share this post


Link to post

There's this. I think the first post in that thread is a bit outdated, but I have no idea if the project is still being worked on - if so it's probably on another thread or on another forum.

Share this post


Link to post

I'm pretty sure one port has an "add bot" button you can programme. Intended for multiplayer, no doubt, but I pressed it in SP just to see what would happen. They spawned from the starting point and ran around the level with pistols getting killed a lot. However when I started the next level the game somehow "thought" I was in "multiplayer" and started spawning the MP-only items... which made it a great deal easier. Especially because the bots didn't pick anything up and got killed about 3-4 times while trying to kill an Imp.

Can't remember what port it was though.

Share this post


Link to post
Guest
deathbringer said:

... They spawned from the starting point and ran around the level with pistols getting killed a lot ... didn't pick anything up and got killed about 3-4 times while trying to kill an Imp.



Heh. I don't think these were bots at all.

They sound more like some of the actual people I have played coop with.

Share this post


Link to post

I'm especially interested in single-player bots, that is bots who take over player's control and you can see through their viewport, status bar and so on.

Share this post


Link to post
stewboy said:

There's this. I think the first post in that thread is a bit outdated, but I have no idea if the project is still being worked on - if so it's probably on another thread or on another forum.


I tried that Cooperative Marines mod. It's really intended just for Survival maps, not standard Co-op. The bots don't seem to be well-suited for navigating maps that aren't simple, small arenas. They also can only use whatever weapon they're spawned with, and have unlimited ammo. They also can wander through certain "monster pass-through" barriers that would normally block human players. Still, they work fairly well, all those things considered.

Sadly, no one seems very interested in crafting Co-op bots. The only ones I remember were the old ZCajun bots, and they were pretty stupid. They'd mostly just encircle you and strafe around and plink at things with pistols until they inevitably got offed. They'd also try to avoid hazards, so if you crossed a sludge pit, you could wave bye-bye to them, because they wouldn't follow.

Share this post


Link to post
printz said:

I'm especially interested in single-player bots, that is bots who take over player's control and you can see through their viewport, status bar and so on.


I once tried using ACS to make a couple of scripted marines that would go around to different objectives. You really have to take care though about pathways because if you're not they can get stuck easily.

So I would try that. I think SetGoal was the basic command to make them walk toward a map spot. You can set it so they would attack monsters but keep pursuing the spot. It worked reasonably well.

NINJA EDIT: At the time I did this, they moved very slowly like monsters. I beefed up their speed to be about the same as player walking, but then they noticeably jumped between each step. Now I think there's a decorate flag or something that makes a monster move more like a player (using the movement from hexen's mini bosses, I think). This might allow you to make them move more realistically.

Share this post


Link to post
robot264 said:

would be cool to have bots when you have no internet.

Skulltag has bots.

Share this post


Link to post

You can install Zdoom and download v1.22 and get the bots.cfg file from that to put with your Zdoom installation and then you can type addbot to add bots in SP. but they are pretty dumb though.

They are always getting stuck on corners, but the zcajun bots are better than nothing. Spawning them in a slaughter map is heaps of fun, especially when they are fighting a Cyber with the fist... Or blowing themselves up with the rocket launcher. Priceless fun.

Share this post


Link to post
Doomsfall said:

Skulltag has bots.



oh i never realized Skulltag had bots. (i tried out Skulltag awhile ago)

Share this post


Link to post
robot264 said:

oh i never realized Skulltag had bots. (i tried out Skulltag awhile ago)


yeah but the bots arent suited for coop they will just walk around aimlessly however they perform pretty decent in deathmatch if they can find a weapon that is.

Share this post


Link to post

Pardon for the bump, but now I'm interested in studying one of the already made Doom bots. Which of them comes with a source code? I'd probably look into ZCajun, and maybe consider porting it to Eternity or even vanilla Doom, to allow demo-recording. Where can I find the latest (most advanced) ZCajun code? Or if not ZCajun, something else might work too, as long as it's a truly automated player and not just a glorified monster. I'm not too confident if it's Doom Legacy, though.

Share this post


Link to post

I suspect that what printz secretly wishes for is a bot that can actually handle stuff like finding keys, working out puzzles and understand cause-effect dependencies just as well as a real player.

The short answer is that no, such a bot does not exist, and it would be a daunting task worthy of a full PhD, as it would be nothing short of a full robotic AI undertaking (don't confuse the real type of AI with the simple attracted-to-target pathfinding that simple monsters have). Most bots just behave like friendly monsters that stick around you (if they are allies), or like enemies with enhanced mobility and a trick or two up their sleeves.

Sure, you could make a bot that is attracted to the "exit" switch just like monsters are attracted to their targets (or the player, by default), opening doors and attacking any hostiles that they saw directly in front of them. Such a bot could plausibly navigate through something like E1M1 or another simple map (even though E1M1 has a lot of potentially time-wasting traps like windows, alcoves etc.). That's as sophisticated a bot as you're likely to see, unless someone has been hired to do just that or undertakes it as a PhD or somesuch.

For anything more complex, just picture this scenario: the moment a bot would encounter a locked door, it would be faced with the first "intelligence" problem, as well as a dilemma: just like a real player, should it just roam the level and visually look for a key/switch/linedef that might open it, or should it "cheat" and simply use internal engine info e.g. look for the key's map object or head for the switch/linedef that activates the door based on tagselinedef/sector tag?

Either way, other sub-goals may pop in the middle (e.g. to find the red key, it may have to find a switch that opens another door, so it needs to put the primary quest aside temporarily and focus on another etc). You could think of it as a highly specialized "rat in the maze" problem, where the "rat" is customized to deal with the quirks of a particular environment (Doom levels).

The bot could have some preconceptions built-in (e.g. avoiding damaging floors, avoiding falling into pits too deep to be able to get out...although there are a few pits where you MUST fall into, since you know a-priori that there's a switch that can raise them or a non-pathfinding ways to get out such as an switchable elevator or a teleporter, so more complex checks must be done).

In any case, even if you build the best bot ever that "plays by the rules" alone with no way of learning to take shortcuts or taking certain risks (which would bring in ANNs or genetic algorithms into the equation...ugh), it will still be too literal and stiff in applying them, and is unlikely to ever surpass a skilled player, just like an automatic transmission can't beat a skilled stick.

OTOH, a bot could have some advantages vs a human player depending on whether e.g. you allow it to have instant at-will SR-50 movement, instant rotations towards a target, allow it to know what triggers what and so spend no time humping walls, whether it has "absolute targetting" just like monsters (no LOS/autoaim checks) so it can aim perfectly regardless of visual resolution or darkness etc.

It could also be allowed to "preprocess" a map and optimize certain paths e.g. go for keys before actually bumping into their locked doors, or detect shortcuts that allow skipping them altogether. Another thing would be to teach it to optimize weapon usage or exploit infighting it could e.g. be given superhuman dodging skills or a MK Walker behavior allowing it to close in, dodge and tyson monsters to death without as much as a scratch.

With all the above considered, it's no wonder that enemies/opponents/adversaries/agents/NPCs in most video games DON'T play by the same rules as the player: it would be too hard to do so, and it would be near impossible to make them any fun to play with. Case in point: the bots in BF 1942: they simply can't deal with certain trickery that real players can pull, and are horrible defenders (though they can snipe from incredible distances with ANY weapon).

Instead, most games have NPCs that behave somewhat close to players but are allowed simplifications (e.g. to simulate a "competitive" AI in a RTS game, just allow it to outright cheat by building instantly and having infinite resources: after all, that's exactly the impression a skilled human player will give to a less skilled opponent).

Share this post


Link to post

Thanks for the detailed reply, Maes.

Maes said:

For anything more complex[/b], just picture this scenario: the moment a bot would encounter a locked door, it would be faced with the first "intelligence" problem, as well as a dilemma: just like a real player, should it just roam the level and visually look for a key/switch/linedef that might open it, or should it "cheat" and simply use internal engine info e.g. look for the key's map object or head for the switch/linedef that activates the door based on tagselinedef/sector tag?

I'd rather have him "cheat" (know the entirety of the level, where all living mobjs are, and even predict P_Random results), than attempt to make him human. Technically it's not cheating if it can be played back properly in LMP files.

Can BSP nodes (and their components, such as subsectors) make feasible navigational maps for the bots?

I had started the project from scratch but I realize I shouldn't risk reinventing the wheel, that's why I think it would be better to look on source codes. The /doombot link within Doomworld.com is dead.

Share this post


Link to post

It would be so goddamn jaw-droppingly sweet if someone actually went through with this and made a bot so clever it could solve SP levels. Alas.

Share this post


Link to post
printz said:

Can BSP nodes (and their components, such as subsectors) make feasible navigational maps for the bots?


In theory, you should be able to construct a viable navigational path from sectors alone (finding which sector touches another sector, and building a chain "go to A, then go to B, then go to C" etc.). It should be a generic directed graph path finding problem (with a few gotchas such as dummy sectors). The BSP information is more fool proof to such tricky situations, but harder to interpret.

In any case, bot programming is reasonably easy only up to the point of using purely deterministic/mechanical methods and no more than a single objective at a time, just like a slightly enhanced monster. Beyond that, it's a full research field.

Share this post


Link to post

Pretty much impossible, unless the levels are exceedingly simple or they contain a lot of bot-specific hand-holding (path nodes, scripted objectives, etc.) which kinda requires for a bot and its "mapping interface" to have been developed before the map was made. (Unless you use an approach similar to GL nodes or SECTINFO I guess.)

Share this post


Link to post

In some older racing games, when you completed a lap, a hologram version of you car will also be on the track mimicking everything you did on the previous lap. I always thought it would be cool to have something like that in Doom. Of course everything would go out of sync depending on who wakes up which monsters first.

I don't know anything about coding but it would be cool to make bots follow like a set of way points that can be interrupted when encountering monsters.

Share this post


Link to post
Maes said:

In theory, you should be able to construct a viable navigational path from sectors alone (finding which sector touches another sector, and building a chain "go to A, then go to B, then go to C" etc.). It should be a generic directed graph path finding problem (with a few gotchas such as dummy sectors). The BSP information is more fool proof to such tricky situations, but harder to interpret.

Only problem is that not all walls in Doom are created from simple linedefs. There are also player-impassable gaps surrounded by walls or by static things. Maybe such gaps between walls can be deduced from subsectors and vertices, but for detecting static things I think I'll need more than that (build the equivalent of impassable 2s linedefs where the things are, and go from there)...

Share this post


Link to post

For pathfinding you might be able to use a modified A* search algorithm, using SEGS as your nodes. First a simple level, letting the bot know where the exit is in advance and the exact layout of the level, then use the A* routine to figure out the direct path to the exit. If that works, next step is not to tell it where to go but make it explore SEGS on its own. Any SEGS in LOS is considered 'known'. Any objective encountered (a locked door, a key location) becomes a target to reach, using the known SEGS. If no path found, the bot explores more unknown SEGS until it can connect a path.

Share this post


Link to post

The only problem I can forsee with an algorithmic approach is how unnatural the behaviour would appear to an outside observer - particularly when the bots would be confronted with multiple choices and their choices are clearly based on distance when a human player would presumably take the one that looks most interesting (such as the one where the monsters are coming from, in order to quell the threat).


My personal take on this would be to explore the possiblity of using a nodes-based system. My idea would be to take key features of the map (keys, weapons, the player start, an exit linedef, the centre of door sectors, etc.) and use them as the nodes. However, that wouldn't work very well, so you'd then need to use the SEGS system to link nodes together...

So then you'd need to take into account things like void spaces, impassable lines and architecture that can't be traversed (sectors that are shorter than the player, for example). By this point the system is so complicated that you'd be better off just putting nodes in the map yourself and programming in a much simpler way of mapping out and following a nodes-based system.


I think whatever the solution, it'd either need to be a big change, or just very, very complicated, if it were to work even remotely well as a player.

Share this post


Link to post

Several years ago I played around with this.

Code using A* on gl-subsectors: here and here

Description of puzzle-solving algorithm: here

I didn't get that far though, the bot could finish E1M1 at least, can't remember whether it could find and use keys -- I think it could but only on simple maps, e.g. MAP02 would fail because it could not find the red key, as it lacked the logic to handle the "jump" to get into the brown building.

Way-points (or better yet: navigation meshes) are a much more reliable method for making bots traverse a map, but of course it requires somebody to actually make that for each map.

Share this post


Link to post
Phobus said:

The only problem I can forsee with an algorithmic approach is how unnatural the behaviour would appear to an outside observer


Exactly in the same way most automated things look unnatural and, well, mechanical and predictable, "playing it safe" if you prefer.

E.g. even the best automatic transmission can do little more than shift up/down at the appropriate speed/motor RPM and *maybe* detect if the car is going uphill/downhill, on very recent ones. It can't do something like e.g. look ahead 300 meters, see that there's a red traffic light downhill which *might* turn green by the time you get there, and so decide NOT to shift up but leave the gear low enough so you can roll to the light with zero pedal and without braking and yet be able to sprint without stopping when it turns green.

Taking the bots by the hand would be the equivalent of setting the driving profile to "city", "sport" or whatever on some cars, which would just change some trends but would still be nothing more than a bunch of stiff rules, that can't match an experienced driver's judgment.

Edit: if id was serious about giving you half-decent bot buddies (or even level-beating adversaries), they'd have probably went for this trope and allow the bots to do thing that you normally couldn't, like opening locked doors, remotely activating switches without hunting for them, zeroing the waiting time on timed events such as caged fights, anticipating monster attacks, manipulating the RNG damage, perfectly executing SR-50 jumps ALL of the time, or even outright flying/noclipping through windows, through narrow sectors etc. with just the decency of keeping -most of the time- inside the actual map.

Such a bot would actually do a pretty good job at emulating the apparent abilities of a (TAS) speedrunner (see my note about how hardcore players in RTS games may appear as godlike as a cheating AIs to a lesser player).

To understand what I'm talking about, see the built-in demo of this map: the player exploits information such as precise knowledge of incoming teleporting monsters (to the point of FIRING A BFG BEFORE ANY OF THEM ACTUALLY TELEPORT IN), never misses a SR50 jump, never fails to kill a Cyberdemon with 2 contact BFG shots and other such things for which you'd need considerably high concentration for 30+ minutes...or a TAS tool (then again, the map isn't really beatable in any other way). If you built a "bastard bot" that DIDN'T play by your rules, you'd get a pretty formidable adversary in a race towards the exit, and one that would make a decent competitor vs speedrunners ;-)

Share this post


Link to post

I have a question about subsectors. If I place linedefs inside a sector without splitting it, will the nodebuilder draw subsectors with their edges along those linedefs?

Though anyway, at this point, I guess it would be easier to just tell the program to build its own mesh of convex sub-sector shapes rather than try to understand the BSP structure and find out the implicit edges (http://www.doomwiki.org/wiki/File:All_SS_E1M1.png). Especially that I have to take into account the solid decoration things, which aren't used for building segs.

SECOND QUESTION (if you don't mind): Which function in the Doom code determines the sector that the actor stays in?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×