Forum: GameBots2004

Problems with sending commands to GameBots

hello, and sorry for the long message. I'm trying to create my own parser in order to connect directly to GameBots 2004. That's because I started a project where I have to use C++ instead of Java to program a bot.

I've already managed to connect to GameBots and to get data (the synchronous messages) about my bot and the world around me. However I face many difficulties when I try to send commands back to the bot.

More specifically I am trying to make the bot to walk a step forward. I have tried to send any type of command that I read from the tutorials that is used to move the bot such as RUNTO {Speed 1.00} {Location 1426.04,-567.77,-78.15} but my bot doesn't respond.

At first I thought that GameBots doesn't receive the commands but after some tests I saw that commands like JUMP, SHOOT/STOPSHOOT and ROTATE {Amount 10000} work fine.

So I decided to ask if someone thinks that I do anything wrong..

Also, a second thing I would like to ask is if there is a way to extract image data from the game using GameBots.

Thanks in advance.
Hi! And welcome to the forum!

There might be several issues...

1) are you flushing buffers of underlying socket objects? (otherwise they are kept "inside your process")

2) are you carefully sending \r\n as line ends? (otherwise GB2004 won't recognize them)

3) the documentation for GameBots2004 might be a bit OLD! Always check with the latest JavaDoc whether such command still exists see:
http://diana.ms.mff.cuni.cz/pogamut_files/latest/doc/javadoc/
search for package: cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands
this source of commands is credible, as we are using them in java
RUNTO command in particular has been joined together with STRAFE command into general MOVE command

I think that (3) will resolve all your problems :-)

We're sorry for misleading you with old documentation and we will try to fix it as soon as possible!

Cheers!
Jimmy

P.S.: if you have any other problems feel free to ask no matter of the length of your question!
My bot is finally walking thanks to (3)! :-)

I was indeed using a wrong version of the documentation (although RUNTO is also mentioned as an example of commands in the new version).
Also, I had not realized that I could find such a helpful package on JavaDoc!

one suggestion: I believe it would be very nice if you mention the name (or a link) of this package in the documentation page (ch 5 or 6) since it is very useful for anyone who's trying to understand how the GameBots syntax works.

Thank you very much for your quick and helpful response.

Cheers!
Zafiris
Cool! I'm glad we've sorted it out.

You're right, the documentation should link there + we should run through it and clean it a bit (as it has not been swept through for two years now!).

If you have any other trouble, post again! GB2004 protocol is not that hard, but interaction with GB2004 might be worse than it seems. Please also note that protocol is not all. There is A HUGE LOAD OF CODE that is painting facade onto the protocol in order to make it easily / quickly usable by newcomers to Pogamut, thus you might have a lot of work before you (for instance Weapon handling is particularly weird as there are two types of item ID's ... one id belongs to the item in the environment, i.e., one that is laying on the ground, other one is InventoryId that is communicated via AIN message when you pickup new weapon). I would recommand you to quickly go through the source code for Weaponry, Items, AgentInfo.

Cheers!
Jimmy