Jump to content

Game State realtime export (possible or exists ?)


potens

Recommended Posts

Hi everyone,

 

This is my first post on nexus, so in in a few words, I'll present my self here. I've been player Skyrim for a long time but did not finished the main quest yet (long time, but not continuously), I'm a programmer for a living.

 

So, first of all, people taking their personal time to mod a game are great ! Thanks to them, lots of other can enjoy game better than vanilla, for free. And until now, I was enjoying their work with saying "Thank you, all of you !", mistake corrected now.

 

Now, for the question.

 

Does a mod that let you export game state to another process exists ? I mean, i.e., your inventory, where you are in the wold, what are the current selected objectives, and so on ?

If this mod does not exists (I'm looking for it for a while, but it seems I don't find the correct word to express it in a search), do the experienced modders think it is possible to do something like that ? I've read a bit (and I know, it's not enough right now) of doc, and the only idea I've come through is the logging system in skse (but I've to look further to find if exploitable), let's say, if I've to go through this way, I've to find what are all states available, what can be outputted, and, if this is possible to output it to, in example, a named pipe or something like that.

 

The aim for that is to let another process on the pc react or display events and status along the play.

 

If this is not possible, (and even if this is, since it will be an easier step), I'll work with savegame, monitoring the update time of savegame and then parse it to use it (I've written a little parser yesterday evening, to see how hard it was (just the beginning of a parser, to be honest))

 

The final aim I've in mind is to create a "second screen" for skyrim, this has already been talked about in this forum (I've found a post of 2012, without answer), to have some "webapp" show things in a browser, i.e: you can create one zillion of health regen potion because you have a gazillion of ingredients, you know those effect, you are tired, the current magic effects on your player are...

 

What will be available will depend greatly of what data I'll be able to extract.

 

Any thought ?

 

PS: I told it was already talked about, and no body answered, I know it means maybe no one care, but I'm sure if it exists, don't eat half the processing power of your pc and does not need to understand quantum physics to use, people can enjoy to have this possibility

 

Link to comment
Share on other sites

On a technical level this seems like an interesting problem to solve. If you want to do prototyping, then you could probably use PapyrusUtil, JContainers, or FISS to output data to a text file from Skyrim's scripting system. NW.js or Electron could be used to watch those files and display the information. You would probably have to create an SKSE plugin at some point to get access to some of the data you are interested in (e.g. description fields in magic effects) that is currently not available even via SKSE's additions to Papyrus (mainly because the information is not relevant to game mechanics).

 

However, a few things to think about:

- Think about how the data is handled and its persistence in the context of the player's ability to load a save game at any point.

- Is this data not available for the player to view already? If it is visible, then is the intention to make it more convenient to view in certain circumstances?

- Why not implement this in the game (e.g. as a separate menu, a HUD element with the help of SkyUI's framework)?

- Real-time access to data might be tricky, but event-based or regular (every N seconds) updates may work. What can be done within such limitations?

- How will you take into account modded content (e.g. in terms of maps/player location info)? Relying on static information from a wiki is not viable in most cases.

- What would the user experience be like (e.g. would one be forced to switch from the game window to the second screen to do stuff like changing what is displayed)?

Edited by mrpwn
Link to comment
Share on other sites

I threw together a quick and very dirty prototype for showing the player's position in Skyrim. Here are two screenshots southwest of Solitude and north of Riften (a red X marks the player's location):

- A Papyrus script outputs the player's X and Y coordinates as a JSON-formatted text file with the help of JContainers.

- A Python script scales the coordinates and passes the generated values to a Rainmeter skin, which is displayed on a secondary 1280x1024 monitor, every 5 seconds.

- The Rainmeter skin positions a red X on top of a map I stitched together from multiple screenshots of this map of Skyrim.

Edited by mrpwn
Link to comment
Share on other sites

Hi mrpwn,

 

Thank you for your very enlightening answers, here are my thoughts about it.

 

For some of the needed values, I can get them from the savefile, I'm working on that for the magickal effects, what I'm writing is parsing the modlist at beginning to "guess" the available ingredients for potions and have magical effects available, not very far in the process yet but I'm pretty confident to succeed in this, I think at start, I'll need some external list for each mod, later, I'll see if I can get that from esp (with the help of things like https://github.com/sinanonline/SPyrim)

 

- About the load game, I don't know (yet) anything in available events in papyrus about it, but if there is a event pop on load, this will not be a problem.

- Why I prefer (and it's a biased view) to implement it out of UI, is because, I'll try to have something the lighter possible for the poor-old-and-struggled skyrim engine, so, if possible, what I'll do is some "fire and forget" mod that will only transmit event to a process outside of skyrim (I'm still playing on 32bit version, and I'm at a step when, I think, I should not ask a lot more without making of lot of prayer to the Eights each time I load a game or I enter into a new cell (and sometime, I sell my soul to some Daedric prince as a bonus, to be sure (Sanguine, if you wnat to know))), that, and the fact lots of information I would like to have will over encumber the screen.

- Some information are indeed already there (i.e. position on map), but, each time you must check, you have to go to the map, and, I don't know you, but on my computer, sometime, it takes 4-5s just to have the map. (and sometimes, the same if from there, I want to see the quests)

- In fact, if you don't loose the sync, event based and real time are the same, the process outside skyrim will manage to keep reference and apply change to its internal state before transmitting data to the "other ui", polling will be my very very very last choice

- For the modded content, I don't have answer yet, I'm not far enough right now. I guess this is always possible to extract all needed data from save+esp, but it sounds like this will be pretty big work (I suspect it, I don't have much knowledge right now)

- About the way to manipulate the ui, there are several cases:

- the user use it on what is called "second screen" (tablet, phone, other pc, whatever), the control is done from this second screen.

- the user is on multiple displays, what I've in mind is to be able to define shortcuts in the mod, and when those shortcuts are caught, the mod just send some predefined values to "the other process" and this other process will send the info back to the ui to apply change.

Those are not excluding, you can have the "second screen" reacting to shortcuts ! (in fact, you can also have the two at once, browser on a second display, and control on a second device)

 

I'm not very far right now in the whole thing, and I miss a lot of knowledge on skse and papyrus to achieve that. My first step will be to be able to complete parse savegame and react each time a new save is done (easy watch on file list). What will be hard (first pass analysis) is what is happening in skyrim,

 

My main objective is the "second screen (other device)" XP, but, nothing avoid the browser on the second screen on the same pc, the thing will work client/server style, this could be a good candidate for some mobile app, but, I hate those "**** FREE" and "**** PRO" that ask you to give access to full network + media + SMS + mobile id + bank account,... so, browser "web app" (and those days, you are pretty able to do anything with that). but, as the thing will be client/server, and open, if someone want to do another ui, he/she will be free to do it.

 

My main concern is papyrus/skse, I don't know anything right now, so I'll have to go through the process to learn those, but this will be the second step, after being able to read and react to save, then, I'll post what is working and then see if someone is interested by what is going on and if there is value to continue.

 

JContainers and FISS where already on my radar, I've to check if there are ways to use it without creating real files (i.e. named pipe) since, I think, it's not very clean to create a file each time you have to export values (performance wise + technical reason like ssd wearing)

 

Thanks a lot !

 

PS: for the records, and since you mention it, it will be in python

PPS: Is you proto available somewhere ? (with source ?)

Link to comment
Share on other sites

 

 

For some of the needed values, I can get them from the savefile, I'm working on that for the magickal effects, what I'm writing is parsing the modlist at beginning to "guess" the available ingredients for potions and have magical effects available, not very far in the process yet but I'm pretty confident to succeed in this, I think at start, I'll need some external list for each mod, later, I'll see if I can get that from esp (with the help of things like https://github.com/sinanonline/SPyrim)

 

Reading data from multiple sources (savegame, plugins, and potentially from the Skyrim process) may turn out to be a decent solution (e.g. some things only need to be read once, unavailable or cumbersome to access from some sources).

 

 

 

- About the load game, I don't know (yet) anything in available events in papyrus about it, but if there is a event pop on load, this will not be a problem.

 

There is an event in Papyrus for when a savegame is loaded, but you won't know which particular savegame is loaded.

 

 

- Some information are indeed already there (i.e. position on map), but, each time you must check, you have to go to the map, and, I don't know you, but on my computer, sometime, it takes 4-5s just to have the map. (and sometimes, the same if from there, I want to see the quests)

 

I'm already playing around with the idea of a map system that would allow the player to do their own map making while playing:

- Buy a basic map with just the major cities and settlements marked on it.

- The player could add their own map markers.

- More serious roleplaying could be facilitated by requiring the player to use an in-game map and compass to figure out where they are (update position on the map) and their heading.

 

Custom maps that look hand-drawn could be made. Tabletop RPG communities have plenty of suitable resources like brushes available for this kind of stuff. I've always been annoyed by the pin-point accuracy of quest markers in Skyrim and this map system could be made to point at an approximate area (e.g. circle containing the exact spot, but not centered on that spot). Dialogue and quest objectives don't always give enough info to be able to completely remove quest markers, but maybe the aforementioned idea could be a decent compromise.

 

Mapping would probably be limited to large worldspaces (e.g. Skyrim, Solstheim) unless one wanted to figure out how to generate local maps based on the loaded plugins. By the way, the prototype does seem to also work quite well when entering a city worldspace (e.g. Whiterun) and the player position remains quite accurate on the Skyrim-wide map when moving through a city.

 

Not sure how one would handle the discovery of locations, if one wanted to retain that from the map system in Skyrim. There is a Papyrus function that could be used, but it would require polling to find the markers and it would ignore the discovery radii set in the markers.

 

 

My main concern is papyrus/skse, I don't know anything right now, so I'll have to go through the process to learn those, but this will be the second step, after being able to read and react to save, then, I'll post what is working and then see if someone is interested by what is going on and if there is value to continue.

 

The official wiki contains quite good documentation on the language specs and some tutorials. Should not be difficult since you already have programming experience.
I'll take the opportunity to plug one of my projects, SublimePapyrus, then as it might make it a bit easier for you to get started with Papyrus. It's a package for a text editor called Sublime Text (major versions 2 and 3 are supported) and the package includes stuff like syntax highlighting, a linter, intelligent auto-completion based on Papyrus source files found in the import folders that you can define in a settings file, build system, etc. At least the auto-completion means less memorization and looking up of functions on the wiki. SublimePapyrus also happens to be written in Python, if you want to have a peek under the hood/modify/contribute.

 

 

JContainers and FISS where already on my radar, I've to check if there are ways to use it without creating real files (i.e. named pipe) since, I think, it's not very clean to create a file each time you have to export values (performance wise + technical reason like ssd wearing)

 

Wearing down SSDs crossed my mind as well and I agree that it would be better to use a socket or pipe. I think that would have to be implemented in C++ as an SKSE plugin to get data from Skyrim. My C++ knowledge is very basic and it has been quite a while since I last wrote C++ code.

 

PPS: Is you proto available somewhere ? (with source ?)

 

Not at the moment. I could probably clean it up a bit and host it somewhere, if you want to test it or have a look at it. It ain't pretty though.

 

I might end up working on at least a map system as described above when I find enough time for it. If you want to collaborate (even if just on small parts), then I'd be up for it.

Edited by mrpwn
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...