Shard 0.4/dev
Moderators: hoijui, Moderators
Re: Shard 0.4/dev
I've made some changes to the code that may provide a more useful infolog.txt output, and catch some unexpected situations
https://github.com/tomjn/Shard/tree/master/data/ai
If you can replace your Shard data folder with the files from that location? I also tweaked how that behaviour works, so it may also correct the issue
Another question, does JW spawn additional units 100 or so frames into the game? And can you check if Shard tried to build anything? It may actually be the first building or unit built that has the issue, rather than the starting unit
https://github.com/tomjn/Shard/tree/master/data/ai
If you can replace your Shard data folder with the files from that location? I also tweaked how that behaviour works, so it may also correct the issue
Another question, does JW spawn additional units 100 or so frames into the game? And can you check if Shard tried to build anything? It may actually be the first building or unit built that has the issue, rather than the starting unit
Re: Shard 0.4/dev
Eh.. yes and no. Alot of gaia units are spawned and killed.
Re: Shard 0.4/dev
hmmm, I don't expect that would cause issues, can you let me know if the updated changes resolve things at your end?
Re: Shard 0.4/dev
Near similar error - which is suspicious.
I placed the updated files in the following folder:
C:\Users\PicassoCT\Documents\My Games\Spring\engines\103.0\AI\Skirmish\Shard\dev\ai
I placed the updated files in the following folder:
C:\Users\PicassoCT\Documents\My Games\Spring\engines\103.0\AI\Skirmish\Shard\dev\ai
Re: Shard 0.4/dev
Do you have the infolog.txt for the error?
Re: Shard 0.4/dev
No, im currently at a ritual human sacrifice. Ill post one, once the daemon has devoured the virgin.
http://paste.springfiles.com/view/41a5fe84
http://paste.springfiles.com/view/41a5fe84
- prandipadaro
- Posts: 98
- Joined: 19 Oct 2011, 22:38
Re: Shard 0.4/dev
I have start a little project in order to test ShardLua interface inside the springtutorialgame.
check the https://github.com/pandaro/springtutorialgame.sdd repo and follow issues, give me help and feedback
check the https://github.com/pandaro/springtutorialgame.sdd repo and follow issues, give me help and feedback
- prandipadaro
- Posts: 98
- Joined: 19 Oct 2011, 22:38
Re: Shard 0.4/dev
I start the implementation of ShardLua inside the springtutorialmod.sdd
- First i have update the shard data folder inside the engine at the last git version.
- Second i have added a folder called "STG" in .spring/games/springtutorialgame.sdd/LuaRules/Gadgets/ai/STG
- then i have copied Copy in attackers.lua, behaviours.lua, and taskqueues.lua inside /STG
But i cant see ShardLua listed in springlobby
This is cause i do not have the interface Lua (original one https://github.com/eronoobos/ShardSpringLua) i think.
What i gonna do now?
How can i add the shardLua interfaces bundled with shard? (data/ai/preload/spring_lua/)
- First i have update the shard data folder inside the engine at the last git version.
- Second i have added a folder called "STG" in .spring/games/springtutorialgame.sdd/LuaRules/Gadgets/ai/STG
- then i have copied Copy in attackers.lua, behaviours.lua, and taskqueues.lua inside /STG
But i cant see ShardLua listed in springlobby
This is cause i do not have the interface Lua (original one https://github.com/eronoobos/ShardSpringLua) i think.
What i gonna do now?
How can i add the shardLua interfaces bundled with shard? (data/ai/preload/spring_lua/)
Re: Shard 0.4/dev
I've never tried to get Shard running inside a game archive, I've never looked into how it would be done.
I will add though, that you don't need to create a subfolder to test that Shard runs. The subfolder system is there to override Shards files, if it's not there then Shard will run as a generic AI, which means it won't do very much at all. Most likely all that will happen is you'll see it spit out a message in infolog that announces it's running then nothing much else will happen
I will add though, that you don't need to create a subfolder to test that Shard runs. The subfolder system is there to override Shards files, if it's not there then Shard will run as a generic AI, which means it won't do very much at all. Most likely all that will happen is you'll see it spit out a message in infolog that announces it's running then nothing much else will happen
- prandipadaro
- Posts: 98
- Joined: 19 Oct 2011, 22:38
Re: Shard 0.4/dev
So, if I want to test ShardLua with springtutorialgame I do not need to create files in the game, but in the shard folder!, sorry, my fail!
I ask you:
I want to test ShardLua interface on springtutorialgame, what are the actions that I have to fulfill?
I ask you:
I want to test ShardLua interface on springtutorialgame, what are the actions that I have to fulfill?
Re: Shard 0.4/dev
Nooo I mean the whole subfolder to override Shard files for a game thing, you definitely need to put Shard inside the game.
So this folder:
https://github.com/tomjn/Shard/tree/master/data/ai
Is fine as is, you don't need to create another subfolder for each game, e.g. BA will still work without this folder:
https://github.com/tomjn/Shard/tree/master/data/ai/BA
But it won't do very much
So this folder:
https://github.com/tomjn/Shard/tree/master/data/ai
Is fine as is, you don't need to create another subfolder for each game, e.g. BA will still work without this folder:
https://github.com/tomjn/Shard/tree/master/data/ai/BA
But it won't do very much
¯\_(ツ)_/¯ No idea, never done it, never looked into it. Look at a game that's already done it ( no idea which games have already done it ). Eronoobos will know more. I can provide little to no help here, I'm more likely to ask you questions about itI want to test ShardLua interface on springtutorialgame, what are the actions that I have to fulfill?
- prandipadaro
- Posts: 98
- Joined: 19 Oct 2011, 22:38
Re: Shard 0.4/dev
this is funny.
I will use your ShardLua interface, cause is the one that will be maintained in the future, not the one of eronoobos.
So you don't know how to use?
i ask you only how to use the function of Shard/tree/master/data/ai/preload/spring_lua
no more.
I will use your ShardLua interface, cause is the one that will be maintained in the future, not the one of eronoobos.
So you don't know how to use?
i ask you only how to use the function of Shard/tree/master/data/ai/preload/spring_lua
no more.
Re: Shard 0.4/dev
That interface provides the means for Shard to use the Spring Gadget API, but it does something needs to load and create an instance of Shard, and pass events to it.
That part is missing.
I can infer a few things based on a read of Eronoobos' work, I can infer that this file is what SpringLobby needs to pick up Shard:
https://github.com/eronoobos/ShardSprin ... /LuaAI.lua
And that a fork of Shard is located at:
https://github.com/eronoobos/ShardSprin ... gadgets/ai
This file acts as a gadget, and is the LuaAI that gets loaded:
https://github.com/eronoobos/ShardSprin ... Loader.lua
The file appears to do all the things that `boot.lua` was designed to do, as well as some other things, including creating each Shard AI and passing it events:
https://github.com/eronoobos/ShardSprin ... r.lua#L130
I would hope that less of this is necessary with the official Shard AI due to the refactors that have taken place. The intended use is that an object is created, e.g.
And then, on events, a unit is converted into the Shard API type of unit like this:
Similar functions are necessary to translate other data passing into Shard. The API layer mentioned previously already does this for the engine APIs.
Study AILoader.lua, it appears that some additional steps are necessary, such as tracking multiple Shards ( 1 for each instance/player ), as well as differentiating between UnitDestroyed or EnemyDestroyed based as the engine does not appear to do that for you
That part is missing.
I can infer a few things based on a read of Eronoobos' work, I can infer that this file is what SpringLobby needs to pick up Shard:
https://github.com/eronoobos/ShardSprin ... /LuaAI.lua
And that a fork of Shard is located at:
https://github.com/eronoobos/ShardSprin ... gadgets/ai
This file acts as a gadget, and is the LuaAI that gets loaded:
https://github.com/eronoobos/ShardSprin ... Loader.lua
The file appears to do all the things that `boot.lua` was designed to do, as well as some other things, including creating each Shard AI and passing it events:
https://github.com/eronoobos/ShardSprin ... r.lua#L130
I would hope that less of this is necessary with the official Shard AI due to the refactors that have taken place. The intended use is that an object is created, e.g.
Code: Select all
shardai = AI()
Code: Select all
shardunit = shardify_unit( unitID )
shardai:unitcreated( shardunit )
Study AILoader.lua, it appears that some additional steps are necessary, such as tracking multiple Shards ( 1 for each instance/player ), as well as differentiating between UnitDestroyed or EnemyDestroyed based as the engine does not appear to do that for you
Re: Shard 0.4/dev
This file seems to implement a number of translation functions:
https://github.com/eronoobos/ShardSprin ... /shard.lua
Systematising this would be useful so that these aren't dangling functions in the global namespace
https://github.com/eronoobos/ShardSprin ... /shard.lua
Systematising this would be useful so that these aren't dangling functions in the global namespace
Re: Shard 0.4/dev
After one threat page - just to communicate the near same amount of information - one picture:
- Attachments
-
- Expected-Folders-and-Files-.jpg
- (495.44 KiB) Not downloaded yet
Re: Shard 0.4/dev
That is incorrect
For the Native Shard that comes bundled with spring,
If Shard is located at: spring/engines/103.0/AI/SKIRMISH/Shard/dev/AI
Then Shard will search for files here: spring/engines/103.0/AI/SKIRMISH/Shard/dev/AI
and here: spring/engines/103.0/AI/SKIRMISH/Shard/dev/AI/SHORTGAME
Where shortgame is the shortened internal name of the game. Shard doesn't use Springs file system, and has no concept of .sdd files, game folders etc. All it knows is its own folder. By folder I mean folder on the disk as the Operating system sees it, not as Spring sees it.
This is not the case for a LuaAI running Shard which is what Eronoobos built, and what Prandipadaro is working on.
Shard does not need the subfolder to run, but it is unlikely to do anything. You should not recieve any errors, the worst case scenario is that you see Shard announce itself in the infolog.txt then do nothing with the units it's given
For the Native Shard that comes bundled with spring,
If Shard is located at: spring/engines/103.0/AI/SKIRMISH/Shard/dev/AI
Then Shard will search for files here: spring/engines/103.0/AI/SKIRMISH/Shard/dev/AI
and here: spring/engines/103.0/AI/SKIRMISH/Shard/dev/AI/SHORTGAME
Where shortgame is the shortened internal name of the game. Shard doesn't use Springs file system, and has no concept of .sdd files, game folders etc. All it knows is its own folder. By folder I mean folder on the disk as the Operating system sees it, not as Spring sees it.
This is not the case for a LuaAI running Shard which is what Eronoobos built, and what Prandipadaro is working on.
Shard does not need the subfolder to run, but it is unlikely to do anything. You should not recieve any errors, the worst case scenario is that you see Shard announce itself in the infolog.txt then do nothing with the units it's given
Re: Shard 0.4/dev
Shard now has an AILoader.lua gadget, and should run as a LuaAI if you copy the files in the right place and put a LuaAI.lua in the archive root.
BA mutator containing Shard McShardFace attached as an example, you may encounter issues using it
BA mutator containing Shard McShardFace attached as an example, you may encounter issues using it
- Attachments
-
- mcshardface.sdz
- (202.61 KiB) Downloaded 23 times
-
- shard_paulson.PNG
- (1.01 MiB) Not downloaded yet
Re: Shard 0.4/dev
Currently working on a new building placement algorithm at https://github.com/tomjn/Shard/pull/144
Currently it uses the game engines closestbuildsite in shard native, and when running as a gadget in a game it uses an algorithm taken I think from CRAIG that tests positions using expanding circles. This one does it in an outwards square spiral on a custom grid, and tries to do the iterations spread out over multiple game frames so as to not lag things out
Usage should be something like this:
For a working example, see the taskqueuebehaviour in the pull request
Currently it uses the game engines closestbuildsite in shard native, and when running as a gadget in a game it uses an algorithm taken I think from CRAIG that tests positions using expanding circles. This one does it in an outwards square spiral on a custom grid, and tries to do the iterations spread out over multiple game frames so as to not lag things out
Usage should be something like this:
Code: Select all
function onSuccess( job, pos )
-- build something I guess
end
function onFail( job )
-- nowhere to place it, do something else then?
end
local unittype = ...
local job = {
start_position=[x=1,y=2,z=3],
max_radius=1500,
onSuccess=onSuccess,
onFail=onFail,
unittype=unittype,
cleanup_on_unit_death=builderID
}
local success = ai.placementhandler.NewJob( job )
if success then
-- the job has been schedule, do whatever else we need to do in parallel
-- when a position has been found, it will call the callback function we passed it
-- in the future a promise will be returned letting us define what happens
else
-- there was something wrong with our job and the system rejected it
-- the programmer should probably check all the values that went into the job were set and valid
end
Re: Shard 0.4/dev
Placement algorithm had some updates, now has a debug widget too, and checks for spacing using a basic heuristic.
Now that it's working and can be seen visually, the timing mechanism needs implementing, but, it's not so bad as it is currently and since it's asynchronous the hardcoded iterations act as a cap on max cpu usage
Additionally, these changes aren't fully compatible with the native Shard implementation. Some minor modifications might fix that, but all the interesting Shard activity is happening in Evo/BA right now as Lua AIs, and running a C++ codebase is more work with no benefit for me
Now that it's working and can be seen visually, the timing mechanism needs implementing, but, it's not so bad as it is currently and since it's asynchronous the hardcoded iterations act as a cap on max cpu usage
Additionally, these changes aren't fully compatible with the native Shard implementation. Some minor modifications might fix that, but all the interesting Shard activity is happening in Evo/BA right now as Lua AIs, and running a C++ codebase is more work with no benefit for me