ability to change faction ingame
Moderator: Moderators
ability to change faction ingame
Hi everyone!
I have a question: is there a true way to change "side" or "faction" ingame? Yes, I am talking about BA widget: "gui_faction_change.lua". Looks like it uses some "hacks" to change faction - just changing start unit.
So if other widgets like "initial build queue" or "adv player list" want to use info about side, they should NOT use this function "_,_,_,_,teamside = Spring_GetTeamInfo(team)"?
Looks like adv player list can be used in other mods like ZK. So If I will update it to use 'startUnit' instead of "teamside", it wil brake compability with other mods.
So, is there a way to change "teamside" when game was started? If not, could you please implement it before 86.0 will be released? If not, which solution is best to improve "teamside" related widgets?
I have a question: is there a true way to change "side" or "faction" ingame? Yes, I am talking about BA widget: "gui_faction_change.lua". Looks like it uses some "hacks" to change faction - just changing start unit.
So if other widgets like "initial build queue" or "adv player list" want to use info about side, they should NOT use this function "_,_,_,_,teamside = Spring_GetTeamInfo(team)"?
Looks like adv player list can be used in other mods like ZK. So If I will update it to use 'startUnit' instead of "teamside", it wil brake compability with other mods.
So, is there a way to change "teamside" when game was started? If not, could you please implement it before 86.0 will be released? If not, which solution is best to improve "teamside" related widgets?
Last edited by jamerlan on 14 Apr 2012, 07:06, edited 1 time in total.
Re: ability to change fraction ingame
This very much belongs in the BA forum or in the lua forum. Feature request is for ENGINE request. This is a lua GADGET request that you need to make. One very specific to the game in question: BA.
Re: ability to change fraction ingame
Fraction:..................................................Brake:
...............................


Re: ability to change fraction ingame
Missing a score button here to give zwzsg +10.
Re: ability to change fraction ingame
This is engine request: add ability to change teamside ingame
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: ability to change fraction ingame
It is an engine request. jamerlan wants to be able to change the faction return value of Spring.GetTeamInfo(team) with a gadget. This would make all widgets more compatible with gadgets that change start units to change faction. I don't think this is a bad idea but I do think it is a waste of time.
If side does not actually do anything you can easily replace it with Get/SetTeamRulesParam. Your side changing gadget would control this parameter and any widget or gadget can read it. You will have to update any widgets you wish to use but you'll probably have to do that anyway. I doubt many widgets will work with a side changing game because they currently assume side does not change.
Finally I don't think widget compatibility between games with different requirements is a high priority. If you make a game which allows you to change side you should expect to at least update current widgets to deal with it. These widgets should then be packaged with your game and other games do not need to use them.
Take a step back and ponder the concept of "true side". I don't think there is such a thing as true side in the sense you mean, the 5th parameter of GetTeamInfo just tells lua about something the player selected in the lobby. As far as I am aware this side has no effect that is hardcoded into the engine. Given that the engine does not use side I don't see why you need to be able to change it.I have a question: is there a true way to change "side" or "fraction" ingame?
If side does not actually do anything you can easily replace it with Get/SetTeamRulesParam. Your side changing gadget would control this parameter and any widget or gadget can read it. You will have to update any widgets you wish to use but you'll probably have to do that anyway. I doubt many widgets will work with a side changing game because they currently assume side does not change.
Finally I don't think widget compatibility between games with different requirements is a high priority. If you make a game which allows you to change side you should expect to at least update current widgets to deal with it. These widgets should then be packaged with your game and other games do not need to use them.
Re: ability to change fraction ingame
>>These widgets should then be packaged with your game and other games do not need to use them.
I am trying to look at widgets as frameworks or libraries. Do you like idea of making your own version of some framework and supporting these changes for new framework versions? If you customize a widget, you can't get it up-to-date with original widget without pain. It will create problems in future maintenance. So if widgets worked in many mods, I don't want to break this compatibility.
That is ok if engine not use this information. But if many games use term "side" it will be nice to have information about that in standartized way. So it will be possible to write cross-game widgets/gadgets.
I am trying to look at widgets as frameworks or libraries. Do you like idea of making your own version of some framework and supporting these changes for new framework versions? If you customize a widget, you can't get it up-to-date with original widget without pain. It will create problems in future maintenance. So if widgets worked in many mods, I don't want to break this compatibility.
That is ok if engine not use this information. But if many games use term "side" it will be nice to have information about that in standartized way. So it will be possible to write cross-game widgets/gadgets.
Re: ability to change fraction ingame
I think it is a waste of time and thus a bad idea. Would be better to supplant the engine based factions with our own gadget to handle it.Google_Frog wrote:It is an engine request. jamerlan wants to be able to change the faction return value of Spring.GetTeamInfo(team) with a gadget. This would make all widgets more compatible with gadgets that change start units to change faction. I don't think this is a bad idea but I do think it is a waste of time.
Re: ability to change fraction ingame
NOPE you assume all games are the same.jamerlan wrote:That is ok if engine not use this information. But if many games use term "side" it will be nice to have information about that in standartized way. So it will be possible to write cross-game widgets/gadgets.
Re: ability to change fraction ingame
[/quote] NOPE you assume all games are the same.[/quote]
This is RTS engine and many RTS have "sides" or "factions". So my assumption was from this point of view.
This is RTS engine and many RTS have "sides" or "factions". So my assumption was from this point of view.
Last edited by jamerlan on 14 Apr 2012, 07:07, edited 1 time in total.
Re: ability to change fraction ingame
quick test with BA: chose ARM in lobby, ingame chose CORE
adv playerlist still shows an ARM icon.
Agree with googlefrog and also:
Atm it only saves the startunit but from "armcom" it is a short way to "ARM".
And of course the gadget could store the factionName in the same way.
Also what would be super awesome are modoptions per player/team/ally. Side would then be a per-team modoption. So you can not only select a side but also a hero, a superweapon and theme song.

Agree with googlefrog and also:
read the startUnitParamName team parameter that game_initial_spawn.lua in BA already sets with Spring.SetTeamRulesParam.If not, which solution is best to improve "teamside" related widgets?
Atm it only saves the startunit but from "armcom" it is a short way to "ARM".
And of course the gadget could store the factionName in the same way.
Also what would be super awesome are modoptions per player/team/ally. Side would then be a per-team modoption. So you can not only select a side but also a hero, a superweapon and theme song.

Re: ability to change fraction ingame
knorke, I know that BA changes start unit (read my first message in this thread). And If I will add logic related to start unit to adv player list - it will contain BA related hacks. I dislike idea to copy and customize adv player list to BA and also i dislike to add hacks to adv player list. So I think that better - to add ability to change "side" into engine.
If all people dislike my proposal and nobody will add support to engine, I will add BA related hacks to "cross-game" widgets (and this is very bad).
If all people dislike my proposal and nobody will add support to engine, I will add BA related hacks to "cross-game" widgets (and this is very bad).
Re: ability to change fraction ingame
"Cross-game" widgets are very bad, and were a flawed design decision by trepan from the start.
Re: ability to change fraction ingame
FTFYjamerlan wrote:knorke, I know that BA changes start unit (read my first message in this thread). And If I will add logic related to start unit to adv player list - it will contain BA related concessions. I dislike idea to copy and customize adv player list to work with a game and also i dislike integrating adv player list with a game. So I think that lazier- to add ability to change "side" into engine.
It isn't a hack, it adapting the code to work with your game. You need to learn WTF hack coding actually means.jamerlan wrote:If all people dislike my proposal and nobody will add support to engine, I will add BA related hacks to "cross-game" widgets (and this is very bad).
Re: ability to change fraction ingame
I mean "faction" instead of "fraction", sorry. In russian it sounds like "fRaction" for some reason.
Re: ability to change fraction ingame
They were just picking on you. They understood what you meant.
Re: ability to change fraction ingame
Indeed, engine does not do anything with faction/side apart from reading it from script.txt & remembering it to be able to return it in GetTeamInfo (for backward compatibility).
A game can use SetTeamRulesParam / GetTeamRulesParam to maintain an up to date faction identifier, readable by both widgets & gadgets.
A game can use SetTeamRulesParam / GetTeamRulesParam to maintain an up to date faction identifier, readable by both widgets & gadgets.
Re: ability to change fraction ingame
First you should realize that players don't need faction info(in BA), it has next to none strategy value and first scout reveals it.
Anyways, how ZK does things:
name,active,spectator,_,_,pingTime,cpuUsage,country,rank, customKeys = Spring.GetPlayerInfo(playerID)
icon = "LuaUI/Configs/Clans/" .. customKeys.clan ..".png"
faction = "LuaUI/Configs/Factions/" .. customKeys.faction ..".png"
icRank = "LuaUI/Images/Ranks/" .. (1+math.floor((customKeys.level or 0)/10)) .. ".png"
Also Spring.GetTeamInfo() returns the customKeys for a team.
Now you might think awesome, this seems easy and good, NO.
It is incomplete fail. It seems that player custom keys can't be set ingame and team custom keys can be set but doesn't support anything but numbers.
So no go, only sane way for dynamic faction seems to be: ((customKeys.faction == 0) and "core" or "arm") That must be set in gadget and doesn't work for coop and only works for a game which has that gadget.
FEATURE REQUEST:
-make player custom keys writable
-make team custom keys support string data or any data
Anyways, how ZK does things:
name,active,spectator,_,_,pingTime,cpuUsage,country,rank, customKeys = Spring.GetPlayerInfo(playerID)
icon = "LuaUI/Configs/Clans/" .. customKeys.clan ..".png"
faction = "LuaUI/Configs/Factions/" .. customKeys.faction ..".png"
icRank = "LuaUI/Images/Ranks/" .. (1+math.floor((customKeys.level or 0)/10)) .. ".png"
Also Spring.GetTeamInfo() returns the customKeys for a team.
Now you might think awesome, this seems easy and good, NO.
It is incomplete fail. It seems that player custom keys can't be set ingame and team custom keys can be set but doesn't support anything but numbers.
So no go, only sane way for dynamic faction seems to be: ((customKeys.faction == 0) and "core" or "arm") That must be set in gadget and doesn't work for coop and only works for a game which has that gadget.
FEATURE REQUEST:
-make player custom keys writable
-make team custom keys support string data or any data
Re: ability to change fraction ingame
Just to inform you that I stole the faction change widget from BA, so now it is also present in XTA. Things that need to be adjusted are the initial queue and advanced playerslist at least. Anything more?
Also, there is no true faction. You can capture or resurrect an unit from opposing faction and become that, and if your original faction dies off then those widgets would show 'wrong' even without faction change. My take is that the true faction in most ways is identical to start unit.
I think that currently the inter-widget communication is done via WG-tables. is it better to use SetTeamRulesParam?
Also, there is no true faction. You can capture or resurrect an unit from opposing faction and become that, and if your original faction dies off then those widgets would show 'wrong' even without faction change. My take is that the true faction in most ways is identical to start unit.
I think that currently the inter-widget communication is done via WG-tables. is it better to use SetTeamRulesParam?
Re: ability to change fraction ingame
Do not ever use any code that looks even remotely like the WG related stuff that was added to gui_faction_change/initial_queue. Seriously.Jools wrote:I think that currently the inter-widget communication is done via WG-tables. is it better to use SetTeamRulesParam?
The way to do it is to either poll the existing team rules param (simple, hard to get wrong) or to add a piece of code to the gadget that broadcasts a notification to widgets when a player changes their faction, then have widgets listen for that.
As a side note, imo the whole concept of 'inter-widget communication' is dodgy to begin with. Any user could disable one to many of the widgets involved in the communication at any time, or write an extra widget which joined in the communication in unexpected ways (i.e. overwriting WG table elements, etc).