Independed Thinking Machine
I got the basic principles working, and therefor i find it appropiate to introduce you to my version of a game-independant bot template.
The ITM-Bot, The "Independed Thinking Machine". The architecture is easy, neat, and it works for HL1 (CSTRIKE) atm. There is still work todo, but the bots spawn, choose a team, etc. So the basics work: Bot can recieve messages, its able to update its data, it can send messages (data) back to the server so it 'interacts'. The interface has only a few 'most needed' functions that the 'empty' interface also offers. Is there any 'advantage' over other bots, no. Why did i do it? Why not? I looked into PMB's code, and i understand the principle, but that does not make me fully understand the code. I wanted to do it myself, just to create an as naked as possible code. For instance, the entities list is not updated yet. And , i want to do this for most important entities only. I am not sure yet what is handy to do, update the entire long list of entities, or just the 'important to bots' one. Anyhow, just was anxious to tell you i got my bot working too. And i hope i can create a HL2 interface soon, so the bot thinking is there, and i only need a few functions to work for the bot. But thats a long way to go ;) |
Re: Independed Thinking Machine
isnt this just engine indep layer augmented with some thinking-functions, like calling behaviours or whatever ...
maybe you also wanna take a look at the joebot xp perception and "thinking" code ... I guess you have the code already, pm me if you don't know where to look despite the lots of comments :P but nice to hear that there are still people out there, who don't have to spend all their free time for university ... looking forward to see some code ( snippets ) |
Re: Independed Thinking Machine
yes, its basicly
BOT INFO GAME so, BOT & INFO is my code, GAME is game dependant code (aka like PMB with interface) , the interface feeds the info 'layer' and the bot uses that layer. |
Re: Independed Thinking Machine
Well as we discussed in the United Bot thread, the big deal will be in comming up with a common interface from which any bot can be built from replaceable components. We're a long way from realizing this, but what PMB and Stefan have done is a big step forward. The hard part is just getting started with something that can be tinkered with, which was a point made by botman a while long ago.
I wish I had more time for bot programming, but at least the project I'm now working on at my job will be in developing a similar interface, so I should be able to share my experience in here at some point. |
Re: Independed Thinking Machine
lol, engine-independent thingies seem to be quite fashionable these days :D
I wish I had more time here too (...and the HL2 SDK). you got me interested, botmeister, could you tell us more about that job ? |
Re: Independed Thinking Machine
well aside from the hl1 interface i try to write an empty interface with only comments. So you only have to 'insert' code there to feed the information layer so bots actually work.
I try to keep as much as possible out of the bot code. Ie, for joining a team in a game, the bot simply does not know what game it is. All it should do is (snippet from itm) Code:
void c_ITM_Bot::BOT_Think() Code:
// PURPOSE: Return TRUE when joined a team The contents look similiar to the join function in Real/HPB/Racc/whatever bot. Code:
///////////////////////////////////////////////////////////////// This is the only example code i have so far that directly calls an interface function from the BOT. Apart frmo the runplayermove logic in the HL1 engine, which i call with "MakeItHappen". This is a more general way of saying to do what we thought about (the bot) and get things in motion. Every game has a different way of doing this, so MakeItHappen was a nice name i thought. For the moment things are very, very basic and very naked coded. Only the barebones are there, but thats the point. It should not be bigger then nescesary. Just FYI here the contents of the itm_interface_hl1.h file: Code:
// Shared interface functions |
Re: Independed Thinking Machine
about how I solved this join stuff : In JoeBOT XP most is inside behaviours, but the joining is not. well, I wanted to write it is, but I looked it up and it isnt ... well, so it's basically the same you are doing stefan, except that I have a general function handling all sort of menues, which is a virtual function and thus is automatically used if a derived class has another handling than the normal HL bot. Maybe putting this into the structure of the behaviuors would be a fine way since that doesnt imply the need of another function ... nice idea, if I had only time.
About the network messages : ( havnt yet implemented all of them, just those I need at the moment ) They produce perceipts, like those perceipts when a bot sees another player, therefore they are processed by behaviours like almost everything else. this is something that's so to say part of the layer "converting" the information which the engine provides. Code:
CBaseBot *pBot = g_pGame->getBot(bot_index); and then those information is used fully engine indep in a behaviour Code:
// watch Damage |
Re: Independed Thinking Machine
i understood the first code snippet perfectly. Thats also a way of doing it. Although i would just set a flag or something, or even better. Just set the health and let the bot think handle the question 'how did my health drop' and determine that from an origin if it was inflicted or not.
THe second piece was just a to big IF statement for me to handle at once heh :) |
Re: Independed Thinking Machine
I have to store more data in the perceptions since the perceptions can exist longer, and an entity inflicting damage might be deleted. the perception might even go to the long term memory, so that's why i'm storing almost everything important I can get in the perceipt.
and always checking if the health might have dropped is called "polling" and not very loved noadays, since you need processing time for it. In my solution only then the code is executed if something happened |
Re: Independed Thinking Machine
actually i don't care what is loved or not ;) i go for security, and portability :) And yet easy-to-read code. With machines nowadays, i don't think bots can take up to much cpu power.
|
Re: Independed Thinking Machine
well I also has made a "engine independant" structure for my new bot, but it's not very advanced; I just stuffed most of engine specific stuff in classes. Here's my bot.cpp file:
PHP Code:
|
All times are GMT +2. The time now is 06:44. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.