Differences
This shows you the differences between two versions of the page.
Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
guidelines:adding_gamebots_message_to_pogamut_java [2012/02/07 17:45] martin.cerny |
guidelines:adding_gamebots_message_to_pogamut_java [2012/02/07 17:50] (current) martin.cerny |
===== Extending the Yylex parser ===== | ===== Extending the Yylex parser ===== |
| |
The built in parser is created by JFlex and has a rather nasty internals. Unless you are trying to achieve something special, you will not need to look into it. Whenever the built-int parser encounters a message name it does not recognize, it calls protected method ''tryParsingUnprocessedMessage'' if it returns a message instance, the parser treats the message as recognized and passes all subsequent parameters of the message to ''tryParsingUnprocessedMessageParameter'' method. Note that, by design of gamebots protocol, all parameters are optional, so you cannot rely on the fact that all message parameters will be set, neither can you rely on the order of the parameters. Once the parser encounters the end of a message, it sends the message object as is for further processing (usually to the WorldView). | The built in parser is created by JFlex and has a rather nasty internals. However, unless you are trying to achieve something special, you will not need to look into it. Whenever the built-int parser encounters a message name it does not recognize, it calls protected method ''tryParsingUnprocessedMessage'' if it returns a message instance, the parser treats the message as recognized and passes all subsequent parameters of the message to ''tryParsingUnprocessedMessageParameter'' method. Note that, by design of gamebots protocol, all parameters are optional, so you cannot rely on the fact that all message parameters will be set, neither can you rely on the order of the parameters. Once the parser encounters the end of a message, it sends the message object as is for further processing (usually to the WorldView). |
| |
An example parser, that allows to parse the above message follows: | An example parser, that allows to parse the above message follows: |
| |
} | } |
| </code> |
| |
| ===== Running the bot ===== |
| |
| Now you can run you bot with following code (it is nearly the same as the default startup code, only |
| the module is replaced with our custom module): |
| |
| <code java> |
| UDKBotRunner runner = new UDKBotRunner(new SpyVsSpyBotModule(<<YOURBOTCLASS>>.class), "SpyVsSpy"); |
| runner.setMain(true); |
| runner.startAgent(); |
| |
</code> | </code> |
| |