Where to Start?
Moderator: Defcon moderators
Where to Start?
I really want to write a Bot AI, either in Lua or C++, but I don't know where to start or how. Can someone PLEASE point me in the right direction.. Maybe give me some steps in starting?
- Th3xpl0iT
- Th3xpl0iT
- Ace Rimmer
- level5
- Posts: 10803
- Joined: Thu Dec 07, 2006 9:46 pm
- Location: The Multiverse
This is a very good place to start: http://www.doc.ic.ac.uk/~rb1006/projects:api
It has all the information you need for Lua and C++ (I think).
It has all the information you need for Lua and C++ (I think).
Smoke me a kipper, I'll be back for breakfast...
- Ace Rimmer
- level5
- Posts: 10803
- Joined: Thu Dec 07, 2006 9:46 pm
- Location: The Multiverse
Th3xpl0iT wrote:Yeah I looked there, I didn't know where to click. Is there a tutorial on this forum, or no?
Tutorial for what exactly? How to program? How to code in Lua? How to make an AI? How to use the API? There should be an example bot included with the API on the above link which, providing you know a little about how to code in your chosen language, should get you going. Possibly the closest thing to a tutorial is this, an explanation of how and why to use the yield feature in the Lua API since it can be a bit tricky to get your head around but nothing really more specific than that.
If you get stuck or have a particular problem you can just post here and people will normally help if they can. Alternatively you can try reading through some of the threads here as they'll include snippets of code and document times when people slipped up.
Th3xpl0iT wrote:Maybe I should give an example..
I guess I can piece it together but I want to see what you guys say first. I want my bot to launch a nuke at New York when Defcon 1 hits. What would that look like? Two variables and an if/then statement?
Step 1, determine if NA is playing. (loop and if)
Step 2, determine what continent you are. (if)
Step 3, determine where to place your silos based on your given continent. (loop and if)
Step 4, Wait til Defcon 1. (if)
Step 5, Get New York object/location. (get)
Step 6, iterate through your silos targeting New York until all nukes fired. (loop and if)
How complex all that is depends on if you want it to be smart or dumb i.e. place silos based on population densities, enemy location, enemy placements, etc. or just hard code silo locations.
Last edited by Montyphy on Wed May 19, 2010 9:59 pm, edited 1 time in total.
Th3xpl0iT wrote:Can you help me write the C++ code?
Depends what you mean by help. Will I write it for you? No. Will I help troubleshoot the odd error and provide hints on optimisations in code you post? Yes. Although if you want to maximise your chances of receiving help I would suggest you use the Lua API since that's what most/all people here use and understand.
GetLongitude
GetLatitude
You really should just read through the API documentation:
Quickstart
Function list
Constants
GetLatitude
You really should just read through the API documentation:
Quickstart
Function list
Constants
Okay so at the beginning of bool Bot::Update()
Something like that?
EDIT: I am, but it's a little confusing..
Code: Select all
float longitude = m_game->GetLongitude(1);
float latitude = m_game->GetLatitude(1);
Something like that?
EDIT: I am, but it's a little confusing..
Who is online
Users browsing this forum: No registered users and 8 guests