Shard 0.4/dev
Moderators: hoijui, Moderators
Re: Shard 0.31.1 Not So Ballsey
An experimental MorphInto method has also been added to the engine unit object, it takes a unit type object as a parameter and returns true/false.
It's assumed the Morphing implementation takes the command ID 32210 and takes the unit definition ID as its first parameter. Thanks to Knorke for the help.
It's assumed the Morphing implementation takes the command ID 32210 and takes the unit definition ID as its first parameter. Thanks to Knorke for the help.
Re: Shard 0.31.1 Not So Ballsey
Here's 0.35RC1
http://www.darkstars.co.uk/downloads/vi ... d0.35RC.7z
This is built from git master, so it includes a raft of stability fixes and safeguards, the things I mentioned in the previous posts, and a lot of other small changes and architectural improvements.
Please use this build if you're developing with Shard or using it for your game, so that I can iterate quickly in the coming days.
http://www.darkstars.co.uk/downloads/vi ... d0.35RC.7z
This is built from git master, so it includes a raft of stability fixes and safeguards, the things I mentioned in the previous posts, and a lot of other small changes and architectural improvements.
Please use this build if you're developing with Shard or using it for your game, so that I can iterate quickly in the coming days.
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
GetMapFeatures() does not work:
[i called: game.map:GetMapFeatures() and map:GetMapFeatures() neither works]
[i called: game.map:GetMapFeatures() and map:GetMapFeatures() neither works]
Code: Select all
[f=0000500] <SkirmishAI: Shard 0.35RC (team 1)>: Wrong arguments for overloaded function 'IMap_GetMapFeatures'
Possible C/C++ prototypes are:
IMap::GetMapFeatures()
IMap::GetMapFeatures(Position,double)
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
Oh dear =( I will look into this when I get home.
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
Can you verify it used to work and doesn't now? ( and not that it never worked ), also does GetUnits work?
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
Nevermind I've cleared up the ambiguity
There's now:
map:GetMapFeaturesAt
game:GetResourceByName
Redownload via the same link and extract over the top
There's now:
map:GetMapFeaturesAt
game:GetResourceByName
Redownload via the same link and extract over the top
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
When calling that function:
it results in:
still does not work .-.
Code: Select all
local features = map:GetMapFeaturesAt(pos,5000)
Code: Select all
[f=0000500] <SkirmishAI: Shard 0.35RC (team 1)>: ...\_Spring\AI\Skirmish\Shard\0.35RC\ai\preload\api.lua:174: attempt to index local 'fv' (a userdata value)
stack traceback:
[C]: ?
[C]: ?
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
In api.lua replace it with:
My theory at the moment is that it could not handle the API returning no units. If true I'll modify the other functions accordingly, but I'm at work so I can't test atm
Code: Select all
function map:GetMapFeaturesAt(position,radius)
local m = game_engine:Map()
local fv = m:GetMapFeaturesAt(position,radius)
local f = {}
local i = 0
if fv:empty() then
fv = nil
return nil
else
while i < fv:size() do
table.insert(f,fv[i])
i = i + 1
end
fv = nil
return f
end
end
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
nope thats not it, i tried by grabbing all features on the map which has plenty of them. The error should be somwhere within the function since it has to do with the variable fv which is not even returned.
Also it would be really usefull to have not only a list of all functions that are available but also some example calls as there are some non intuitive things there.
Also it would be really usefull to have not only a list of all functions that are available but also some example calls as there are some non intuitive things there.
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
best thing to do if a call seems unintuitive to you, is to find out how it works yourself, and document it on your fork of spring on github, in this file:
https://github.com/spring/spring/blob/3 ... Callback.h
... that applies to calls from the spring AI Interface callback only, of course.
https://github.com/spring/spring/blob/3 ... Callback.h
... that applies to calls from the spring AI Interface callback only, of course.
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
fv is a C++ object wrapped by swig and then insulated via that proxy function so that what is returned is a pure lua table.
To be precise the fv object is of type std::vector<IMapFeature*>
My fix above works under the premise that iterating on an empty C++ STL container is never a good idea
To be precise the fv object is of type std::vector<IMapFeature*>
My fix above works under the premise that iterating on an empty C++ STL container is never a good idea
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
Code: Select all
std::vector<IMapFeature*> CSpringMap::GetMapFeaturesAt(Position p, double radius){
SAIFloat3 pos;
pos.x = p.x;
pos.y = p.y;
pos.z = p.z;
std::vector< IMapFeature*> mapFeatures;
std::vector<springai::Feature*> features = callback->GetFeaturesIn(pos,radius);
std::vector<springai::Feature*>::iterator i = features.begin();
for(;i != features.end(); ++i){
CSpringMapFeature* f = new CSpringMapFeature(callback,*i,game);
mapFeatures.push_back(f);
}
return mapFeatures;
}
Can I see the code you're using to make the call to map:GetMapFeaturesAt() ?
My only other suggestion so far is to replace:
Code: Select all
table.insert(f,fv[i])
Code: Select all
table.insert(f,fv:at(i))
Code: Select all
p = api.Position()
p.x = 0
p.y = 0
p.z = 0
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
I just called the function and assigned it to a new local variable, the same way it is done with "GetEnemies" in "attackhandler.lua".
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
So you're not passing any parameters in?
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
I tried with parameters and without neither worked
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
Can you send me your setup so I can debug without going back and forth?
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
there you go
- Attachments
-
- 0.35RC.7z
- (339.38 KiB) Downloaded 15 times
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
Hello all,
I'm new to the Forum, but have played Spring for the last 3 or 4 years,
and now i decide to write my own BA config for Shard, but i have a serious Problem:
My LUA skills are Bad...
I need your Help.
For my Build units i try to check how much units from a specific Typ are aleready build. (i.e. How many Solar Collectors are build)
Is there a way to count all units and see how many of them are Solar Collectors?
I Try fiddling arround with game:GetUnits, but i dont realy understand how it works. I am able to count all Units, but how can i find out how many are Solar Collectors
I have read through the Whole Thread, and looked into other Shard Config files, but i dont get it...
Maybe someone can explain it to me? In this Thread or via PN...
P.S. Sorry for my Bad englisch
I'm new to the Forum, but have played Spring for the last 3 or 4 years,
and now i decide to write my own BA config for Shard, but i have a serious Problem:
My LUA skills are Bad...
I need your Help.
For my Build units i try to check how much units from a specific Typ are aleready build. (i.e. How many Solar Collectors are build)
Is there a way to count all units and see how many of them are Solar Collectors?
I Try fiddling arround with game:GetUnits, but i dont realy understand how it works. I am able to count all Units, but how can i find out how many are Solar Collectors
I have read through the Whole Thread, and looked into other Shard Config files, but i dont get it...
Maybe someone can explain it to me? In this Thread or via PN...
P.S. Sorry for my Bad englisch
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
The way I would reccomend is:
AttackBehaviour also does very little too, when an attack is built, it says to the Attack Handler, I'm here, and waits. It does this every time the attack is idle.
All in all you should be able to go quite far with just modifying taskqueues for BA, but there are a lot of primitive simple behaviours that will help a lot.
- Add an empty module
- This module will have a table such that tableobject[unittype] = XofThisType
- Everytime a unit of yours is built, increment the number
- Decrement on unit death
- To get the number of units for say a corsolar, all you would need to do now is local solarCount = tableobject["corsolar"] or something similar.
AttackBehaviour also does very little too, when an attack is built, it says to the Attack Handler, I'm here, and waits. It does this every time the attack is idle.
All in all you should be able to go quite far with just modifying taskqueues for BA, but there are a lot of primitive simple behaviours that will help a lot.
Re: Shard 0.35RC1 & 0.31.1 Not So Ballsey
Hi AF,
first of all i have to Thank you for your great AI.
I played al lot of games against NTai a few years ago, but Shard is much better, i think.
I hope i can follow your instructions...
I have seen the 'Unit Inventory' stuff in the EvoRTS Config, but it seems very complex. (for me) I will try modify that functions for my BA Config if no one is angainst that.
Ah, and thanks for the quick Reply.
first of all i have to Thank you for your great AI.
I played al lot of games against NTai a few years ago, but Shard is much better, i think.
I hope i can follow your instructions...
I have seen the 'Unit Inventory' stuff in the EvoRTS Config, but it seems very complex. (for me) I will try modify that functions for my BA Config if no one is angainst that.
Ah, and thanks for the quick Reply.