playerData and startPositions

For AI and campaign script related discussions and questions
Post Reply
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

playerData and startPositions

Post by aubergine »

playerData

I assume the indexes in this array directly correlate to player id's? So playerData[me] == my player data?

What are the possible values for the .colour property? Is it numbers or strings? If strings, how do I localise them - using the _() function? How is colour defined - team, starting position, something else?

I assume the .position property can be used to cross-reference with startPositions to get x,y of that position?

What are the possible values for .team property? What happens if the game is using dynamic alliances (alliancesType == ALLIANCES) - the object won't get updated? Considering the presence of allianceExistsBetween() function, is there any need for the .team property in the playerData array? Or does this property only apply when alliancesType = ALLIANCES_TEAMS to state the team name (eg. A, B, C, etc)?

startPositions

Is this array indexed by the player id, or by the start position on the map?

Eg. if player 4 is in position 2, to get the start position of player 4 do I:

a) startPositions[playerData[4].position]

or

b) startPositions[4]

Sorry for all the questions. I'm documenting as I go :)
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: playerData and startPositions

Post by Per »

Both playerData and startPositions are indexed by player id. Ignore colour for now, it is not useful the way it is (it is an index into a colour array which is not accessible). The position property can be used to figure out where on a map you start, if you know the map and its starting positions already somehow. The team property may not be useful, either. It is only applicable if alliancesType == ALLIANCES_TEAMS, and it is an integer value.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: playerData and startPositions

Post by NoQ »

It might be a funny idea to make an AI that behaves differently depending on its color. Yellow AI loves New Paradigm bodies, etc.
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: playerData and startPositions

Post by Emdek »

NoQ, a bit like factions?
Yeah, that would be interesting, but I would say that this should be cheating AI, using specified bodies (and propulsion) from start (without real research, maybe weapons should be researched normal way), but begin with light ones and then (depending on elapsed time or opponents strength or actions) would switch to medium and heavy ones.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: playerData and startPositions

Post by NoQ »

Yeah, this is a nice idea too (:
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: playerData and startPositions

Post by aubergine »

@per: is there any reason for separating out playerData and startPositions in that case? why not just put the start positions in to playerData?

Also, if I'm on a 4 player map, but there are only 2 active players, how do I work out the starting positions of the 2 empty slots?

And on the subject of player data: http://developer.wz2100.net/ticket/3123

@NoQ: That sort of thing could lead to a new way to make AIs more dynamic - based on their starting position, colour, date, map, etc., they could choose different "personalities".
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Post Reply