4th year computer science Doom campaign bot

Talk about our & your projects.
DoopDoop
Doop
Posts: 4
Joined: Fri Jun 03, 2016 19:18

4th year computer science Doom campaign bot

Post by DoopDoop » Fri Jun 03, 2016 19:27

Hi guys,

As part of my final year computer science project I want to build a Doom bot that will learn how to play the doom campaign(Starting off simple with the first level since it doesn't have any keydoors etc). The plan is for it to use a try/fail method known as genetic programming in combination with neural networks and machine learning.

I have one issue though. Right now im specking out the project which basically means I have to look at the source code and make sure it contains files that will allow the bot to learn/know when it completed a level(Im looking at the ZDoom source port atm). To put it simple im looking for a source file similar to something like "endoflevelbutton.cpp" that contains information about the button at the end of the level that when I press the mission/level is completed. I've never looked at source code at this scale before so to be blunt im hopelessly lost.

This is a project I really want to do and my lecturer is pretty happy with the idea but I need some inside info from you guys who will more than likely have a better understanding of the source code than I do. Any help is welcome. Also if there was some sort of x,y co-ordinates associated with enemies and the player that I could use for my bot that would be minty to know too!

Thanks guys.

User avatar
Gez
Developer
Developer
Posts: 1393
Joined: Mon Oct 22, 2007 16:47

Re: 4th year computer science Doom campaign bot

Post by Gez » Fri Jun 03, 2016 23:36

Well my advice would be to start learning how to use the "find in files" features (Shift-Ctrl-F) so that you can get your IDE/text editor to look through all of the project file for text strings.

The ZDoom codebase is probably not the simplest there is for Doom ports, given how so many subsystems were rewritten entirely several times. You might be interested in AutoDoom, by the way.

Anyway, the end of level button is merely a normal linedef, which happens to have a special on it, and that special happens to be, in ZDoom terms, Exit_Normal. So if you want your bot to find out where the exit button is, it'll have to iterate through all linedefs in the level to find those that have an Exit_Normal special. (There's also Exit_Secret, and then there are also a few other exit methods, such as killing all spiderdemons in E3M8, killing all cyberdemons in E2M8, and killing a Romero-head-on-a-stick; but we'll keep it simple for now.) Just looking at the code for the special itself will not help you program your bot, since what you want is finding out where it is on the map.

Also, of course enemies and players all have X, Y coordinates. The engine needs to keep track of them after all! All AActor (it's the internal name in ZDoom for the Actor class, enemies, players, fireballs, pickups, pretty much everything that has a sprite and a lot of things that don't are actors) have coordinates, so again, you can iterate through the list of actors in the game, filter out those that are monsters, and look at their coordinates in comparison to the coordinates of the player's own actor.

Good luck with your project, it is more than quite a little bit ambitious. If you want to try something with the same general idea but a bit simpler, look at Wolfenstein 3D, as the maps are much simpler and you don't have to deal with subtleties like running jumps (e.g. Doom II MAP02), damaging floors, etc. The guy who made AutoDoom started with an AutoWolf for these reasons.

DoopDoop
Doop
Posts: 4
Joined: Fri Jun 03, 2016 19:18

Re: 4th year computer science Doom campaign bot

Post by DoopDoop » Sat Jun 04, 2016 11:04

Awesome man thanks for the reply! Yeah it's probably ambitious but that's why I wanted to spec it out first to find out if it's doable in the first place! The plan would to literally stick to the original Doom game only but I'm going to take your advice and look into Wolfenstein first to check out the complexity of that first. I was pretty sure that mobs and players etc had X,Y co-ords but didn't see them explicitly set in the player.cpp file so I assumed they were declared somewhere else and inherited or something similar by the player class.

I reckon the harder part of this task will be trying to get the bot to "identify" what exactly it is surrounded by. At this point i'm not writing any code I just want to be sure I can actually get a working bot by the time this project is due next summer. Once i'm sure that It's possible for the bot to identify that there's say an enemy 10 steps away and that he can shoot it by using the x,y co-ords of that enemy from some enemy object declaration in a main somewhere in the files then I can be sure the project is do-able.

You're actually not the first person to say it's an ambitious project. An engineer from google said the same thing. This whole idea was born from a similar bot that was designed for MarIO( https://www.youtube.com/watch?v=qv6UVOQ0F44 ). Obviously the prime difference here being "3D" whereas Mario is 2D.

If anything I just want to become a better developer from this by setting a really hard challenge for myself. The last thing I want is to set a project that I struggle with for portions of but that for the most part is super simple. I want to be challenged throughout the entire project. This also gives me the experience of looking at someone else's code base which is awesome.

Thanks again man, If you've any other advice I'd love to hear!

User avatar
Rachael
Developer
Developer
Posts: 3616
Joined: Sat May 13, 2006 10:30

Re: 4th year computer science Doom campaign bot

Post by Rachael » Sat Jun 04, 2016 14:06

What I would do, since you are doing the original Doom game, is assume all levels are linear in some way. First, you find the exit special, then you try and plot a course from that to the player's current position, traveling sector by sector and taking into account obstacles along the way. If there is a key door, then change the goal to that key, first. If there is a door only opened by a switch, then find that switch, instead. And do this recursively, where if the key is blocked by another key door, find that key, instead. Etc.
Spoiler: Zen Sarcasm

DoopDoop
Doop
Posts: 4
Joined: Fri Jun 03, 2016 19:18

Re: 4th year computer science Doom campaign bot

Post by DoopDoop » Sun Jun 05, 2016 13:34

Taking it sector by sector would break it down quite nicely actually. One of the specifications that my lecturer wants me to follow however is that the bot literally knows nothing about the game when it starts. Not where the end is or where the keys are or where the enemies. It should build the neural network from the ground up. This would be a specification that would most likely be for an A+ which I intend on trying to get. So i'm not too sure how breaking the bots path down into sectors would work.

User avatar
Gez
Developer
Developer
Posts: 1393
Joined: Mon Oct 22, 2007 16:47

Re: 4th year computer science Doom campaign bot

Post by Gez » Mon Jun 06, 2016 12:21

Thing is that a sector isn't really helpful if you want the bot to find out where it can go or not, because there's no uniformity in how big or small a sector can be. A sector can even be made of several disjoint areas! You'd better reason with something more predictable, like a blockmap block.

DoopDoop
Doop
Posts: 4
Joined: Fri Jun 03, 2016 19:18

Re: 4th year computer science Doom campaign bot

Post by DoopDoop » Fri Jun 10, 2016 8:52

Yeah simply due to the fact that I want the bot to initially know nothing about the game it'd be hard to try and use sectors but If it was building it differently maybe I could use that. I feel like my main issue with this project is simply just trying to read the Source ports. I've tried looking at the AutoDoom/AutoWolf source code over the past few days and I'm sure I could make sense of it long term. But really even from looking online there's no real documentation describing how it works, which is a shame because it makes my task of trying to just read it and find the things that I need in order for this to work really difficult to find. :(

I've tried contacting some of the Devs but I haven't heard back from them, which I can totally understand. I'm sure they have better things to do than replying to novice programmers such as myself :)

User avatar
Rachael
Developer
Developer
Posts: 3616
Joined: Sat May 13, 2006 10:30

Re: 4th year computer science Doom campaign bot

Post by Rachael » Fri Jun 10, 2016 14:01

Or they may simply not be around anymore. It's not unusual for a project to outlast its creator, especially in this community.
Spoiler: Zen Sarcasm

Post Reply

Return to “Projects”