View topic - ability to change faction ingame



All times are UTC + 1 hour


Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 21 Feb 2012, 22:32 

Joined: 20 Oct 2009, 12:04
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, 06:06, edited 1 time in total.

Top
 Offline Profile  
 
PostPosted: 21 Feb 2012, 23:31 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
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.


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 00:08 
Kernel Panic Co-Developer
User avatar

Joined: 16 Nov 2004, 13:08
Fraction:..................................................Brake:
Image...............................Image


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 00:45 
User avatar

Joined: 07 Feb 2005, 21:30
Location: Cheese factory
Missing a score button here to give zwzsg +10.


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 06:45 

Joined: 20 Oct 2009, 12:04
This is engine request: add ability to change teamside ingame


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 08:05 
Moderator

Joined: 12 Oct 2007, 08:24
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.

Quote:
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.


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 10:52 

Joined: 20 Oct 2009, 12:04
>>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.


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 15:45 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
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.


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 15:55 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
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.


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 16:16 

Joined: 20 Oct 2009, 12:04
[/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, 06:07, edited 1 time in total.

Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 16:46 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
quick test with BA: chose ARM in lobby, ingame chose CORE :arrow: adv playerlist still shows an ARM icon.

Agree with googlefrog and also:
Quote:
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:


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 17:08 

Joined: 20 Oct 2009, 12:04
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).


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 17:27 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
"Cross-game" widgets are very bad, and were a flawed design decision by trepan from the start.


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 18:04 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
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.


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 20:21 

Joined: 20 Oct 2009, 12:04
I mean "faction" instead of "fraction", sorry. In russian it sounds like "fRaction" for some reason.


Top
 Offline Profile  
 
PostPosted: 22 Feb 2012, 20:35 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
They were just picking on you. They understood what you meant.


Top
 Offline Profile  
 
PostPosted: 23 Feb 2012, 12:12 
Spring Developer

Joined: 01 Jun 2005, 10:36
Location: The Netherlands
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.


Top
 Offline Profile  
 
PostPosted: 23 Feb 2012, 12:19 
Lua Coder

Joined: 12 Jul 2009, 17:57
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


Top
 Offline Profile  
 
PostPosted: 13 Apr 2012, 11:24 
User avatar

Joined: 23 Feb 2009, 16:29
Location: Finland
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?


Top
 Offline Profile  
 
PostPosted: 13 Apr 2012, 16:49 
User avatar

Joined: 07 Dec 2008, 02:35
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).


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.