Global Variables ... How much can a server store?


Glidias
12-28-2003, 10:27 PM
What is the maximum no. of global variables a server can contain? Has anyone tried it yet on DoD? I'm refering to env_global.

When a server creates a global varialble, is it merely a variable stored on the server or is it a brand new entity created everytime for each variable? THis is a good question to ask when considering the maximum no. of global variables a server can contain since we know the max. no of entities a map can usually contain.


GLOBAL VARIABLE AND USING MASTERS TUTORIAL:

Eg.: To create a global variable called "myvar" with an initial state of "Off", create an env_global with Global State to Set: myvar, Initial Value: Off and :Name myvar_toggle (or use myvar_on or myvar_off), and Trigger Mode: Toggle (or On or Off. Then, in order to instantiate (ie. create) the global variable on the server, you must manually trigger that env_global*. So, at the approiate time, create a trigger to target the env_global's Name to trigger it and the global variable "myvar" has now been created. Good jbo! From now onwards, whenever someone triggers ANY env_global in ANY map with Global State to Set: myvar, it would alter the value of "myvar" according to the Trigger Mode of that env_global that was triggered.

You'll also need to have a multisource entity. The multisource should match the value of the global variable at all times. So, give the multisource a Global State to Set: myvar. Give it a Name: myvar_source . Then, for ANY entities with Masters, you could specify a Master value of myvar_source (the name of the multisource). The multisource is therefore acting as a master, determining that entity's state. Think of it as how a slave follows his master. If the master says "Come here", the slave comes. If the master says "Go away", the slave leaves. WHat do Masters control? Masters control everything from an entity's state or existence. (Eg. a info_doddetect has a Master value of myvar_source. It will always exist whenever the myvar_source multisource entity has an On state. It will no longer exist if the multisource entity has an Off state. Now, i'll create another 2nd info_doddetect with a Master value of ~myvar_source. What's with the "~"? It basically inverts the relationship, think of it as a rebellious slave! If the master says "Go away", the rebellious slave instead walks to him while the obedient slave obediently leaves. If the master says "Come", the rebellious slave runs away instead while the obedient slave comes to his master. Thus only 1 of these "slaves" can exist at any given time. With the master (the multisource), who shouts "On" or "Off" based on the global variable, he is effectively toggling the 2 info_doddetects, making one of them 'off' and the other 'on'.. Therefore, to switch info_doddedetects, just toggle the global variable's state with an env_global. However, I think you'll have to restart the round in order for the new info_doddetect to be triggered and take effect.

NOTES:
*If you wish for the global varaible to be created automatically at the start of the map rather than having to trigger it manually, check the "Set Initial State" flag, which would automatically instantiate the global variable when the map starts. However,. this would cause the global variable to be reseted to its initial value every map-change, which is not what we want. We want the global variable values to remain persistant throughout the series of multiple maps being played on the server. Remember, read the next post and realise it's for a campaign system with multiple maps! Therefore, this method is only useful if you wish for the global variables to be persistant only throughout multiple rounds in 1 map only. Eg. Perhaps, after restarting the round, you used a different info_doddetect (brits come into the scene, it starts to rain, etc.) and certain bridges and structures that have been blown in the previous round remain destroyed in this new round! However, if you restarted the map, everything goes back to square 1 :( rather than continuing where you left off.

**If i'm not wrong, if you restart the server with "map blahblah" or rebooted the server, all global varaiblse are flushed. Global varaibles are only maintained on mapchange, so pleaase use "changelevel" console command. Hopefully, if a server admin wishes to reboot the server, I hope there is a way of having the server admin read all the global varaibles through "impulse 104", then copy+paste or read all outputted values from the console into a .cfg file and use something like Botman stripper to maintain those entitiy settings the next time he restarts the server.

***Remember for such campaign maps, ensure you set Flush Global ENtities?: no, keep global ents in the Map properties worldspawn dialog box.

Glidias
12-28-2003, 11:11 PM
I'm thinking of setting up a campaign system framework like RISK (think a small-scaled BattleField Europe. There will be a fixed mapcycle at the beginning based on history in chronological order, but once all those are over, the ending resulting global varaibles would determine the next strategic step to take...done in the control_room.bsp. During deicision making sessions in control rooms, players can make deciisions on which .bsps to attack and such by hitting buttons on a map in the control room, and these buttons can only be pressed depending on the value of the global variables...so you can't attack a territory unless you've own an adjacient territory or whatever factors you wish to use). Another global variable is used to determine whose turn is it (Allies or Axis?), and give the decision control over to that particular team. Then, once a decision is made, a door opens and at least 5 pple must be assembled at the debarkation zone and the map changes to the approaite attacking (fighting) map. The "attacking map" involves an advance in a certain direction towards the main map (theorically). "Attacking maps" are usually "no-respawn" style or "dislodge a single enemy position" style. Dependning on the outcome of the attacking map(s), it would determine how many spawn routes of entry the attacking team has in the next level which is the main level (eg. maybe, about Taking Carentan or something....so the "attacking map(s)" are merely the Outskirts of Carentan). The main map, Taking Carentan, is the real deal! THe main battle/level to take Carentan would be respawning defninitely. Features like the ability for the attackers to adjust toggle on/off their available respawn advance routes can be done from an available command post, so depending on the current situation, the team can decide to surprise the enemy by rushing in as a full team from a particular decisive direction or attacking dispersed from all sides. All areas have to be captured on the main level in order to claim ownership of that territory. Depending on the previous "attacking maps" results, some areas might have been already captured by the attacking team.

Also note the campaign is also turn based. If the Allies win the main level Carentan and therefore owning the territory known as Carentan, the Axis can still counterattack in a particular direction at an opputune time during their turn of the campaign. Think BOB style, where they fought in the outskirts again, but this time the sides are switched. (use master spawns switching method ala schwetz). Usually, there are 4 -5 approaches to each territory. An approach is attempted once at a time in the "attacking map(s)" phase to determine the success of that particular approach. Available approaches are available for attempting based on what was chosen in the control room prior to entering the battle. Sometimes, if you fail all approaches in the fighting, you don't even get to have the opputunity to play in the main map and try to take territory! In short, the efforts were wasted!

YOu see, because of so many factors, there'll be lots of global variables. THe best form of interactivity (but would require lots of variables) would be to have extensive territory-specific global varaibles. Currently, territory-specific global variables you can't do without are "which side owns which territory". However, with more of such territory specific global variables for: 'what spawn areas are active at any given map' and 'what advance routes are available at any given map' and 'which araes belong to which team at any given map', means a battle can continue on from where it left off previously. Eg. If there is time limit and time limits runs out at Carentan, it goes to another different map but the battle for Carentan can continue where it left off at another time. This is to simulate real war where soldiers morale can grow tired and decide to fight another day). Of course, this feature might be rather unnecessary. I'll rather have other global variables to determine weather seasons, armored/air/mortar/mechanised support availabiilty, reinforcement frequency bonus availabiility, etc.. These can be called from command posts in their respective maps or made readily available at the start of that particular map. Armored/Mecahnised support is espeiclaly useful at protecting spawns and covering certain areas. And you know the deal with mortars and airstrikes in DoD! Taking causeways and other key objectives like maybe blowing up the 88s at Brecourt Manor and taking St Marie Du Mont is crucial in getting this support. Some of these objectives are even required as a victory condition of the campaign. Victory of the campaign is determined during the control room. (it iterates through the entire list of the crucial global variables to determine success to either Allies/Axis or a stalemate in which the campaign continues). The player objective hud and pinned diagrams in the control room map show who is winning/losing the campaign. Once either Allies or Axis win the campaign, the map changes to some ending.bsp, which flushes all global entities. ending.bsp could have frills like "celebration" and such...and maybe the "losers behind bars then being released from prison" or "some unlucky ones being executed". Imagine if there was a full WW2 campaign, can you imagine the celebration or horror at the end of the war? Or what about a full BOB campaign to experience the ending (or a not so happy ending)? From there, it could go to a totally new campaign (if available) or restart that same campaign.

Bonus maps (usually at unusual weird times like night) can be initiated once for each map by a team if somehow a particular team is losing badly, and a big desperate comeback is needed. They can be used anytime though, but it is usually saved for later if somehow the team can't find anything productive to attempt. It could be a high stakes paratrooper raid or something). It could be based on history.

Because of the competitive nature of such a campaign, clan_mode with warmuptime is very crucial to get players ready. You could simulate something like schwetz though for each map, but do it for both sides with temporary invisible walls, allowing everyone to get ready for battle. Another method is ensure all spawn points are inactive so no one can spawn yet by using a dod_control_pt as a second master, and only once a particular dod_timer has reached zero, it trigger_point_relays a dod_control_pt which results in all available spawns being activated for their relavant teams....by then players should respawn after that. Maps should be designed specially to ensure the type of gameplay that requires constant struggle in breaking through enemy defenses.....and not just a regular dod frag session. It should make players feel they are part of a major conflict where they must win.

TheNomad
12-29-2003, 02:37 AM
so u are using the global for multiple maps, cos i dont see any point in using it on one single map.

Day of Defeat Forum Archive created by Neil Jedrzejewski.

This in an partial archive of the old Day of Defeat forums orignally hosted by Valve Software LLC.
Material has been archived for the purpose of creating a knowledge base from messages posted between 2003 and 2008.