Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate adding support for displying Frostfall warmth ratings #15

Open
3 tasks done
Odie opened this issue Oct 9, 2018 · 14 comments
Open
3 tasks done

Investigate adding support for displying Frostfall warmth ratings #15

Odie opened this issue Oct 9, 2018 · 14 comments

Comments

@Odie
Copy link
Owner

Odie commented Oct 9, 2018

I'm told there is very little alteration needed to make this happen. See: #3 (comment)

Things to figure out:

  • Find out how to detect when Frostfall is running
  • Figure out how to get warmth rating
  • Figure out which screens need alteration
@grc472
Copy link

grc472 commented Dec 14, 2018

I have managed to get the CC survival mode working for the most part on VR. I can't share it for obvious reasons, but it occurs to me that you can define the answer to your first two bullet items in a way that can be generically used by any mod that has the concept of warmth ratings. If you provide a Papyrus script that stubs out a few functions, such as

bool function UsingWarmthRating()
return false
endfunction

float function GetArmorWarmthRating(Armor akArmor)
return 0.0
endfunction

float function GetActorWarmthRating(Actor akRef)
return 0.0
endfunction

Then it is up to the mods to overwrite your script with one that returns the appropriate values. Is that too simplistic? It won't work with Frostfall out of the box, but someone could easily make a VR patch for Frostfall that implements that script by calling into Frostfall's API. I could implement it for myself for my Survival Mode mod.

@grc472
Copy link

grc472 commented Dec 14, 2018

One of the things I don't know how to do for my VR Survival Mode is to get the snowflake and sun icons to appear next to the compass. I don't know if you can provide a generic API for that or not, because I'm not sure how it works. Presumably one of the SWF files needs to support that. I bet Frostfall enthusiasts would like to have something like that as well.

@Odie
Copy link
Owner Author

Odie commented Dec 29, 2018

I haven’t Looked into any of the custom widget stuff for SkyUI. I’m not sure if it will ever work. In VR, it looks like you have to provide some polygons to map the scaleform UI onto. See the compass as an example. I’m not sure if there is an api to do that.

@angrmgmt
Copy link

angrmgmt commented Dec 29, 2018

Continuing the discussion from this issue, #3 , and #28 :

@chesko256 originally included the SWF files from SkyUI with his warmth/coverage edits alongside his own meters, and sthagg repackaged them all as a patch using updated files once SKSE64 was released; could we (I) not simply do the same thing? No need to rebuild SkyUI around SE content this way, just release (under MIT) a new VR version of sthagg's patch, with edits as necessary to the decompiled (or downloaded) source files. Chesko said he is pretty well done with modding (I was a patron on Patreon, so I got the "Signing Off" message when he shut it down), and this release of SkyUI moves the goal posts for him, so to speak. There's no reason to believe he would want to jump through this additional hoop to do the work himself after having just gotten the base scripts updated earlier this year for the SE version of SkyUI.

This also allows SkyUI to remain pure, and while I doubt (as @Odie mentioned) we'll be able to have the widgets, there was always the text option ("You are freezing!", "You are soaked!", etc.) From my testing, everything in Campfire/Frostfall seems to run fine aside from the fact that with its SWF files loaded, you can't interact with the UI because the buttons aren't mapped properly, and without the SWF files you get no warmth/coverage info from your gear.

I have a rudimentary workflow of JPEXS (or the source files, not quite sure which I prefer yet), WinMerge for diff/merge for the new SkyUI VR changes, and FlashDevelop with the Flex SDK set up to try to do the port, unless someone with actual flash experience wants to try. I'm a novice with anything outside C++, .NET, or MATLAB (or JS, I guess), but I WANT this mod.

Thoughts?

@Odie
Copy link
Owner Author

Odie commented Dec 29, 2018

Well, it’s been a little while since I looked into this. From what I remember...

I ran the frostfall’s UI files through JPEX and compared with the source of SkyUI-VR. It looked like the the code changes were quite isolated and would be easy to port over. The effort was abandoned since papyrus util wasn’t available and no warmth ratings were being retrieved. The code might still be in a branch on my machine somewhere. I’ll push that here so we have something to look at.

The architecture of SkyUI doesn’t lend itself very well to external modding. There are no mechanisms for plugging in new behavior. This means to be able to deal with frostfall, we either have to keep a separate fork/branch for frostfall changes, or, if the changes are minor enough, to just include the additional logic and allow for it to be conditionally enabled. Not sure what is the right way to do this.

I don’t think you can build swfs for scaleform with the Flex SDK. You need to use Adobe Flash Professional for this. I don’t have any experience with these tools beyond my time working on SkyUI-VR, so I can’t say for sure. I did a minimal amount of googling for this. If at all possible, I’d prefer using flex just so the scenes are kept in source control friendly text file and for there to be a command line build tool.

Supposedly, actionscript is a dialect of ECMscript. So your experience with JS will be pretty handy. Internally, the why thing work doesn’t look too far from typical GUI toolkits. If you’ve had any experience working on GUIs, it shouldn’t be too difficult to get into.

Do let me know if you need help setting up the tools. It was a bit daunting to get started just figuring out how to build the thing.

@angrmgmt
Copy link

I'll take any help I can get. My first jump into FlashDevelop ended with me reading several manpages and StackExchange threads, all of which said my File menu should have a "Publish Options" item, which it does not. I figured out how to link the Flex SDK 4, and both of the projectors from Adobe (the base projector and the debugger), but I can't yet actually package the SWF. That's where I'm stuck right now, but I'll keep looking into it. Building for Scaleform might be a problem, especially since it's deprecated after AutoDesk bought it and killed it 3 years later, but I'm not sure what the difference is; is it simply the inclusion of the image and text assets? I feel like SWF should support at least sprites natively, right? This thread on the FlashDevelop forums makes it sound possible, though perhaps I'll also need the UDK? Like I said, I'll keep looking but if you have any advice, I'd appreciate it.

I started with bottombar.swf, and have the remaining 5 "compatibility" SWF's left to diff/merge and recompile/rebuild. If you've done them all already, that would save some time!

For reference that list is:

  • bartermenu.swf
  • bottombar.swf
  • containermenu.swf
  • craftingmenu.swf
  • inventorymenu.swf
  • itemcard.swf

Each of which features changes to support display of warmth/coverage.

I think getting these put together would give a good starting place for testing in-game to see if any other problems crop up.

Regarding:

The architecture of SkyUI doesn’t lend itself very well to external modding.

I think this has always been, and will always be a problem, but once SkyUI for Oldrim was stable, the files remained intact, and I think getting a stable v1.0 release of SkyUI VR would be a good milestone. If you think there is anything else we can do about it, I'm all ears (eyes?), but I think we might just be stuck with the dual-update problem if we want Chesko-brand survival in Skyrim VR. The amount of work he has done is staggering, and I'm loathe to do it over again.


Now for the really bad news (mostly for me):

I'm entering the last year of my PhD, and I only have about a month before I need to dive head-on into preparing my dissertation. I can't take this on as a full-time project, so anything I do between now and then will be as-is, and I'll have to hope that it either works right away and stays that way, or that someone else will be able to continue work on it. ;[

@angrmgmt
Copy link

angrmgmt commented Dec 30, 2018

Two questions:

  1. Which of the scripts (in, for example bartermenu.swf) is the entry script? I reconfigured the IDE and I'm going to try compiling now, but I need a place to start and I didn't see a 'Main.as' in any of the directories here. The similarly named file doesn't start with package, which apparently is required of an AS3 project (for example BarterMenu.as begins with a class def. by extension of ItemMenu). It also seems none of the files contain any imports. Don't we need to import flash.display.Sprite or flash.display.MovieClip to extend in other class defs?
    Alternately does Flash Pro allow you to compile without an entry file? Or to multiple SWF's from a large set of files?

  2. I noticed while going through the diffs (almost halfway done, was taking a break to try re-configuring the IDE to compile one) that a lot of the _locN_ values had differing N (integer from 2-12). Was that your edit or Chesko's? I kept SkyUI's values for N...

Edit: A note on the three task items for this issue: the third item can be considered solved. The list of SWF files in my comment above gives the list of screens in need of change. The edits include small changes like minor image edits (truncated bottom divider to allow the warmth/coverage rating in item list interfaces) to current warmth/coverage rating changes on equipment change, or changes to the item card when a new selection is made. Each of them features some set of changes like this.

@Odie
Copy link
Owner Author

Odie commented Dec 30, 2018

  1. How do you compile this thing?

For each of the swf files you want to compile, you’ll see a corresponding fla file. That file contains art assets as well as the layouts. It’s a proprietary binary format. Flash pro uses it as the project file. Once that’s loaded, there is a “publish” menu item that takes all the assets and any referenced source code and compile it down to a swf.

Take bartermenu.swf for example, there is a matching fla file, src/ItemMenus/bartermenu.fla. There is will also be a bartermenu.as, which you can kind of think of that as the entry point. (The actual entry point is elsewhere, but you’ll probably not be very interested in that unless you want to go slightly below the app logic level.) There should be a root level movie clip that will be linked/connected to an instance of bartermenu when the menu is opened.

  1. “LocN”

Not sure what exactly where you’re seeing these. I’m pretty sure SkyUI was also decompile from the version shipped by Bethesda at some point. When decompiled, the local var Info is lost so you get these LocN variable names instead.

@Odie
Copy link
Owner Author

Odie commented Dec 30, 2018

I just pushed the experimental work I did for Frostfall compatibility. You can find it here:
https://github.com/Odie/skyui-vr/tree/feature/frostfall-compatibility.

Note that I only got enough to start checking if the warmth ratings came through. As mentioned, when I discovered that things didn't work because papyrus util was missing, the work was "placed on hold". =)

@angrmgmt
Copy link

...you’ll see a corresponding fla file...

Okay awesome, I've read about that; it's basically the SWF's "lib" file... prototype... thing. Thanks!

Not sure what exactly where you’re seeing these.

Everywhere. Seriously, they're all over. That makes perfect sense though, just locals (hence the '_'). As long as they're consistent it won't matter, very reassuring.

I'll see about giving the frostfall-compatability repo a look-over and maybe a pull req? Depends on what I find there. :)

Thanks a lot, Odie.

@angrmgmt
Copy link

angrmgmt commented Jan 3, 2019

Do you think items 1 and 2 can be answered by the FrostUtil API?

For example, implement FrostUtil support, then Test a call to GetFrostFallVersion() for equality with None?

Alternatively, listen for the Frostfall_Loaded Event so that you only enable support when Frostfall loads or when starting a game with it already loaded.

Then you could check warmth/coverage by GetPlayerWarmth() and GetPlayerCoverage().

For a totally different approach, doesn't Frostfall have to like... register for an MCM entry? Could you listen for that or just scrub the list of MCM mods for it? Leaves the warmth problem unsolved, but it's a start.

I still think item 3 is pretty well sorted by the changes to those 6 files I mentioned previously. I'll be happy to provide the results of the diff/merge I did.


In other news, I'm getting nowhere trying to compile the SWF's, because I can't get a legitimate version of Flash Professional ("Animate" since 2015, apparently) that supports AS2, so none of the scripts load when I open the FLA's except a couple scripts for sprites with nothing but stop() in them. I'm about ready to give up on that path, which is why I suggested the above.

@Odie
Copy link
Owner Author

Odie commented Jan 3, 2019

So... we're dealing with a situation here where we have to perform interop between native code (game, skse), papyrus VM, and scaleform VM. It's clear how to perform interop bidirectionally between skse and scaleform. It's clear how to make calls from papyrus => skse. So we have something that looks like:

papyrus => skse <=> scaleform

So, given this... of the solutions proposed:

  1. Call FrostUtil
    It's not clear how to call the papyrus function from scaleform. =(

  2. Listen for Frostfall_loaded
    This should be doable. Listen for the event, save a flag, forward the flag when a menu is opened.

  3. Check for MCM entries
    While the UI does receive a list of mod names from papyrus, this currently only happens when the pause menu is opened. It doesn't appear to happen any other time. I suppose it would be possible to have this list sent whenever a menu is open. But I'm not sure if this is better than solution 2.

  4. Add a skse plugin
    It would be pretty straightforward to add a plugin to give scaleform access to the skse function that backs GetModByName. The UI can then make that call/check whenever it wants without having to deal with potential coordination issues from 2 and 3.


Regarding those FLAs... and the "missing code"...

Let's take for example "inventorymenu.fla". Open that and open the library panel. Find the "InventoryMenuObj", right click and bring up the properties window. Right in the middle of that dialog, you'll see "class: InventoryMenu". This refers to the "InventoryMenu" class defined in "InventoryMenu.as".

So... I think of Flash Pro as a clunky tool for putting together the display list/tree/hierarchy. It's good setting up basic layouts and animations. It does a rather poor job at showing you the exact tree of widgets you have at any one point in the animation timeline. It's really an animation-centric tool.

Personally, I'm using Flash Pro 6 to compile the swfs. It seems to work fine. Also, if you're compiling files in this repo, you'll want to use "misc/Flash Util/build-all.jsfl" to build all the relevant fla's in one go. If you're using WSL and have ruby installed, you can use "misc/cp-built-files" to watch your build directory and copy relevant new/updated swf files to your mod directory. These two scripts makes it easier to compile & run your changes without a bunch of manual mouse work.


BTW, if you want to chat in realtime, you can find me as Odie#2665 on the "Bethesda VR Unofficial" server.

@Odie
Copy link
Owner Author

Odie commented Jan 5, 2019

Sorry, somehow, I asked you to meet on Discord, then left Discord unopened for 2 days. Will make sure to have Discord running in the future. x)

@angrmgmt
Copy link

angrmgmt commented Jan 5, 2019

Forked the compatibility branch and started work at this repo. Please feel free to come laugh at my miserable failure. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants