Please can you apply a patch, "New Java AI 'HughAI'
Moderator: Moderators
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Please can you apply a patch, "New Java AI 'HughAI'
Please can you apply a patch, "New Java AI 'HughAI'
http://springrts.com/mantis/view.php?id=1623
It runs. It shows off lots of concepts that can be used in other AIs, copy and pasted, forked, and so on:
- GUI, using Swing, with registration pattern, so classes can register a button, and a handler method, with the GUI, and this will automatically add a button to the GUI
- lots of maps:
- losmap: updated during exploration, showing which areas have been explored
- metal spot map
- enemy map
- movement area map: very interesting map: if two points have the same area number, then a unit can move between them freely: there are no obstructions, such as mountains. There are movement area maps for infantry, vehicles, and boats
- the maps each have a GUI button to draw them onto the terrain
- events:
- AI events can be subscribed to
- more abstracted events, such as unit events, enemy tracker events, and so on
It uses hoijui's Java Interface v0.1.
http://springrts.com/mantis/view.php?id=1623
It runs. It shows off lots of concepts that can be used in other AIs, copy and pasted, forked, and so on:
- GUI, using Swing, with registration pattern, so classes can register a button, and a handler method, with the GUI, and this will automatically add a button to the GUI
- lots of maps:
- losmap: updated during exploration, showing which areas have been explored
- metal spot map
- enemy map
- movement area map: very interesting map: if two points have the same area number, then a unit can move between them freely: there are no obstructions, such as mountains. There are movement area maps for infantry, vehicles, and boats
- the maps each have a GUI button to draw them onto the terrain
- events:
- AI events can be subscribed to
- more abstracted events, such as unit events, enemy tracker events, and so on
It uses hoijui's Java Interface v0.1.
Re: Please can you apply a patch, "New Java AI 'HughAI'
They dont accept new AIs in there git repo.
You need to create your own git repo for your AI and give them the link.
They take a look and if its alright they add your repo as a submodule to git.
You need to create your own git repo for your AI and give them the link.
They take a look and if its alright they add your repo as a submodule to git.
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Please can you apply a patch, "New Java AI 'HughAI'
Ok, do you have more details on how I do this, Agon?
I'm guessing I create an account on github, fork the Spring repository, and add my AI into the Spring fork? Or... ?
Hugh
I'm guessing I create an account on github, fork the Spring repository, and add my AI into the Spring fork? Or... ?
Hugh
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Please can you apply a patch, "New Java AI 'HughAI'
Created a github repository, just containing HughAI, here:
git://github.com/hughperkins/HughAI.git
git://github.com/hughperkins/HughAI.git
Re: Please can you apply a patch, "New Java AI 'HughAI'
there are two options - either fork the spring repo or just put your code in there and use it as a git submodule. see error323's repo for an example.
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Please can you apply a patch, "New Java AI 'HughAI'
Ok, so the option of using a git submodule sounds cool.
A repository has been created, so I think it just needs someone to type in:
git submodule add git://github.com/hughperkins/HughAI.git AI/Skirmish/HughAI
Alternatively, I've added a patch file for .gitmodules to the mantis bug report at http://springrts.com/mantis/view.php?id=1623 , but I'm not 100% sure that that is sufficient to add the submodule?
Hugh
A repository has been created, so I think it just needs someone to type in:
git submodule add git://github.com/hughperkins/HughAI.git AI/Skirmish/HughAI
Alternatively, I've added a patch file for .gitmodules to the mantis bug report at http://springrts.com/mantis/view.php?id=1623 , but I'm not 100% sure that that is sufficient to add the submodule?
Hugh
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Please can you apply a patch, "New Java AI 'HughAI'
Hi,
Could someone run a submodule update on HughAI please?
Hugh
Could someone run a submodule update on HughAI please?
Hugh
Re: Please can you apply a patch, "New Java AI 'HughAI'
i did, i would have done so yesterday, but it seemed you forgot to push
.

- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Please can you apply a patch, "New Java AI 'HughAI'
Thanks!
Don't suppose... could I grab another bump up in version? Latest commit: today:
http://github.com/hughperkins/HughAI/co ... 21ccde3c8b
corresponds to this release:
http://springrts.com/phpbb/viewtopic.ph ... 93#p380393
Don't suppose... could I grab another bump up in version? Latest commit: today:
http://github.com/hughperkins/HughAI/co ... 21ccde3c8b
corresponds to this release:
http://springrts.com/phpbb/viewtopic.ph ... 93#p380393
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Please can you apply a patch, "New Java AI 'HughAI'
concerning side manager:
in Java:
Code: Select all
const char* (CALLING_CONV *Clb_Game_getTeamSide)(int teamId, int otherTeamId);
Code: Select all
String side = callback.getGame().getTeamSide(teamId);
Re: Please can you apply a patch, "New Java AI 'HughAI'
by coincident, it crashed in exactly this class that.. as it seems, is not needed :D
edit: therefore, i am waiting with pumping version
(with revision e18a3d43730ffa6e45250722d9218e27fe9f54d2 of HugAI and current spring master)0 ms INFO: Hugh AI started v0.0012, team 1 map Brazillian_Battlefield.smf mod Balanced Annihilation V7.01
0 ms INFO: SideManager: start script:
0 ms INFO: SideManager: our team number: 1
0 ms INFO: Exception: java.lang.NullPointerException java.lang.NullPointerException
at hughai.unitdata.SideManager.init(SideManager.java:55)
at hughai.unitdata.SideManager.<init>(SideManager.java:39)
at hughai.PlayerObjects.getSideManager(PlayerObjects.java:195)
at hughai.utils.Config.getConfigPath(Config.java:176)
at hughai.utils.ConfigHelper.loadConfig(ConfigHelper.java:58)
at hughai.utils.Config.init(Config.java:163)
at hughai.PlayerObjects.getConfig(PlayerObjects.java:118)
at hughai.CSAI.init(CSAI.java:149)
at hughai.loader.HughAILoader.init(HughAILoader.java:86)
at com.springrts.ai.oo.OOAIFactory.handleEvent(OOAIFactory.java:81)
0 ms INFO: csai.registershutdownhandler MainUI
0 ms INFO: MainUI: addpaneltotabbedpanel Exceptions
edit: therefore, i am waiting with pumping version
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Please can you apply a patch, "New Java AI 'HughAI'
Hi hoijui,
Thanks for looking at this.
Hmmm, it's strange that that crashes, but still, using the tdf, parsing it and so on is vastly more complicated than a single function call, so it does make sense to use the single function call when that exists :-D
commit 83b9d61ebeab3d0b7e78cad34ca49803a02279cb should use the aicallback function call rather than the parsing tdf start script method.
Hugh
Thanks for looking at this.
Hmmm, it's strange that that crashes, but still, using the tdf, parsing it and so on is vastly more complicated than a single function call, so it does make sense to use the single function call when that exists :-D
commit 83b9d61ebeab3d0b7e78cad34ca49803a02279cb should use the aicallback function call rather than the parsing tdf start script method.
Hugh
Re: Please can you apply a patch, "New Java AI 'HughAI'
nice, no more crash 
but when playing as Core (Arm not tested), the commander stays there doing nothing.
team log:
http://pastebin.com/m669aeae9

but when playing as Core (Arm not tested), the commander stays there doing nothing.
team log:
http://pastebin.com/m669aeae9
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Please can you apply a patch, "New Java AI 'HughAI'
Oh... it's still not detecting the side:
It should say something like:
Code: Select all
0 ms INFO: SideManager: our team number: 1
0 ms INFO: SideManager: Our side:
Code: Select all
0 ms INFO: SideManager: our team number: 1
0 ms INFO: SideManager: Our side: core
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Please can you apply a patch, "New Java AI 'HughAI'
I thought maybe because it is playing as team 1, but in a test game here, even as team 1, HughAI gets the side ok:
The strange thing is, in the logfile from the game on your pc, the teamnumber is detected correctly, but for some reason the getGame().getTeamSide() seems to have returned a blank value.
Maybe something different in the game setup? In tests here, they've almost always been set up as one ai vs another ai, with a single human spectator. What game setup are you using for the tests?
Code: Select all
0 ms INFO: SideManager: start script:
0 ms INFO: SideManager: our team number: 1
0 ms INFO: SideManager: Our side: arm
Maybe something different in the game setup? In tests here, they've almost always been set up as one ai vs another ai, with a single human spectator. What game setup are you using for the tests?
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Please can you apply a patch, "New Java AI 'HughAI'
Oh! I have an idea! Perhaps in your start script, the side is not being specified at all? So, it defaults to core when spring starts, but then neither reading the tdf nor calling aicallback.getmap().getteamside() work ok?
I kind of think I should probably shift to irc for this to-and-fro
Maybe in a sec...
I kind of think I should probably shift to irc for this to-and-fro
