IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Java ProxyBot (Basic Exploration)
Captndan   
Jul 5 2010, 06:03 AM    Post #1
Hi everyone,

I'm currently working on Starcraft AI as part of a project for my Masters. Ultimately it's going to be using neural networks to control the AI logic, but at the moment I'm just trying to get my head around using the Java-based ProxyBot for BWAPI.

I've got my units attacking enemies, mining minerals, building various buildings under certain conditions etc.

But obviously, enemies will only be attacked, and minerals mined if they're actually visible.

How would I go about coding for my units to explore the terrain on their own?

Many thanks for any help you can give me!


 
Go to the top of the page +
lowerlogic    Massachusetts, U.S.
Jul 5 2010, 11:29 PM    Post #2
I only work on the BWAPI project, not the Java proxy bot, so I won't be of much help if you have questions regarding how to program it in Java. Though here are some of the key functions you'd need to use if you were going to program it in C++:

Broodwar->self()->getUnits() will return the set of units (including buildings) you currently have in the game.

Broodwar->isVisible(x,y) and Broodwar->isExplored(x,y) can be used to determine which tiles on the map are currently visible and have been explored. A tile returns true for isExplored if it is currently visible or ever was visible in the past. The size of the map is Broodwar->mapWidth() by Broodwar->mapHeight().

Broodwar->isWalkable(x,y) can be used to determine which walk-tiles are walkable. A square of 8x8 pixels make up a walk tile, 4x4 walk tiles make up a build tile. 4x3 build tiles is the size of a command center/nexus/hatchery.

Unit::rightClick works just like it does from the GUI and can be used to order units to move to any arbitrary position on the map, whether or not they actually reach the destination depends on whether or not a path exists from the unit's current position to the destination.

All of these functions are documented on the wiki: http://code.google.com/p/bwapi/wiki/Game#isExplored


 
Go to the top of the page +

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 7th September 2010 - 06:37 PM