Forged Alliance Forever Forged Alliance Forever Forums 2017-05-31T00:21:05+02:00 /feed.php?f=2&t=8484 2017-05-31T00:21:05+02:00 2017-05-31T00:21:05+02:00 /viewtopic.php?t=8484&p=149958#p149958 <![CDATA[Re: Team Colours Mod]]>
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.

Statistics: Posted by CookieNoob — 31 May 2017, 00:21


]]>
2017-05-30T23:11:28+02:00 2017-05-30T23:11:28+02:00 /viewtopic.php?t=8484&p=149953#p149953 <![CDATA[Re: Team Colours Mod]]> Statistics: Posted by nine2 — 30 May 2017, 23:11


]]>
2017-05-30T14:55:58+02:00 2017-05-30T14:55:58+02:00 /viewtopic.php?t=8484&p=149919#p149919 <![CDATA[Re: Team Colours Mod]]> 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)

Statistics: Posted by CookieNoob — 30 May 2017, 14:55


]]>
2017-05-30T14:54:20+02:00 2017-05-30T14:54:20+02:00 /viewtopic.php?t=8484&p=149918#p149918 <![CDATA[Re: Team Colours Mod]]> Statistics: Posted by nine2 — 30 May 2017, 14:54


]]>
2017-05-30T14:53:39+02:00 2017-05-30T14:53:39+02:00 /viewtopic.php?t=8484&p=149917#p149917 <![CDATA[Re: Team Colours Mod]]>

Statistics: Posted by nine2 — 30 May 2017, 14:53


]]>
2017-05-30T14:47:45+02:00 2017-05-30T14:47:45+02:00 /viewtopic.php?t=8484&p=149916#p149916 <![CDATA[Re: Team Colours Mod]]>
Code:

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

Statistics: Posted by nine2 — 30 May 2017, 14:47


]]>
2017-05-30T14:45:18+02:00 2017-05-30T14:45:18+02:00 /viewtopic.php?t=8484&p=149915#p149915 <![CDATA[Re: Team Colours Mod]]>
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.

Statistics: Posted by nine2 — 30 May 2017, 14:45


]]>
2017-05-30T13:40:52+02:00 2017-05-30T13:40:52+02:00 /viewtopic.php?t=8484&p=149914#p149914 <![CDATA[Re: Team Colours Mod]]>
I imagine something like this: (totalnumber is number of teams + something)
Code:
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:
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)

Statistics: Posted by CookieNoob — 30 May 2017, 13:40


]]>
2014-09-15T09:56:37+02:00 2014-09-15T09:56:37+02:00 /viewtopic.php?t=8484&p=80688#p80688 <![CDATA[Re: Team Colours Mod]]>
partytime wrote:
I'm totally not up for the task (I'm a lowly c# programmer).

I stared at it for half an hour ... so what, you are rewriting over the original FA binary with a few changes with assembler and c++ to patch in the changes you want? That's pretty awesome, and I could never do that, and I'm super impressed.

Even then it still doesn't entirely get me what I want, which is a user-specific setting .. if I did it that way I wouldn't need cheats activated but one player would be activating it for all, I am pretty sure, in which case I think I should just be trying to make a lobby option that the host can set to override custom colour choices - ie: do it in the pre-game setup somehow.


Sorry for my slow replying. Need to setup notifications for threads I've posted to :)

That won't work, since the player-chosen colours are stored in the sim. So if each client has their own version it's a desync.

Statistics: Posted by Sheeo — 15 Sep 2014, 09:56


]]>
2014-09-12T17:37:19+02:00 2014-09-12T17:37:19+02:00 /viewtopic.php?t=8484&p=80514#p80514 <![CDATA[Re: Team Colours Mod]]>
I stared at it for half an hour ... so what, you are rewriting over the original FA binary with a few changes with assembler and c++ to patch in the changes you want? That's pretty awesome, and I could never do that, and I'm super impressed.

Even then it still doesn't entirely get me what I want, which is a user-specific setting .. if I did it that way I wouldn't need cheats activated but one player would be activating it for all, I am pretty sure, in which case I think I should just be trying to make a lobby option that the host can set to override custom colour choices - ie: do it in the pre-game setup somehow.

Statistics: Posted by nine2 — 12 Sep 2014, 17:37


]]>
2014-09-12T15:36:38+02:00 2014-09-12T15:36:38+02:00 /viewtopic.php?t=8484&p=80508#p80508 <![CDATA[Re: Team Colours Mod]]>
partytime wrote:
Thanks for your time Sheeo.

I think the actual calls to SetArmyColor are somehow baked into the replay because when I watch the replay with a 2nd version of the mod with different colours, it still appears with the old colours. I think.

I understand how you're giving me a better way of putting this into the sim layer, but really what I want is for each player to individually (or not) set their view mode via their own ui. So you and I are both playing the same game but I see in teamColors mode and you see in normal mode, and I could turn teamColors mode off after a while. Ideally, you wouldn't even have to have the mod installed and I could still override how I see the game via a ui mod. I guess what I want is impossible, can you confirm?


You're welcome :)

As a UI-mod only, with the current fa binary, it's most likely impossible. I haven't really checked myself, but if that function is engine-side then yes.

If you're up for the task, I have just made this repository public: https://github.com/Sheeo/FAShared

It contains code that hooks into the engine and allows us to modify the AllowedCommandSources list for armies, thus allowing coop-style play without having cheats enabled. Hooking into the function that sets colours for armies user-side should be possible.

Statistics: Posted by Sheeo — 12 Sep 2014, 15:36


]]>
2014-09-12T10:43:39+02:00 2014-09-12T10:43:39+02:00 /viewtopic.php?t=8484&p=80499#p80499 <![CDATA[Re: Team Colours Mod]]> Statistics: Posted by Mr-Smith — 12 Sep 2014, 10:43


]]>
2014-09-12T07:09:13+02:00 2014-09-12T07:09:13+02:00 /viewtopic.php?t=8484&p=80494#p80494 <![CDATA[Re: Team Colours Mod]]> Statistics: Posted by BushMaster — 12 Sep 2014, 07:09


]]>
2014-09-10T13:18:40+02:00 2014-09-10T13:18:40+02:00 /viewtopic.php?t=8484&p=80363#p80363 <![CDATA[Re: Team Colours Mod]]>
I think the actual calls to SetArmyColor are somehow baked into the replay because when I watch the replay with a 2nd version of the mod with different colours, it still appears with the old colours. I think.

I understand how you're giving me a better way of putting this into the sim layer, but really what I want is for each player to individually (or not) set their view mode via their own ui. So you and I are both playing the same game but I see in teamColors mode and you see in normal mode, and I could turn teamColors mode off after a while. Ideally, you wouldn't even have to have the mod installed and I could still override how I see the game via a ui mod. I guess what I want is impossible, can you confirm?

Statistics: Posted by nine2 — 10 Sep 2014, 13:18


]]>
2014-09-10T09:37:55+02:00 2014-09-10T09:37:55+02:00 /viewtopic.php?t=8484&p=80355#p80355 <![CDATA[Re: Team Colours Mod]]>
partytime wrote:
- is SimCallback the correct way to do 'cheats' without cheats enabled?


Making a simcallback enables anyone to call that function from the user side. This has the side effect of players being able to call that function whenever, thus changing their own army colour (Perhaps others, if neither that one or your function does validation).

partytime wrote:
- is there any way to change army colours without going through this SetArmyColor?


Unlikely, but you should just use it from within the sim. Don't mod user side at all.

partytime wrote:
- is there any way to make it so my simcallback and setarmycolor calls are not recorded into the replay?


How is it recorded into the replay?

partytime wrote:
- is there anything else I can do to get this to work?Thanks!


Hook into the function BeginSession() in '/lua/simInit.lua'. Run your team-colour setting code after that function is done setting up teams and effect markers etc.

Statistics: Posted by Sheeo — 10 Sep 2014, 09:37


]]>