.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
Planning and design
Old
  (#1)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Planning and design - 05-01-2004

Ok, I have no active projects so I'm thinking of starting a bot.

This question is mainly pointed towards the people currently working or planning a bot.

What is your design process?
What gets planned first, is there a specific order?

Sorry if these sound dumb but I need a good startpoint.
Don't think I'm a complete idiot though, I know C, C++ and the HLSDK but
I'm just wondering how you all put it together and in what order.

I generally start in the wrong place and hopefully a point in the right direction can get some plans written while I examine some open-source bots and read up on things like pathfinding, ect...

Any thoughts are appreciated.
  
Reply With Quote
Re: Planning and design
Old
  (#2)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Planning and design - 05-01-2004

Hmm, it totall depends on what you want. Do you want to write a bot that is an all-in-wonder? You probably start then writing a lot from scratch to make sure the bot is using classes and also is able to work in other mods and such.

If you just want to play around first, i suggest you hack into some existing bot sources.

After that, i'd say:

- work on code structure first
- work on navigation

make sure the 2 above are almost complete. The code structure should be readable, (its hard to keep it readable if you code a lot new stuff) and it should work of course. Then add a simple form of navigation, like using waypoints/nodes/navmeshes/no waypoints (tracelines nav).

once you got a solid code, where you can code from you can expand your bot easier.

In very short order:
code layout/structure
navigation (select goal, make path, walk)
combat (fight, shoot, take cover)
advanced navigation (goals)
advanced combat (flanking, swat behaviour?, outsmart enemy)
fancy stuff


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Planning and design
Old
  (#3)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default Re: Planning and design - 05-01-2004

All IMHO
Obviously you have to know C (C++, API, ...)

well my design process was :

1. Gather information about coding a bot, find webpages, forum
2. Download many bot source codes
3. Download HLSDK and compile a (someone else's) bot
4. Try to understand the bot code (from HLSDK point of view, Dll hooks ...)
5. Understand the rest of the code
6. Decide if you will be modifiing existing source or you will start from begining
(I started from begining, leaving only SDK and some botman's functions)
7. Create a bot which joins
8. looking, moving
9. buying weapon, speaking
10. navigation - I'm here

Hardest parts (for me) :
- understanding the code
- deciding inner bot representation (C++ classes, 'cause I'm using C++ in my bot)
- deciding better inner bot representation ('cause the first one didn't work )

Do not try to understand everything at once. As I approach some problem (for example how bot should talk) I search the bot source code. Then I search the botman's forum. If I am not succesfull I search again and again and after not finding what I wanted I post my question o_O

Do not try to program the best and most effective piece of code for the first time. My priorities :
1. Must work without bugs.
2. user-friendly
3. Has features I wanted
4. Is effective
(It is no good to have an effective, but buggy algoithm)

Source code structure : lots'a comments (like PMB does)


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)
  
Reply With Quote
Re: Planning and design
Old
  (#4)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Planning and design - 05-01-2004

agreed. Although the priorities differ for each coder, i do agree on this 'code structure'. Keep the code, nice, clean, but commented.

here a snippet from my own BotThink function (a left over from botmans template actually):
Code:
// GENERAL BOT THINK:
void BotThink( cBot *pBot )
{ 
   // STEP 1: Update status
   pBot->UpdateStatus();   
   // STEP 2: Think
   pBot->Think();
   // STEP 3: Act
   pBot->Act(); // Bot act
   // PASS THROUGH ENGINE
   g_engfuncs.pfnRunPlayerMove( pBot->pEdict, pBot->vecMoveAngles, pBot->f_move_speed,
								pBot->f_strafe_speed, 0, pBot->pEdict->v.button, 0, pBot->msecval);
   return;
}


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Planning and design
Old
  (#5)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: Planning and design - 05-01-2004

Thanks for all of the information and advice - I guess its time to look through bot code and take notes.
  
Reply With Quote
Re: Planning and design
Old
  (#6)
Bert
Member
 
Status: Offline
Posts: 11
Join Date: Jan 2004
Default Re: Planning and design - 05-01-2004

I'm still new to HL coding and c++ in general (I'm a java guy :]), so my method might not by the best way to handle things.
I started by reading Botman's most excellent readme, downloaded his HPBbot source, messed around with that, got it to work with another mod (SI), continued tweaking and expanding on that, got annoyed by the C style programming so I started almost completely from scratch leaving just the "engine interfacing" code and the waypoint code. My bot is now nicely OO thus making the code alot easier to read and maintain. My bot is structured as followed:
-a global botmanager that adds/removes/updates bots
-the bot class
- a task class
- a bot weapon class (this is just Botman's struct really, but turned in a class)
- a team class

I was planning on doing a complete overhaul of Botman's code, but as I just want a new version out, I'll just modify botman's combat and navigation code.
Getting feedback is always a great way to get you motivated, so don't go for a perfect bot for each version, just release something you're fairly happy with.
I'm staying away from navigation for now, as I really have to read up on that stuff to improve on it. Just start small, it might not be the best way to handle things, but by the time you realise you're going at it the wrong way, you'll have learned quite a few new things.
  
Reply With Quote
Re: Planning and design
Old
  (#7)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Planning and design - 05-01-2004

yes, do not be afraid to release a bot with bugs. Bugs are there to be removed, and you can't possibly find all bugs yourself. Hence, i launch WIP's frequently so people give me 'more work'


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Planning and design
Old
  (#8)
Austin
Moderator
 
Austin's Avatar
 
Status: Offline
Posts: 403
Join Date: Nov 2003
Default Re: Planning and design - 06-01-2004

Quote:
Originally Posted by stefanhendriks
yes, do not be afraid to release a bot with bugs. Bugs are there to be removed, and you can't possibly find all bugs yourself. Hence, i launch WIP's frequently so people give me 'more work'
This is a bad attitude to have as a developer!

I worked for 4 years in serious software testing before writing any code.
(testing things like backup software that fortune 100 companies used to back up / restore their databases / file systems / operating systems...)

This served me very well in my career as a developer. I saw the large amount of wasted time caused by developers releasing code they didn't even really test.

Strive for perfection from the start, as much as reasonably possible and then you will be in a better position to fix the myriad of bugs that will arrive anyway.

IMHO!

Last edited by Austin; 06-01-2004 at 00:43..
  
Reply With Quote
Re: Planning and design
Old
  (#9)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: Planning and design - 06-01-2004

Thanks for the last few suggestions, I will not write one line of code until I have written out a general idea of what I want to accomplish.

Implementing it is no problem for me, its the figuring things out part that takes the brainpower.
  
Reply With Quote
Re: Planning and design
Old
  (#10)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default Re: Planning and design - 06-01-2004

I agree that you should test your piece of code before continuing, but you can't be perfectionist if you are developing some code for the first time

(example : you are going to write a pathwalking algorithm for your bot. When you start coding it, you will find that your waypoint representation is not very good for this algorithm. Thus you have to rewrite waypoint representation. Next time you will be making waypoints, you will already know this problem and you will do it 'pathwalking friendly' before you code pathwalking)

I am talking about experience. If you don't have a good experience with coding a bot, you can't be perfectionist, 'cause you don't know whay lies ahead.

You can't optimize code for something you don't have experience with (can't optimize waypoints for my pathwalking algorithm if I haven't created one yet)


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com