Shard 0.4/dev - Page 6

Shard 0.4/dev

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: Shard

Post by Satirik »

KaiserJ wrote:time spent developing EVOrts : thousands of hours

time spent developing shard : thousands of hours

time spent watching my drunken friend get beaten by shard over and over again after talking shit about how good he was going to be at a game he hadn't yet played and AI opponents in general : priceless
i doubt that
User avatar
KaiserJ
Community Representative
Posts: 3113
Joined: 08 Sep 2008, 22:59

Re: Shard

Post by KaiserJ »

i can see why you'd doubt it, but i really DO have a friend IRL
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard

Post by AF »

Hes right, I count shard dev time < 100 hours!

But yes, Satirik, go away, shooo !!!
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard

Post by AF »

  • Added a new api.lua with a proxy object implementing game
  • Added a preload folder, and moved api.lua, class.lua, and aibase.lua into it
  • game:GetEnemies() now returns the enemy units in a normal lua table
animusmontus
Posts: 3
Joined: 10 May 2010, 07:13

Re: Shard

Post by animusmontus »

AF is there a source code download so I can compile on a linux system.
slogic
AI Developer
Posts: 626
Joined: 17 Mar 2008, 19:03

Re: Shard

Post by slogic »

AF wrote:note: No source available till post July ( academic restrictions ), currently only x86 windows builds available
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Shard

Post by Forboding Angel »

Shard makes me hard.

hurr hurr ;p
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Re: Shard

Post by Neddie »

http://springrts.com/phpbb/viewtopic.php?f=15&t=19583

Please modify your entry or add a new one to this thread to keep track of your current AI development.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard

Post by AF »

Added to game:

Code: Select all

function GetResource(idx) --  returns a Resource object
function GetResourceCount() -- return the number of resources
function GetResource(name) -- returns a Resource object, takes the name of the resource
And the resource object in question:

Code: Select all

	Resource {
		name,
		income,
		usage,
		capacity, --  how much we can store (-1 for unlimited)
		reserves, -- how much is stored
		gameframe, -- the game frame these stats were recorded at
	},
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard

Post by AF »

http://darkstars.co.uk/2010/shard-0-25/

Ill push out 0.26 after I've gotten feedback that it works for everyone and update the first post
User avatar
Sgt Doom
Posts: 144
Joined: 19 Jun 2006, 10:52

Re: Shard

Post by Sgt Doom »

Tried out 0.25 on Battlecity V1, it played very well on BA, except for near the end where it sent it's commander straight at a pack of 30 AKs i had protecting the centre right mexes. It had radar coverage, and had encountered that little pack before, so i'm confident it knew they were there. The opposing team had the upper hand, they were slowly pushing me and my ally back, yet it decided to do something rather silly like that.

Might this have something to do with me running the multithreaded exe? I've heard a lot of things behave oddly with it, which is a shame because I need the extra core for the game to run smoother with larger numbers of AIs.

EDIT: On CorePrime_revision1, the opposing team of Shard AIs at the bottom of the map simply built one solar collector, then sent their commanders straight towards me and my allies.
Probably not the AI's fault entirely, every AI i've tried behaves oddly on that map, which is a damn shame.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard

Post by AF »

coreprime revision1 is a metal map no? There is a horrible flaw in krogothes metal spot detection algorithm. When I pointed it out it was ignored. Instead every single AI in this community has inherited that algorithm, and thus, that flaw.

The flaw involves scales of values. Krogothes algorithm looks and see 255 as max metal, and 0 as minimum metal. It then filters out everything below a threshold. The problem with this is that on some metal maps, areas have been added with extra metal. As a result, only these areas show up as extraction spots, and normal areas are ignored.

The fix for this, is not to base the minimum value on a value between 0-255, but on a minimum amount of actual metal extracted, in order to figure out the correct threshold to filter out. e.g. any spot which yields more than 0.6 metal.


Also Shard at the moment has no code to identify threats to the commander and retreat. Nobody has written any code for that yet.
User avatar
Sgt Doom
Posts: 144
Joined: 19 Jun 2006, 10:52

Re: Shard

Post by Sgt Doom »

Most of that went right over my head but ok D:
'tis a fun AI nonetheless
slogic
AI Developer
Posts: 626
Joined: 17 Mar 2008, 19:03

Re: Shard

Post by slogic »

How Lua coder is supposed to make CanAttack(unit) function? Is it possible to introduce basic tags common for all mods like: mobile, static, military (has weapons), air, land, naval, underwater, amphibious etc. and use them as filters in extended versions of GetEnemies(), GetFriendlies()? That would greatly simplify coding behaviours. Hm, also unit.CanReach(position) is important function which is absent.

Is it normal in Lua?

Code: Select all

function IsAttacker(unit)
	for i,name in ipairs(attackerlist) do
		if name == unit:Internal():Name() then
			return true
		end
	end
	return false
end
attackerlist is a hash table. Why not to access a reversed table (keys <=> values) or specify another standard of describing attackerlist.lua, so unit names are keys? Searching would be much faster and as i understand IsAttacker() can be called too often. Also you will automatically kill unnecessary duplicates in attackerlist.
SkyStar
Engines Of War Developer
Posts: 23
Joined: 08 Jul 2009, 15:05

Re: Shard

Post by SkyStar »

Each time I play this with CA or Evo I crash. So i picked this out of the infolog:

Code: Select all

[      0] <SkirmishAI: Shard  (team 1)>: ...ring\AI\Skirmish\Shard\0.25\ai\EvoRTS\behaviours.lua:1: attempt to index global 'ai' (a nil value)
stack traceback:
	[C]: ?
	[C]: ?
	...ring\AI\Skirmish\Shard\0.25\ai\EvoRTS\behaviours.lua:1: in main chunk
	[C]: in function 'require'
	...pring\AI\Skirmish\Shard\0.25\ai\behaviourfactory.lua:3: in main chunk
	[C]: in function 'require'
	D:\Spring\AI\Skirmish\Shard\0.25\ai\ai.lua:4: in main chunk
[      0] SkirmishAI (with team ID = 1): Cheating enabled!
[      0] ResourceMapAnalyzer by Krogothe, initialized for resource 0(Metal)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard

Post by AF »

I dont have much time on here.

Because attackers.lua is obsoleted by not bothering and instead defining AttackerBehaviour in the behaviours.lua, a change I will be enforcing sooner rather than later, and a far more optimal and consistent mechanism if I do say.

I'll also look into the CA/Evo problems when I get back home later this week.

Also, Im aware there are things that could be useful in the API but havent been added yet, I'm adding things as I go along, and there are things I plan to add soon I just haven't gotten around to, such as changing retrieval of spots to use the tables like I did with enemies, and adding support for retrieving a units resource usage/generation, for which the code in the binary is half written, hence why the callbacks where not added or documented in the 0.25 release in the ResourceUsage object.
Lagg
Posts: 1
Joined: 19 May 2010, 12:38

Re: Shard

Post by Lagg »

SkyStar wrote:Each time I play this with CA or Evo I crash. So i picked this out of the infolog:

Code: Select all

[      0] <SkirmishAI: Shard  (team 1)>: ...ring\AI\Skirmish\Shard\0.25\ai\EvoRTS\behaviours.lua:1: attempt to index global 'ai' (a nil value)
stack traceback:
	[C]: ?
	[C]: ?
	...ring\AI\Skirmish\Shard\0.25\ai\EvoRTS\behaviours.lua:1: in main chunk
	[C]: in function 'require'
	...pring\AI\Skirmish\Shard\0.25\ai\behaviourfactory.lua:3: in main chunk
	[C]: in function 'require'
	D:\Spring\AI\Skirmish\Shard\0.25\ai\ai.lua:4: in main chunk
[      0] SkirmishAI (with team ID = 1): Cheating enabled!
[      0] ResourceMapAnalyzer by Krogothe, initialized for resource 0(Metal)
I have the same problem when trying to run it on EvoRTS 440. And I wan't to run Shard against Al Ice and see how it goes! :D
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Shard

Post by Forboding Angel »

Same issues here
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard

Post by AF »

It is fixed in my personal builds. Overrides in CA and EvoRTS still used the old mechanism of ai:ExecuteGameFile() to load other lua files, which didn't work because they were themselves loaded using the lua 'require' method.

Replacing the lines fixed it.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard

Post by AF »

Considering the dev meeting minutes thread, whatever happens, future updates can always be found at my site http://www.darkstars.co.uk either in the Shard category or on the frontpage

http://darkstars.co.uk/blog/category/ai/shard/

Blogposts about Shard are also redistributed on http://www.evolutionrts.info and http://www.springinfo.info
Post Reply

Return to “AI”