capturing the state of a map, and reverting

Avatar
BenVlodgi
633 Posts
Posted Apr 04, 2012
Does anyone know if there is a relativly easy way to capture the state of a map...like an autosave, but I would like to revert back to this state at will, specifically during coop
Advertisement
Registered users don’t see ads! Register now!
Avatar
ChickenMobile
2,460 Posts
Posted Apr 05, 2012
Replied 18 hours later
Reverting back to a save in multi-player is literally impossible (seeing as you cant save a multiplayer game).

I think the best thing you can do is have branches which activate once an important element in your puzzle has been completed. Then you can make objects spawn where you need them to be / turn on and off things based on the state of your branches.

e.g. If you want a checkpoint to happen when someone turns on a laser: have whatever output that turns on the laser change a branch state to 1 (make this only fire once). Once you want to revert back to this checkpoint 'Test' all branches which affect your puzzle elements and even if the laser has been turned off again the 'OnTrue' output will enable the laser again.

If you want to save the position of the players', you probably need to use some sort of script which grabs the player's position at that current moment and then resets it back to there when you want to revert.

EDIT: This is also overly complex so I suggest you use airlock-like devices like Valve did
EDIT2: I spelt Multiplayer wrong

Avatar
Lpfreaky90
2,842 Posts
Posted Apr 05, 2012
Replied 7 minutes later

chickenmobile wrote:
Reverting back to a save in multi-player is literally impossible (seeing as you cant save a multilayer game).

I think the best thing you can do is have branches which activate once an important element in your puzzle has been completed. Then you can make objects spawn where you need them to be / turn on and off things.

Saving EVERY variable you can possibly have and let a combination of logics be the solution to your map! not the output of some buttons but an insanely complicated logic :thumbup: Just kidding of course.

What valve did in their maps is working with the checkpoints/coop locks. If this is for the "humans die together" you can change the airlocks to have things like the vita-chambers from bioshock or something similar. The important thing is that if the players die in coop they shouldn't spent more then 2-3 minutes to get back to the position they were before, otherwise it could get frustrating.

I have no idea on how those checkpoints work since I've never made a coop level yet. But possibly you can have a button that does the same thing? If that would work you could consider adding a save button or binding one of the keyboard keys to do the same thing.

Avatar
BenVlodgi
633 Posts
Posted Apr 06, 2012
Replied 1 day later
New plan, No deadly elements!... all puzzles!
thanks for the info
The problem with scripts is the only thing they do, is just more complicated logic, they can not store data from your map (at least as far as I'm concerned), If I wanted to, I'd somehow have to dump that data to a file and later read from it
Avatar
ChickenMobile
2,460 Posts
Posted Apr 06, 2012
Replied 8 hours later

BenVlodgi wrote:
New plan, No deadly elements!... all puzzles!
thanks for the info
The problem with scripts is the only thing they do, is just more complicated logic, they can not store data from your map (at least as far as I'm concerned), If I wanted to, I'd somehow have to dump that data to a file and later read from it

I've been trying to figure this out for days. Try not to get yourself researching this too much because I am doing the same thing.

  • There is a code group called iFileSystem which can read and write to files, however you need access to gamecode to do this- There is a plugin you can install called EventScript. I was thinking you could save a parameter that noone uses (like xbox_throttlebias) and set it as a server_var through es. Only problem with this is the plugin doesn't work in Portal 2! (and also Valve has some kind of safe-mode activated and you have to disable it before plugins work anyway).- I was thinking you could bind a key to some kind of script (e.g. bind SCROLLLOCK "Ent_fire Script RunScriptCode function(input)" ) and then press the key through the console. Only problem: you cannot virtually press keys -> this was told to me by Garry Newman.- If es doesn't work, then probably .lua doesn't either (as it is also a plugin)- Give up
Avatar
BenVlodgi
633 Posts
Posted Apr 07, 2012
Replied 4 hours later

do you think using squirrel's File class would work?

http://www.squirrel-lang.org/doc/sqstdlib2.html#d0e159

using that I might be able to save&load from files that I make, probably name them the name of the map, and perhaps the session number, I could save player locations, and perhaps other things, like cubes, or the states of certain relays
then load them back in.

I'll see if that class works alright in portal 2 this weekend... otherwise I could write a c program to do the saving and loading, and try to embed it in one of the squirrel scripts

Avatar
Robdon
204 Posts
Posted Apr 07, 2012
Replied 53 minutes later
The file class doesnt seem to work, I had tried that before.

I would think they have probably removed/restricted anything that can write files, or it could be open up for abuse.

Rob.

Avatar
ChickenMobile
2,460 Posts
Posted Apr 07, 2012
Replied 4 hours later

Robdon wrote:
The file class doesnt seem to work, I had tried that before.

I would think they have probably removed/restricted anything that can write files, or it could be open up for abuse.

Rob.

This is true. My brothers friend (who was a scripter and did things for hl2dm) could literally change any file on your computer. Even windows files etc (and make your computer not start up etc.)

Avatar
Lpfreaky90
2,842 Posts
Posted Apr 07, 2012
Replied 10 minutes later

chickenmobile wrote:
This is true. My brothers friend (who was a scripter and did things for hl2dm) could literally change any file on your computer. Even windows files etc (and make your computer not start up etc.)

awesome :lol:

Avatar
BenVlodgi
633 Posts
Posted Apr 08, 2012
Replied 15 hours later
do any of you know how you coop progress is saved...like how the game knows you've completed certain mains, because if we could access that... bam we're good
Avatar
ChickenMobile
2,460 Posts
Posted Apr 08, 2012
Replied 55 minutes later

BenVlodgi wrote:
do any of you know how you coop progress is saved...like how the game knows you've completed certain mains, because if we could access that... bam we're good

Game code (which we has no access to)

https://developer.valvesoftware.com/wik ... _functions

MarkMapComplete is the one you want to look at.

Avatar
BenVlodgi
633 Posts
Posted Apr 08, 2012
Replied 16 hours later

chickenmobile wrote:
BenVlodgi wrote:

do any of you know how you coop progress is saved...like how the game knows you've completed certain mains, because if we could access that... bam we're good

Game code (which we has no access to)

https://developer.valvesoftware.com/wik ... _functions

MarkMapComplete is the one you want to look at.

thanks for the list
.... Valve is on vacation right now, when they get back I'll ask some people how plausible it would be to either give us limited IO capabilities, or have them integrate a save/load for coop, I think they'll be back either tomorrow, or the day after. So I suppose we'll have to wait till then

unless you think it would be easy enough to just have the script call a c program... o_O

Avatar
Lpfreaky90
2,842 Posts
Posted Apr 08, 2012
Replied 2 hours later
That should be impossible; if you can break out of squirrel into c; you can hack in everywhere. That's why they closed that path didn't they? :wink:

The problem with the savegame is mostly de-sync I think. Saving and loading need to happen at the same time or it might cause problems. That's why I suppose they didn;t use this but the airlocks in game too.

Avatar
ChickenMobile
2,460 Posts
Posted Apr 09, 2012
Replied 4 hours later

BenVlodgi wrote:
thanks for the list
.... Valve is on vacation right now, when they get back I'll ask some people how plausible it would be to either give us limited IO capabilities, or have them integrate a save/load for coop, I think they'll be back either tomorrow, or the day after. So I suppose we'll have to wait till then

unless you think it would be easy enough to just have the script call a c program... o_O

Do you have Valve's number? I would like to ahem contact them...
img

Avatar
BenVlodgi
633 Posts
Posted Apr 09, 2012
Replied 12 hours later

chickenmobile wrote:
BenVlodgi wrote:

thanks for the list
.... Valve is on vacation right now, when they get back I'll ask some people how plausible it would be to either give us limited IO capabilities, or have them integrate a save/load for coop, I think they'll be back either tomorrow, or the day after. So I suppose we'll have to wait till then

unless you think it would be easy enough to just have the script call a c program... o_O

Do you have Valve's number? I would like to ahem contact them...
img

lol no, I'm pretty sure they don't have a phone number, I just email, or steam chat them

Avatar
ChickenMobile
2,460 Posts
Posted Apr 09, 2012
Replied 23 minutes later

BenVlodgi wrote:
lol no, I'm pretty sure they don't have a phone number, I just email, or steam chat them

Steam chatting Valve would be pretty handy. Whenever I have an epic SDK problem and ask steam support or hlmappers / coders I never get an answer.

Advertisement
Registered users don’t see ads! Register now!
Avatar
BenVlodgi
633 Posts
Posted Apr 09, 2012
Replied 1 hour later

chickenmobile wrote:
Steam chatting Valve would be pretty handy. Whenever I have an epic SDK problem and ask steam support or hlmappers / coders I never get an answer.

It has been, just a few weeks ago I was talking to a couple of them about how to try to get coop to work in mods, and they didn't know that it was even broke. So we went through a few different ways to try to make it work manually, but it turns out its def a hard coded problem, so hopefully that bug will get fixed... lol now that they know about it... he said that if they are able to fix it, it will probably be after the DLC_02