Need help with adding factions in a mod

Get some help with creating maps or modding.
Need a map editor or other tools, look here!
Post Reply
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Need help with adding factions in a mod

Post by Watermelon »

I am trying to add factions in a mod,assuming I can modify the source directly,I have a few self-made scripting functions at my disposal:

1.setEnableDesignTemplate(void)
Enables the design button and design window

2.setDisableDesignTemplate(void)
Disables the design button and design window(even with headquarter)

3.setEnableTechShare(void)
Enables the techshare in mp

4.setDisableTechShare(void)
Disables the techshare/research leak in mp(which will break the 'factions' imo...)

5.getPlayerFaction(INT playerId)
Gets the player faction flag from playerFactions[MAX_PLAYERS] array in memory

6.setPlayerFaction(INT factionId)
Sets the player factor flag playerFactions[playerId] to a specified faction id

7.randomFaction(INT playerId)
Generates a random faction id for specified player with 'playerId'(when player chooses 'random' as faction)

My idea is to make some factions features via .vlo and .slo to test some new stuff I recently added to the source,though I am unsure which script files are needed to be changed,how it works:

1.player select a faction in mp interface and passes it to the host like team info(already done in source,need tests and some gui changes)
2.the script sets the faction id for the player and enable a list of structures/units/research tree belonging to this faction id.
3.the script disables techshare(for apparent reason)
4.the script disables design(for realistic/fast play with pre-built templates)

Just some crazy/random faction ideas:
1.The project,'snake' bodies and regular weapons:mg,cannon,mortar etc
2.The collective,'bug' bodies and hitNrun weapons:minipod etc
3.The scavanger,'baba' stuff and great in number,but has weak units
4.The nexus,'nexus' bodies and sci-fi weapons
5.The dragon,'dragon' bodies and super weapons
6.Dont know what 'cat family' body owner was called...
tasks postponed until the trunk is relatively stable again.
User avatar
Rman Virgil
Professional
Professional
Posts: 3812
Joined: 25 Sep 2006, 01:06
Location: USA

Re: Need help with adding factions in a mod

Post by Rman Virgil »

---------------


* I trully wish I could help in this Watermelon because I believe strongly that all your efforts, as I understand them, will bring much needed fresh life to WZ GPMs - the likes of which has not been seen to such a sweeping degree since Strata & 4nE's extraordinary (pre-source release) work on v.1.12.

* Mind you I spent months wrestling with Troman's "AIvolution" source trying to master it enough to utilize it in my own projects only to finally realize that I much prefered spending a month perfecting a sonnet than a day working-out an ai script. I wish it were different because I could do so much more but I have to follow my natural bents, not work against them - as we all do wisely.

* In any case I still have a fondness for ai that comes thru on a middleware level - my favorite sdk being "Simbionic" which I thoroughly enjoy and doesn't frustrate me (I also enjoy working with "Einstein / Isaac" and "Star Logo" ais.)

* Anyway, I do wanna express my deep interest in what your working on and that I look foward to play-testing and providing constructive feedback as well as utilizing your accomplishments in my own WZ projects. For while I may work in other game worlds - I'll not abandon WZ and will happily contribute what I'm capable of to the cause of bringing fresh life to an RTS that holds a unique position in the genre and very much deserves to live on.

cheers, rv :)
.

Impact = C x (R + E + A + T + E)

Contrast
Reach
Exposure
Articulation
Trust
Echo
.
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Need help with adding factions in a mod

Post by Watermelon »

Rman Virgil wrote: ---------------


* I trully wish I could help in this Watermelon because I believe strongly that all your efforts, as I understand them, will bring much needed fresh life to WZ GPMs - the likes of which has not been seen to such a sweeping degree since Strata & 4nE's extraordinary (pre-source release) work on v.1.12.

* Mind you I spent months wrestling with Troman's "AIvolution" source trying to master it enough to utilize it in my own projects only to finally realize that I much prefered spending a month perfecting a sonnet than a day working-out an ai script. I wish it were different because I could do so much more but I have to follow my natural bents, not work against them - as we all do wisely.

* In any case I still have a fondness for ai that comes thru on a middleware level - my favorite sdk being "Simbionic" which I thoroughly enjoy and doesn't frustrate me (I also enjoy working with "Einstein / Isaac" and "Star Logo" ais.)

* Anyway, I do wanna express my deep interest in what your working on and that I look foward to play-testing and providing constructive feedback as well as utilizing your accomplishments in my own WZ projects. For while I may work in other game worlds - I'll not abandon WZ and will happily contribute what I'm capable of to the cause of bringing fresh life to an RTS that holds a unique position in the genre and very much deserves to live on.

cheers, rv :)

Thanks for the kind words and your persistence with WZ,Rman Virgil.

I always wanted to create a more balanced and action-oriented mod for wz,in original wz gameplay style,it's not the player who has the best strategies wins,instead it's the player who are mostly familiar with the relatively 'overpowered' techs/components wins.This is just not right for a strategy game imo...also the all-player-has-the-same-units nature makes the game nearly impossible to balance,since all underpower and overpower units are relative and available for all players.
tasks postponed until the trunk is relatively stable again.
Troman
Trained
Trained
Posts: 424
Joined: 12 Aug 2006, 15:40
Contact:

Re: Need help with adding factions in a mod

Post by Troman »

Watermelon wrote: I am trying to add factions in a mod,assuming I can modify the source directly,I have a few self-made scripting functions at my disposal:

1.setEnableDesignTemplate(void)
Enables the design button and design window

2.setDisableDesignTemplate(void)
Disables the design button and design window(even with headquarter)

3.setEnableTechShare(void)
Enables the techshare in mp

4.setDisableTechShare(void)
Disables the techshare/research leak in mp(which will break the 'factions' imo...)

5.getPlayerFaction(INT playerId)
Gets the player faction flag from playerFactions[MAX_PLAYERS] array in memory

6.setPlayerFaction(INT factionId)
Sets the player factor flag playerFactions[playerId] to a specified faction id

7.randomFaction(INT playerId)
Generates a random faction id for specified player with 'playerId'(when player chooses 'random' as faction)
To disable design windows you can call:

Code: Select all

removeReticuleButton(RESEARCH)
I think instead of using a separate function for enabling and disabling you can add a parameter like:

Code: Select all

enableTechShare(BOOL bEnable)
randomFaction(INT playerId) is probably not necessary too, you can just call

Code: Select all

setPlayerFaction(random(numFactions))
This way we will have less functions to memorize and document.
Watermelon wrote: My idea is to make some factions features via .vlo and .slo to test some new stuff I recently added to the source,though I am unsure which script files are needed to be changed,how it works:

1.player select a faction in mp interface and passes it to the host like team info(already done in source,need tests and some gui changes)
2.the script sets the faction id for the player and enable a list of structures/units/research tree belonging to this faction id.
You can define a multidimensional array in a .vlo file for research, like:

Code: Select all

tech[0][0]		RESEARCHSTAT	"R-Cyborg-Wpn-MG"
[...]
Then in .slo files you get player faction with getPlayerFaction(INT playerId), in case it wasn't set to random, otherwise you can use scripts to generate some random factionID. Then you use factionID to access the right tech:

Code: Select all

doResearch(tech[researchID][factionID], researcgLab);
We have a function (not documented yet) that can take a certain technology as parameter, it will automatically calculate prerequisites for that research and start researching them one by one. If all prerequisites are researched already it will research technology provided as parameter:

Code: Select all

pursueResearch(STRUCTURE structure, INT player, RESEARCH someResearch);
I have a feeling this all will not be a piece of cake though.
Sign Up for Beta-Testing:
?topic=1617.0
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Need help with adding factions in a mod

Post by Watermelon »

Troman wrote: To disable design windows you can call:

Code: Select all

removeReticuleButton(RESEARCH)
yes I saw that function,but the re-build HQ event and HasHQ checks will override that function,so I have to make a function to disable it completely.
I think instead of using a separate function for enabling and disabling you can add a parameter like:

Code: Select all

enableTechShare(BOOL bEnable)
ok I'll merge enable/disable ones
randomFaction(INT playerId) is probably not necessary too, you can just call

Code: Select all

setPlayerFaction(random(numFactions))
This way we will have less functions to memorize and document.
didnt know there is random(range) function,will use that instead
You can define a multidimensional array in a .vlo file for research, like:

Code: Select all

tech[0][0]		RESEARCHSTAT	"R-Cyborg-Wpn-MG"
[...]
Then in .slo files you get player faction with getPlayerFaction(INT playerId), in case it wasn't set to random, otherwise you can use scripts to generate some random factionID. Then you use factionID to access the right tech:

Code: Select all

doResearch(tech[researchID][factionID], researcgLab);
We have a function (not documented yet) that can take a certain technology as parameter, it will automatically calculate prerequisites for that research and start researching them one by one. If all prerequisites are researched already it will research technology provided as parameter:

Code: Select all

pursueResearch(STRUCTURE structure, INT player, RESEARCH someResearch);
I have a feeling this all will not be a piece of cake though.
thanks for the tips,I'll see what I can do with these script functions.
tasks postponed until the trunk is relatively stable again.
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Need help with adding factions in a mod

Post by Watermelon »

I modified player0.vlo,player1.slo and rules.vlo,rules.slo,the modified files compile file but asserts in function 'eventSetContextVar' in event.c giving a 'eventSetContextVar: Variable type mismatch 17/18'.

Perhaps it has something to do with the multi-dimensional arrays I used in player0.vlo/.slo,I am not sure if the declaration of those arrays are correct or not.

I have attached the problem scripts,maybe someone who is more familiar with the 'ai script' can figure it out in no time.
Attachments
test.zip
(16.37 KiB) Downloaded 302 times
tasks postponed until the trunk is relatively stable again.
Troman
Trained
Trained
Posts: 424
Joined: 12 Aug 2006, 15:40
Contact:

Re: Need help with adding factions in a mod

Post by Troman »

Watermelon wrote: I modified player0.vlo,player1.slo and rules.vlo,rules.slo,the modified files compile file but asserts in function 'eventSetContextVar' in event.c giving a 'eventSetContextVar: Variable type mismatch 17/18'.

Perhaps it has something to do with the multi-dimensional arrays I used in player0.vlo/.slo,I am not sure if the declaration of those arrays are correct or not.

I have attached the problem scripts,maybe someone who is more familiar with the 'ai script' can figure it out in no time.
The reason is that in player0.slo you defined factionComps[] as COMPONENT, while in player0.vlo factionComps[] has a different type.

According to the compatibility table COMPONENT and BODY/PROPULTION are compatible to each other, but looks like the table is only used during run time.

I can't think of reasons right now why we can't do this during compile time as well. This error message should be gone in r740.

The other work around would have been to define more than one variable for each component type in .slo and .vlo files, like

slo:

Code: Select all

public BODY factionBody[5];
public PROPULSION factionPropulsion[5];
vlo:

Code: Select all

factionBody[0]  BODY "Body1REC";
[...]

factionPropulsion[0]  PROPULSION "wheeled01";
[...]
Sign Up for Beta-Testing:
?topic=1617.0
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Need help with adding factions in a mod

Post by Watermelon »

Troman wrote: The reason is that in player0.slo you defined factionComps[] as COMPONENT, while in player0.vlo factionComps[] has a different type.

According to the compatibility table COMPONENT and BODY/PROPULTION are compatible to each other, but looks like the table is only used during run time.

I can't think of reasons right now why we can't do this during compile time as well. This error message should be gone in r740.

The other work around would have been to define more than one variable for each component type in .slo and .vlo files, like

slo:

Code: Select all

public BODY factionBody[5];
public PROPULSION factionPropulsion[5];
vlo:

Code: Select all

factionBody[0]  BODY "Body1REC";
[...]

factionPropulsion[0]  PROPULSION "wheeled01";
[...]
Thanks for the quick fix,unfortunately rev740 doesnt fix my problem,it still asserts at the line I mentioned above,but this time it's 23/18...detailed info:

psDebug offset 0 line 132 pLabel "droidBuilttr"

psVarDebug pIdent "player" store 0

psArrayInfo base 94 type 27 dimension 2
elements[0] 8 [1] 50 [2] uninitialized/ubyte_max [3] uninitialized/ubyte_max

psArrayDebug "factionUnits" store 0

I am really clueless why droidBuilttr trigger event can cause the problem,since I didnt change it.
Last edited by Watermelon on 12 Feb 2007, 18:43, edited 1 time in total.
tasks postponed until the trunk is relatively stable again.
User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: Need help with adding factions in a mod

Post by lav_coyote25 »

just reading over your work up to date..... you did know this???  as i see your working with player 0... or has someone changed it??

from the documents project  ( http://members.shaw.ca/kgmetcalfe3/Worl ... index.html)
Note:

Some Warzone 2100 multiplayer maps feature Scavengers. You can include Scavengers in your maps, but there are several limitations. Scavengers must take up the slot occupied by player 7, and because of this they can only appear on maps featuring fewer than seven players. Scavengers will not appear in One Player Skirmish games. If you place Scavengers on a map, be sure to give them a factory, a power generator and an oil derrick. This will allow them to build units. Without these three buildings maps featuring Scavengers may not work properly.

( further note: to use scavengers in the game requires a script or they will not appear.)

‎"to prepare for disaster is to invite it, to not prepare for disaster is a fools choice" -me (kim-lav_coyote25-metcalfe) - it used to be attributed to unknown - but adding the last bit , it now makes sense.
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Need help with adding factions in a mod

Post by Watermelon »

Thanks for the info coyote  :)

I am changing the source code directly,the faction is stored in memory and the script will retrieve it via script functions,then make a list of units/techs available for this faction and enable them for the players who selected the faction.So I dont need to worry about the player id,any player can be any faction with the source changes,so it's not necessarily needed to specify the 'race player id' for the scavengers.
tasks postponed until the trunk is relatively stable again.
Troman
Trained
Trained
Posts: 424
Joined: 12 Aug 2006, 15:40
Contact:

Re: Need help with adding factions in a mod

Post by Troman »

Does makeComponentAvailable() actually work well with that change I made?
Sign Up for Beta-Testing:
?topic=1617.0
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Need help with adding factions in a mod

Post by Watermelon »

Troman wrote: Does makeComponentAvailable() actually work well with that change I made?
yes but I am having other problems such as crash on exit(tried to free null local variables)and some missing template problem(they are in templates.txt,but the script just couldnt find some of them).The ai refused to build anything,so I guess the crash-on-exit might have something to do with player0.slo.Other stuff worked fine,I can enable/disable design screen and give human player a list of pre-made templates of the specified faction in mp interface.
tasks postponed until the trunk is relatively stable again.
Troman
Trained
Trained
Posts: 424
Joined: 12 Aug 2006, 15:40
Contact:

Re: Need help with adding factions in a mod

Post by Troman »

If you are idling on IRC I will drop in a bit later today.
Sign Up for Beta-Testing:
?topic=1617.0
Post Reply