Duke4.net Forums: DukeThought - Duke4.net Forums

Jump to content

  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

DukeThought  "the bot I'm working on"

User is online   Danukem 

  • Duke Plus Developer

#1

For a long time I have mused about making a bot for Duke 3D that is capable of playing the game well enough to beat real levels without cheating. Starting on September 4 I finally got around to working on it, and I have been making slow and steady progress a little each day in my spare time. The bot works by manipulating an actual player actor -- either player 1 in single player, or player 2 in coop. It will have applications for both real and fake multiplayer. Eventually, I may remake my "Duke Nukem Arena" mod using the bot as the foundation. The bot has access to complete information about the game world, but otherwise is not allowed to cheat or do anything that a human player could not do.

This is a big project and I expect it will be a long time before my bot is capable of completing a significant number of real game levels (i.e. levels made by and for humans). As of this writing, the bot is a useful coop companion but isn't smart enough to complete levels. However, I have made good progress on several fronts and I plan to report about it in this thread. This is both my own record of progress and an opportunity for discussion with interested members of the community.

DukeThought

For years I was known in the community as "DeeperThought", which was inspired by the fictional computer Deep Thought, so naming my bot DukeThought seems appropriate.

Duke 3D levels have many features to confound bots. I want my bot to be able to complete unmodified versions of maps without any prior knowledge of them: no waypoints placed in them ahead of time or anything similar will be allowed. This makes my job very, very difficult. Even a relatively simple level like E1L1 presents great challenges. Failure is an option. If I fail, I'll still have a good bot for coop and other purposes.

Progress so far:
My bot can follow the player around pretty well. He can also fight competently. He knows how to select, aim and fire weapons, and will make appropriate choices depending on the situation. He also knows how to move towards nearby items to pick them up, and can prioritize them according to need. He can also use the medkit.

Now I am beginning to work on the hard part: level navigation. Following the player around is simply a matter of tracing the player's steps, and has zero implications for the bot completing a level by himself. This weekend I gave him a recursive path finding algorithm and successfully tested it to make him navigate to goal sectors across simple mazes. This is just the first step of a long journey with many pitfalls. There's a myriad of obstacles in real levels which will make it a nightmare for the bot to figure out how to complete them. Doors, elevators, keycards, switches, cracks in walls, teleporters/water, and jumping puzzles are just a few.
19

User is offline   Spiker 

#2

Please rename the bot to Dan Smart, thank you.
0

#3

Behold ! Beware! The Herobrine of Duke Nukem :) :)

Great idea anyway, i expect it willbe pretty hard, also because there are very few AI experts like you, and level navigation/exploration is the hardest part...

I bet you already got the idea, but i think to an array with visited sectors and a random/priority route selection, for example when the bot finds a locked door OR a keycard before, then skip some previous routes or find new ones

This post has been edited by RichardStorm: 17 September 2017 - 04:52 AM

0

User is online   Danukem 

  • Duke Plus Developer

#4

View PostRichardStorm, on 17 September 2017 - 04:50 AM, said:


I bet you already got the idea, but i think to an array with visited sectors and a random/priority route selection, for example when the bot finds a locked door OR a keycard before, then skip some previous routes or find new ones


Yes, I am planning to implement something like that. The reason is that it is too difficult to analyze an entire level at once. There are just too many nonlinear ways that level progression can occur. But if the bot can successfully path to local goals and prioritizes exploration of new areas, this will increase the probability of him completing the level. My rule of thumb to start with will be "go where you haven't gone, do what you haven't done". There's not necessarily any need for a random element, but I suspect that results will be somewhat randomized by enemies encounters that will throw him off course and change his health and equipment levels.
0

#5

Why limiting the Arena concept to better AI, and pathfinding among Dukebots only? We could even take the role of the alien races to expand and differentiate further the experience and every species has his behavior on different kind of of threat. You yourself have made a mod that allow to impersonate a pigcop.

Yeah, balancing an eventual game on the point of different abilieties when it's a player to control an alien it's another question. Just don't make it a sort of Overwatch.

This post has been edited by Fantinaikos: 17 September 2017 - 11:48 AM

0

User is online   Danukem 

  • Duke Plus Developer

#6

View PostFantinaikos, on 17 September 2017 - 11:43 AM, said:

Why limiting the Arena concept to better AI, and pathfinding among Dukebots only? We could even take the role of the alien races to expand and differentiate further the experience and every species has his behavior on different kind of of threat. You yourself have made a mod that allow to impersonate a pigcop.

Yeah, balancing an eventual game on the point of different abilieties when it's a player to control an alien it's another question. Just don't make it a sort of Overwatch.


Calm down. I said the new bot AI would be the "foundation" of Arena if I remake it, I didn't say that the advances would be exclusive to bots or that it wouldn't have a ton of other features. Anyway, that seems far in the future right now, and I'm focused on making the bot.
0

User is offline   Forge 

  • Speaker of the Outhouse

#7

Dan secretly works for Cyberdyne Systems.
1

User is offline   Mark 

#8

I was doing some searching on the SOB-BOT mod and found your posts in a 3DR thread from way back in 2006 saying you would like to program a good working bot.Never give up. :)
0

User is online   Danukem 

  • Duke Plus Developer

#9

Getting the bot to crouch properly has turned out to be very frustrating. Setting the input bit for the crouch key will cause the player to display the crouching animation but will not allow him to enter sectors that require crouching height. What I had to do is constantly add z to his position to simulate crouching height. But even this would not allow him to enter a crouch height sector unless I pushed the z down way lower than it is supposed to be. Unfortunately, this would allow him to enter sectors that he should not be able to --- so it was either not being able to enter any crouching sectors, or be able to cheat. Finally, I noticed that if the player jumps right before trying to enter, the landing somehow enables him to enter the crouching sector without pushing his z down below where it is supposed to be for crouching. So now I can make the bot enter crouching sectors without cheating, but he has to jump once or twice first like a retard.

If you want to kill this bot, make a tunnel he has to crawl into, then put some laser tripbombs right above the entrance.


If any devs are reading: I don't know how hard this would be, but it would be amazingly good for this project if setting the input bits in the input struct actually caused the player to do shit as if he were pushing the corresponding keys. It works with some stuff (pushing space, pushing fire) but not others.

This post has been edited by Trooper Dan: 19 September 2017 - 10:59 AM

0

User is offline   TerminX 

  • el fundador

  #10

Are you doing anything with EVENT_CROUCH? It looks like this is one of the keys that should just work when you set the bit.
1

User is online   Danukem 

  • Duke Plus Developer

#11

View PostTerminX, on 19 September 2017 - 11:02 AM, said:

Are you doing anything with EVENT_CROUCH? It looks like this is one of the keys that should just work when you set the bit.


I am not doing anything in EVENT_CROUCH. Should I? I set the bit on a var, then I constantly set the bits input member in EVENT_PROCESSINPUT to the var.
0

User is offline   TerminX 

  • el fundador

  #12

Hmmm... I think I actually see something in the code that could prevent that from working correctly. I'll commit something in a bit and you can see what happens with the new binary.
2

User is online   Danukem 

  • Duke Plus Developer

#13

View PostTerminX, on 19 September 2017 - 11:07 AM, said:

Hmmm... I think I actually see something in the code that could prevent that from working correctly. I'll commit something in a bit and you can see what happens with the new binary.


Yes, it fucking works now, and I don't have to make him jump or push him down or any BS like that! Thank You!
1

User is offline   TerminX 

  • el fundador

  #14

Awesome! :)
1

User is offline   Mark 

#15

But now that fix causes the small fonts in game to display in japanese. :)

This post has been edited by Mark.: 19 September 2017 - 11:44 AM

1

User is offline   OpenMaw 

  • Judge Mental

#16

View PostMark., on 19 September 2017 - 11:43 AM, said:

But now that fix causes the small fonts in game to display in japanese. :)


Oh Duke, you so kawaiii.....
0

#17

I really enjoyed playing with the bots in Duke Plus they were really great team up with, I love to see what the new Duke Bot can do.

also I think you should be able name the Duke Bot I proply name him Hendricks266

This post has been edited by Duke Legacy: 19 September 2017 - 03:25 PM

1

User is online   Danukem 

  • Duke Plus Developer

#18

View PostDuke Legacy, on 19 September 2017 - 03:23 PM, said:

also I think you should be able name the Duke Bot I proply name him Hendricks266


Sounds good, but if you pick that name, don't be surprised in coop if he starts shooting you when you deviate from the optimal path that he calculated.
7

#19

don't worry I follow him let him while he doing all the killing and making alien salad.

This post has been edited by Duke Legacy: 19 September 2017 - 07:40 PM

0

User is offline   Hendricks266 

  • Weaponized Autism

  #20

Could you tell me what impact r6457 has on your work?
0

User is online   Danukem 

  • Duke Plus Developer

#21

View PostHendricks266, on 26 September 2017 - 07:22 PM, said:

Could you tell me what impact r6457 has on your work?


The fix for players getting squished on multiplayer start seems to work fine. I was able to remove my workarounds for that problem without any issues, and nobody is getting squished. :rolleyes:

I don't yet know what other impacts this build will have. My focus for the last few weeks has been on single player AI, and I have allowed my coop AI to become broken (mainly because it sits on top of items because it doesn't notice that they stay in coop). My single player AI seems to work exactly the same with this build, and my coop AI is just as broken.
1

User is online   Danukem 

  • Duke Plus Developer

#22

View PostHendricks266, on 26 September 2017 - 07:22 PM, said:

Could you tell me what impact r6457 has on your work?


Here is an issue I'm having, although it isn't new to this build. Setting input bits to emulate the player pressing weapon keys does not work. In particular, this does not work:

	switch botweapchoice
	case 0 orvar botbits 256 break
	case 1 orvar botbits 512 break
	case 2 orvar botbits 768 break
	case 3 orvar botbits 1024 break
	case 4 orvar botbits 1280 break
	case 5 orvar botbits 1536 break
	case 6 orvar botbits 1792 break
	case 11 orvar botbits 1792 break
	case 7 orvar botbits 2048 break
	case 8 orvar botbits 2304 break
	case 9 orvar botbits 2560 break
	endswitch


The bits member of the bot player's input struct are set to the botbits var in EVENT_PROCESSINPUT, and this works for other functions. Since this doesn't work for weapon switching, what I've been doing is trying to fake it as best I can.

This is what I do to force a weapon switch:

	setp[].weapon_pos -1 
	setp[].kickback_pic 0
	setp[].wantweaponfire botweapchoice 
	getp[].curr_weapon temp
	setp[].last_weapon temp
	ifg player[].ammo_amount temp 0 setp[].last_full_weapon temp
	setp[].curr_weapon botweapchoice
	ife botweapchoice 1 sound INSERT_CLIP else
	ife botweapchoice 2 sound SHOTGUN_COCK else
	sound SELECT_WEAPON


Before forcing it, I check to make sure that the weapon has ammo and weapon_pos, reloading, and kickback_pic are all 0. Still, I sometimes get problems. The worst is that the shotgun often locks up and can't fire after switching to it (even when I manually press the fire key). I'm doing something wrong in the forced switch and it would be a lot easier if the input bits worked.
0

User is online   Danukem 

  • Duke Plus Developer

#23

I guess my only recourse for now is to set kickback_pic to 1 on the shotgun to force fire it when it locks up. I have tried everything I can think of with the bits structure, I even recorded how it changes when a human player presses the weapon switching keys to see if it's different from what the wiki says (it's not). I would even settle for the prev/next weapon inputs working, since I could have the bot quickly cycle weapons that way.
0

User is online   Danukem 

  • Duke Plus Developer

#24




Some day I hope that my bot will be able to complete a published map made for human players, but for now here is a video showing Duke Thought completing a very simple, ugly little map that I made for testing. This bot operates without any waypoints or other modifications made to maps for him, so he has to analyze the map structure on the fly. He still fails badly in more complex levels (i.e. any actual published map), but I have been adding to his capabilities bit by bit.
12

User is offline   Micky C 

  • Honored Donor

#25

That seemed to be quite a bit of wasted ammo on the first pigcop, and later on with a few enemies and the shrinker. I assume it keeps firing until the enemy is incapacitated. Is is possible to make it shoot only the amount that it knows will kill an enemy? I admit it gets more difficult when it comes to targets that move, and the possibility that not all projects will hit the target, save for some kind of motion anticipation algorithm.
0

User is offline   Mark 

#26

Dukebot is a better player than I am. :rolleyes:
1

User is offline   Paul B 

#27

It would be interesting to have the AI select a weapon that works best against the AI enemy unless that weapon isn't available. Such as: if the Ai Duke recognizes an octobrain, it would try the devastator. Otherwise use chaingun or shotgun failing back to a pistol if that's all the bot has. If the AI see's a commander attempt to use shrinker first before a rocket laucher. etc.. As it stands right now is the weapon of choice just random? Or would that entail too many problems with weapon switching if there were a crap load of enemies in the same room? It might look strange if the AI was swapping rapidly between different weapons in a firefight....Sometimes its just nice to clear a room with just a rocket launcher.

A weapon priority array would need to be built for each enemy upon visual contact. But if there happens to be 4 or more of the same enemies or a mass amount of enemies detected within a close proximity then use rocket launcher/ devastator. If either one are not found then run like hell in the opposite direction. lol

This post has been edited by Paul B: 29 September 2017 - 06:52 AM

0

#28

As Roy said on Tremors 2 you put anew meaning on the word overkill.
1

User is online   Danukem 

  • Duke Plus Developer

#29

The bot will get better about ammo usage and weapon selection. This may sound strange, but I haven't spent much time on combat because I know it's much easier to code than level completion. I don't want to focus on something easy and put off the more difficult problems that can break the project. So for now, he has the bare minimum combat knowledge to get him through basic combat situations while I try to teach him about how to move through a level.

P.S. to any devs who may be reading -- as I was saying above, it's not possible to switch weapons by setting the corresponding bits in the input structure. I would be very helpful if that could be changed.
1

#30

This is really exciting!
2

Share this topic:


  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options