Building UWP Package with resources directory - how?

Started by
5 comments, last by trojanfoe 5 years, 7 months ago

Hi all,

I'm writing a game with a C++ core layer, originally targeting win32 but now with a UWP front end so it can target the X1's creators collection program. As part of this, I've used the templates (C++/WinRT with DR abstraction) from:

The way that the Win32 version works is:

  1. Build the various libraries / link them together to create Build\Spacegirl.exe
  2. Run a custom MSBuild project / tasks to create all of the game assets in Build\Resources 
  3. Use a step in TeamCity to take the contents of Build\Resources\* and selected other files from Build\ (i.e. the .exe and some settings files but not the .pdb files etc) into a zip file as a build artefact
  4. Release that build artefact to my testers

Note that I still intend to target a Steam release ideally and so I don't want to move wholesale to UWP.

I've not used UWP before so I'm a bit in the dark as to how it works, but I'm lead to believe that I need to build an app package and that's what's deployed to the X1 / PC etc. I'm expecting that what I'd like to do is change step 3 so that I can have an MSBuild target which can build the package. My questions are:

  1. How do I build the package, using wild-cards to specify the contents (ideally using MSBuild for consistency with the rest of my tooling, but executables etc. also good)
  2. How would I subsequently use VS to deploy this to my X1 and be able to debug it.
  3. Am I going about this all the wrong way? My aim initially was to keep all of the code separate from the data files in keeping with all the recommendations that I've read, but am I missing something?

Any help gratefully received.

Thanks

Steve

Spacegirl 29_08_2018 20_43_04.png

Advertisement

Check MSDN for docs on makeappx and signtool, you can generate the package yourself without using a bunch of integrated VS stuff that would require you to do all sorts of weird things to your vcxproj (like having all of the assets in there!). I set up a similar external step for our build to keep it more in line with how we prep the packages for other platforms.

I think our commands are something like:


copy PC\UWP-Release32\AppxManifest.xml PC\UWP-Release32\AppX

copy PC\UWP-Release32\game.exe PC\UWP-Release32\AppX

C:\Program Files (x86)\Windows Kits\10\bin\x86\makeappx.exe pack /d PC\UWP-Release32\AppX /p PC\game.appx

C:\Program Files (x86)\Windows Kits\10\bin\x86\signtool.exe sign /a /v /fd SHA256 /f ourkey.pfx /p privatekey PC\game.appx

 

In my UWP games I'm using the built in method (Project->Store->Create App Packages).

All assets unfortunately have to reside in the code directory or a child thereof. Simply add all files to the solution and set them to "Content=Yes" in their properties.

That way I never have to fuff around in a project file or include any manual build steps. I couldn't figure out how to have the assets in an external folder though (I wish I could, as I have a solution that builds the game for plain Win32 and UWP from the same code base)

 

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Isn't the idea that UWP is "sandboxed" like Mac apps and mobile apps in order to provide more security?  In that case they won't have access to anything external and only stuff in their own bundle.  I have some experience with Mac sandboxed apps but have only had a cursory look at UWP apps as I am considering them as a viable target platform.

Indie Game Dev

Thanks Everyone; I'll check out the MSDN docs for Makeappx. In the meantime, for development purposes, I've resorted to using folder explorer and copying over the necessary files to my application's directory.

@Endurion - Yes, without additional permissions, you can only access the application's directory / sub-directories. The main reason for not adopting your suggestion of adding files to the VS solution is that that would kill the rest of my workflow (the files that go into my package are the results of processing other files and so aren't suitable for being checked in artificially etc.)

@trojanfoe - as I understand, yes. Effectively you always have free access to files in your application's directory / sub-directories and can optionally be granted permission to other directories subject to declaring access rights accordingly. As to whether it's a viable target platform? The main advantage is being able to get everything running on an XBOX One / in the MS store (for PC / others) etc. The main disadvantage (at least for me) is that it's different to everything that I've ever used before (I've always been a developer, and not the person who's packaged apps for release which may well cloud my feelings)

I have been doing C++/DirectX 11 dev for a few months and this is greatly helped by DirectXTK and the VS templates provided by Chuck et al.  However I was a bit disappointed that Xbox UWP apps using DirectX 11 only use shader model 4 which could cramp my style if I wanted to play with compute shaders.  In order to get SM5 on Xbox/UWP you have to go DirectX 12.  Having said that, there is plenty to work with, resource wise, when going DirectX11.

Indie Game Dev

This topic is closed to new replies.

Advertisement