ability to change faction ingame

ability to change faction ingame

Requests for features in the spring code.

Moderator: Moderators

User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

ability to change faction ingame

Post by jamerlan »

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?
Last edited by jamerlan on 14 Apr 2012, 07:06, edited 1 time in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: ability to change fraction ingame

Post by smoth »

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.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: ability to change fraction ingame

Post by zwzsg »

Fraction:..................................................Brake:
Image...............................Image
User avatar
Cheesecan
Posts: 1571
Joined: 07 Feb 2005, 21:30

Re: ability to change fraction ingame

Post by Cheesecan »

Missing a score button here to give zwzsg +10.
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: ability to change fraction ingame

Post by jamerlan »

This is engine request: add ability to change teamside ingame
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: ability to change fraction ingame

Post by Google_Frog »

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.
I have a question: is there a true way to change "side" or "fraction" ingame?
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.

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.
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: ability to change fraction ingame

Post by jamerlan »

>>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.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: ability to change fraction ingame

Post by smoth »

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.
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.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: ability to change fraction ingame

Post by smoth »

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.
NOPE you assume all games are the same.
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: ability to change fraction ingame

Post by jamerlan »

[/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.
Last edited by jamerlan on 14 Apr 2012, 07:07, edited 1 time in total.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: ability to change fraction ingame

Post by knorke »

quick test with BA: chose ARM in lobby, ingame chose CORE :arrow: adv playerlist still shows an ARM icon.

Agree with googlefrog and also:
If not, which solution is best to improve "teamside" related widgets?
read the startUnitParamName team parameter that game_initial_spawn.lua in BA already sets with Spring.SetTeamRulesParam.
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. :shock:
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: ability to change fraction ingame

Post by jamerlan »

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).
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: ability to change fraction ingame

Post by FLOZi »

"Cross-game" widgets are very bad, and were a flawed design decision by trepan from the start.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: ability to change fraction ingame

Post by smoth »

jamerlan 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.
FTFY
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).
It isn't a hack, it adapting the code to work with your game. You need to learn WTF hack coding actually means.
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: ability to change fraction ingame

Post by jamerlan »

I mean "faction" instead of "fraction", sorry. In russian it sounds like "fRaction" for some reason.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: ability to change fraction ingame

Post by smoth »

They were just picking on you. They understood what you meant.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: ability to change fraction ingame

Post by Tobi »

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.
Pako
Posts: 174
Joined: 12 Jul 2009, 18:57

Re: ability to change fraction ingame

Post by Pako »

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
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: ability to change fraction ingame

Post by Jools »

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?
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: ability to change fraction ingame

Post by Niobium »

Jools wrote:I think that currently the inter-widget communication is done via WG-tables. is it better to use SetTeamRulesParam?
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.

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).
Post Reply

Return to “Feature Requests”