FAQ  •  Login

env_global custom states?

<<

Kenny

User avatar

Warrant Officer 1
Warrant Officer 1

Posts: 1016

Joined: Sun Mar 16, 2008 3:43 am

Post Wed Apr 17, 2013 7:57 pm

env_global custom states?

I was decompiling some of Valve's maps today to check out their entity setup on d2_coast_07 and 08, because in those two maps is the train bridge sequence where a button pressed in one map deactivates a field in the other. My original theory was that the state was controlled by a logic relay of some kind that was retained in the level transition between maps. However, this was proven to be invalidated, as the button actually toggled on an env_global with a custom state on it.

You see, the "normal" env_global states are as follows:

Gordon pre-criminal
Antlions are player allies
Suit sprint function not yet enabled
Super phys gun is enabled
Friendly encounter sequence (lower weapons, etc.)
Gordon is invulnerable
Don't spawn seagulls on the jeep
Episode 2: Alyx injured
Episodic: Alyx darkness mode
Ep2 Counter: Hunters to run over before they dodge

These are code functions related to a specific area of the game or a modified AI state. HOWEVER, the env_global in d2_coast_08 has the following state:

bridge_gate_open

WAT. I've never seen this state before, but it is used to control the open and closed status of the bridge's laser gate in map 07. My only real hypothesis here is that either A. the developers intentionally programmed in a state specific to this part of the game that cannot be used any other way (a valid possibility but seemingly a waste of resources), or B. they hacked in their own state to the env_global and I can totally do something similar.

If I somehow had a way to make custom env_global states, this could massively reduce the complexity of the entity setups required to keep track of the variables influencing world state in each map. Does anyone here know anything about custom states in env_global or where in the code to look? Any help would be appreciated.
Image
<<

Nicadeamas

User avatar

Captain
Captain

Posts: 2606

Joined: Mon Jun 25, 2007 11:38 am

Location: Earth

Post Wed Apr 17, 2013 8:39 pm

Re: env_global custom states?

.
Sad news I know nothing about that.
Based on my understanding of it I don't see what it's for. In your example of pushing a button in one map and having it carry through to open a door in another map, easy without an env_global.
'global entitie name' as I understand it (and have never used it,) does the same thing.

I never bothered to learn things like this because I just hax stuff like this in.

Like with my gnome in my L4D campaign. He has power ups. But the power ups carry over to the next map. I did this via spawning a physics prop (yes I used gnomes) in an unseen area to which they would fall down into a box.
This box also happens to be part of the :Level transition brush, and it also has a func_vis_cluster attached to it to be sure the secret room was rendered when I transferred the map.
Then in the next map I had a logic Auto trigger stuff to go look in the secret room to see if there were any gnomes in their boxes, and if they were, then it would apply those changes to the gnome so he had his power ups.

So, even if you can't get Env_global to work the way you want, maybe now you have some idea's how to hack it in.
Btw. Have you tried just randomly making up your own state to see if that works?
<<

Kenny

User avatar

Warrant Officer 1
Warrant Officer 1

Posts: 1016

Joined: Sun Mar 16, 2008 3:43 am

Post Wed Apr 17, 2013 9:42 pm

Re: env_global custom states?

I have not had the opportunity to try making a state in env_global to test yet. I might just go with my original plan and use a network of logic_relays to toggle map states. The one problem with doing it my way is that I can't do "seamless" map transitions easily because the entities would have to be in multiple places due to the non-linear, backtrack focused layout. I'll have to teleport the player to a box outside the map with the trigger entities and use a third person cutscene or some kind of fade to transition maps with all the requisite entities.
Image
<<

Nicadeamas

User avatar

Captain
Captain

Posts: 2606

Joined: Mon Jun 25, 2007 11:38 am

Location: Earth

Post Sat Apr 20, 2013 7:37 am

Re: env_global custom states?

.
What is it that has to transfer between maps?
<<

Kenny

User avatar

Warrant Officer 1
Warrant Officer 1

Posts: 1016

Joined: Sun Mar 16, 2008 3:43 am

Post Sat Apr 20, 2013 4:55 pm

Re: env_global custom states?

Prop states and gate statuses. For one example, in the current "mainblock" map (seen in the Screenshot Bonanza), there is a boarded up door that can only be unlocked by breaking the boards off. So once the player has done this, but goes to another map and comes back, by default the map would respawn the boards. I want to make the boards broken state permanent, so if the player breaks the boards and unlocks the door, it will remain unlocked for the rest of the game. The easy way to do this would be to use another map with the boards permanently gone, but that would lead to the same area at different points of the game locking and unlocking doors for no reason. Plus, the maps are intentionally designed to be open and non-linear within the engine constraints. So forcing the player into a certain location to break the door to make scripting easier is antithetical to the overall feel of the mod.

Additionally, I wanted to have a series of timers in the maps to figure out when locations will have shift changes or reinforcements. For example, if a player kills all guards in an area while preventing them from summoning reinforcements, twenty real time minutes or so will pass before a set of reinforcements is called into the area. I want this to be done whether or not the player is in the map in question, so when the player is NOT in the level and the minutes pass, then on loading the map again the guards will already be there. If the player is IN the map, then the player should see the reinforcements be dropped off dynamically by dropships, or by coming out of other buildings leading to the level.

This is insanely ambitious, yes. But I want the island to feel like a real place, like the combine are actively dispatching soldiers to hamper your efforts based on what you do or don't do. And to reinforce this feel, the player must have permanent effects on the world- if the player blows up a destructable wall, a global state will say "this has been blown up," and any time that map loads the wall will already be blown up and freely traverseable.
Image
<<

Nicadeamas

User avatar

Captain
Captain

Posts: 2606

Joined: Mon Jun 25, 2007 11:38 am

Location: Earth

Post Sat Apr 20, 2013 6:20 pm

Re: env_global custom states?

.
Example Doors:
IF I WERE YOU

Map_4_Door_planks_1
Map_4_Door_planks_1 > Onbreak > Map_4_Door_planks_1_Branch > Set value > 1 (True)

Hacks:
Map_4_Door_planks_1_Branch
- Open Properties
- Smart edit off
- Add
- Key: globalname
- Name: Map_4_Door_planks_1_Branch

Map change:

Logic_Auto:
OnMapSpawn > Changes_Relay_1 > trigger

Changes_Relay_1: Delay is just so the computer doesn't have to do everything at once.
Map_4_Door_planks_1_Branch > Test > Delay > .5
Map_4_Door_planks_2_Branch > Test > Delay > .5
Map_4_Door_planks_3_Branch > Test > Delay > .5
Map_3_Door_planks_1_Branch > Test > Delay > .5
Map_2_Door_planks_1_Branch > Test > Delay > 1
Map_2_Door_planks_2_Branch > Test > Delay > 1
Map_1_Door_planks_1_Branch > Test > Delay > 1

Map_4_Door_planks_1_Branch:
OnTrue > Map_4_Door_planks_1 > break

Right now your in map_5, so you dont have any planks by that name. The output does nothing. BUT, the entitie is now remembering it's value is set to 1. You can only set it to 1 by breaking the planks in map_4. So ever since then it has been going from map to map with you holding the value of 1.

BUT SINCE I'm NOT YOU BECAUSE I'M CRAZY
I would not use a Logic_branch where you hack in the 'Global Entitie Name' ('globalname' with smart edit off,) because in the first place I've never even used 'global entitie name' and in the second place I'm to lazy to figure out if you can force a Logic_branch to have one... Right now I've convinced myself it will work.
INSTEAD
I would use Prop_physics.

Map_4_Door_planks_1_Branch is actually Map_4_Door_planks_1_tin_can and instead of Changes_Relay_1 telling it to test, I would just use a trigger brush to feel around and see if Map_4_Door_planks_1_tin_can has started to exist on map spawn.
And it would exist because in map_4 you broke the planks, which caused a point_template to spawn Map_4_Door_planks_1_tin_can and Map_4_Door_planks_1_tin_can fell into a dark little room that has a trigger_transition and a func_viscluster around it that happen to be tied to whatever room the player is transitioning from... that would even work if the player had multiple options as to which map he was going to next.

OR!.
If I was insane... I would set up a grid of dark little creepy places. Duplicate the grid on every map. Microseconds before level transfer I would throw the player in a viewcontrol mirroring his last scenes. Then throw his body in X creepy place. Then in the next map, right before it teleports the player back to a duplicate of where he just left off from, it checks which creepy place he is in and remembers that info.
Point is. Depending on which creepy hole he was transferred in, the map with it's own entities calculates the changes that need to be applied upon re-entery to a previously changed map.
But unless you implemented a lot of mathematics and equations, you would double the number of creepy places needed every time you added one more thing to the mod that could be changed.
So 5 things in 5 maps where anyone of them could be changed would take about 125 creepy places... So this seems like a bad idea... But I'm sure there is a mathematical way of simplifying it.
Something for me to think about.

I'll get back to you about the combine spawn time delay. I'm going to go eat supper.
<<

Kenny

User avatar

Warrant Officer 1
Warrant Officer 1

Posts: 1016

Joined: Sun Mar 16, 2008 3:43 am

Post Sat Apr 20, 2013 7:32 pm

Re: env_global custom states?

Another reason it's so important to maintain continuity is that after the player raids the combine garrison, a fast travel system allowing the player to access any part of the island is unlocked. Players can take a combine pod and pick an area of the island to travel to, and load that map instantly. So anything changed has to be consistent at any point in the game.

Thanks for the in depth reply, I'll have to try those methods once I have some time free in my schedule to map again.
Image
<<

Nicadeamas

User avatar

Captain
Captain

Posts: 2606

Joined: Mon Jun 25, 2007 11:38 am

Location: Earth

Post Sat Apr 20, 2013 9:00 pm

Re: env_global custom states?

.
Another thing to try with the breakable planks specifically;
Give them a global entities name, then duplicate that item in every map. The theory is that Door_1 will break, then when you go to the next map, since it has a global entitie name, it will go "hey, this is Door_1, you broken!" Then it will do the same next transfer and the one after that etc.
<<

Nicadeamas

User avatar

Captain
Captain

Posts: 2606

Joined: Mon Jun 25, 2007 11:38 am

Location: Earth

Post Sat Apr 20, 2013 9:58 pm

Re: env_global custom states?

.
I talked with another friend.
He says If
Map > Map properties > New Level Unit > (IS set to) No, Keep current
Then,
Anything with a global entitie name will save it's status in with the player and follow him from map to map.
So if Func_breakable has a global entitie name, and you break it. It should remain broken regardless of what level your in or going through until you come across a map that is;
Map > Map properties > New Level Unit > Yes

Because if it's set to yes, it will delete all the stored info from previous maps, (aka Global entities names)

So it sounds like the majority of your problem can be solved with the global entitie name feature.

As for your countdown to new combine arriving on-scene every X seconds... I'm still working that up in my head but I think I've got a plan that should cover all maps with the same system and reduce the number of entities.
Basically;
You have a main counter, counting seconds, or double seconds, or 5 second increments. Every X seconds it add's 1 to Player_Main_Counter.
With verious methods I've learned you can take a Math_Counter, with any numerical value, and convert it via Logic_Case' into a digital clock. I used Models and changed the skin based on the number.
Point is something new happens for every single digit it goes, meaning you can find the value of the Player_Main_Counter, at any given point.
So. Player_Main_Counter is counting up 1 every 5 seconds. Upon a level transition we develop a method to make sure the Player_Main_Counter can retain it's value and continue counting.

When a combine base is destroyed, it grabbs the valuse of the Player_Main_Counter. If you want the combine base to respawn in 20 min then that would be in 240 (Increments of 5.) So it takes the Player_Main_Counter valuse, adds 240, and saves that number.
Every time the Player_Main_Counter adds 1 it checks to see if anyone likes the number. When it finally does hit a number that was saved by the destruction of a combine base, it will que that base to respawn nex chance it gets.
Which could be when the player returnes.
This method also leaves a LOT of room for Randomization. Like you could have the base respawn between X and Y. Whereas X and Y could be 1 increment apart, or 1000s

So with a 4 digit number incrementing by 1 every 5 seconds... your player would have 13.8 hours to beat the game before we hit a problem... Problem could simply be that All bases stop respawning or all bases reset and the whole thing starts over. (as far as destroying bases goes.)
<<

Kenny

User avatar

Warrant Officer 1
Warrant Officer 1

Posts: 1016

Joined: Sun Mar 16, 2008 3:43 am

Post Sun Apr 21, 2013 1:28 am

Re: env_global custom states?

Wouldn't it be simpler to have it like so:

logic_timer set with a UseRandomTime spawnflag between 15 and 20 minutes, disabled by default. Once a soldier dies in an area, it will add 1 to a math_counter and start the timer. We use the math_counter value to determine how many soldiers to spawn. So if we only kill one unit, only one unit will be added to the persistent staffing of an area, while massacring everyone leaves the reinforcements to spawn completely. Once the timer dings it disables itself and next time the level spawns it will spawn the reinforcement_template.

The problem comes from figuring out how to only spawn X amount of new guards. It may be simpler to just preform cleanup of any older NPCs alive on the map by removing previous soldiers or cops from the world and spawning the reinforcement template. The other wrinkle is from deciding how to reinforce the area. If the player is NOT in the level, then the guards should start out already patrolling the area. If the player is IN the area, then they should be dropped in via dropship or dynamically repopulate the level from other spawn points in buildings or something.
Image
Next

Return to Level Design

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.