Team Colours Mod

Talk about general things concerning Forged Alliance Forever.

Moderators: FtXCommando, Ze Dogfather

Re: Team Colours Mod

Postby CookieNoob » 30 May 2017, 13:40

if this cant be done as a UI mod, maybe integrate it for replays in the main game. The "toggle team color" button does nothing when you are an observer and it would be really great for casting.

I imagine something like this: (totalnumber is number of teams + something)
Code: Select all
pickcolor = function(army, i, totalnumber)
    local red   = math.sin(math.pi*i/totalnumber) * 127 + 128
    local green = math.sin(math.pi*i/totalnumber+2*math.pi/3) * 127 + 128
    local blue  = math.sin(math.pi*i/totalnumber+4*math.pi/3) * 127 + 128
    SetArmyColor(army,red,green,blue)
end


and in the button (here: https://github.com/FAForever/fa/blob/c9 ... on.lua#L82) something like this:
Code: Select all
local sortedArmyList
local totalnumber = table.getn(ListArmies()) + 2 * NumberOfTeams
for i, army in sortedArmyList do
    pickcolor(army, i, totalnumber)
end


(need to check how to get the teamnumber for the players, so the sorting and counting of the teams is a bit sketchy for now)
Check out the next level of maps: viewtopic.php?f=53&t=13014
For adaptivity, customizability and less clutter in the vault.
User avatar
CookieNoob
Priest
 
Posts: 477
Joined: 02 Aug 2014, 17:07
Has liked: 65 times
Been liked: 249 times
FAF User Name: CookieNoob

Re: Team Colours Mod

Postby nine2 » 30 May 2017, 14:45

sounds good.

The way I picked the colours is I divided the available colour space into something like 24 preset colours. Then the algorithm would assign colours "near" colours if they were on same team. It would put a big colour gap in between teams, as much as possible.... depends how many teams in the game. Worked nice.

As for when this should happen, I was thinking it should be a lobby option that the host can hit to overwrite everyone's colour selections. I like your idea of using toggle team colour but I don't think you can actually do it ... shader/engine/c++/untouchable.
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Team Colours Mod

Postby nine2 » 30 May 2017, 14:47

Code: Select all

SetArmyColor(1,128,128,38)

SetArmyColor(3,191,158,57)

SetArmyColor(5,128,83,38)

SetArmyColor(7,191,91,57)

SetArmyColor(9,128,38,38)

SetArmyColor(2,128,38,128)

SetArmyColor(4,158,57,191)

SetArmyColor(6,83,38,128)

SetArmyColor(8,91,57,191)

SetArmyColor(10,38,38,128)


Hmm or maybe you can. Don't remember this but just found this code
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Team Colours Mod

Postby nine2 » 30 May 2017, 14:53

Image
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Team Colours Mod

Postby nine2 » 30 May 2017, 14:54

^ examples of how my test app makes colours based on players and teams
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Team Colours Mod

Postby CookieNoob » 30 May 2017, 14:55

shader can be changed very easily :) but yea, the engine (which strangely manages the TeamColorMode) cant be changed. However, when we just add this stuff I suggested to the OnCheck function of the button after the engine function is called, we can just overwrite the teamcolors set by the engine for the case that it's a replay and then use the engine function to go back if needed.

Having large gaps inbetween the colors for the players was also my idea which is why I added this "+ 2 * NumberOfTeams" part to the total number. I didnt add the sorting stuff for the teams yet and when I implement it, I'll use a 2 dimensional list probably (with a nested loop). After one team is completed, I will just add the 2 to the color index and the gap should be sufficient.
Between players it would be pi/totalnumber and between teams it would be 3*pi/totalnumber (can easily be changed later)
Check out the next level of maps: viewtopic.php?f=53&t=13014
For adaptivity, customizability and less clutter in the vault.
User avatar
CookieNoob
Priest
 
Posts: 477
Joined: 02 Aug 2014, 17:07
Has liked: 65 times
Been liked: 249 times
FAF User Name: CookieNoob

Re: Team Colours Mod

Postby nine2 » 30 May 2017, 23:11

Cool
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Team Colours Mod

Postby CookieNoob » 31 May 2017, 00:21

actually its harder to do than I thought :/

In a replay the command stream for sim stuff exclusively comes from the replay file and any sim input from the UI is ignored. The code works in a normal game (it changes the color for everyone though, so its not an option) and when loading it from some sim function. I dont know yet how to check if its a replay from the sim layer so dunno. I will have a look at it again later.
Check out the next level of maps: viewtopic.php?f=53&t=13014
For adaptivity, customizability and less clutter in the vault.
User avatar
CookieNoob
Priest
 
Posts: 477
Joined: 02 Aug 2014, 17:07
Has liked: 65 times
Been liked: 249 times
FAF User Name: CookieNoob

Previous

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest