GF framework + XIL project integration

Project unity version: 2020.3.18f1
XIL version: commissions on Oct 26, 2021
GameFramework version: commitments on Sep 28, 2021
UnityGameFramework version: commissions on Oct 28, 2021
StarForce version: commissions on Aug 9, 2021
HFS version: 2.3

Project cloning:

StarForce clone Repository:
UnityGameFramework clone Repository:
GameFramework clone Repository:
GameFramework user manual to see the source code

StartForce source code configuration

1. Put the UnityGameFramework in StarForce\Assets\GameFramework
2. In StarForce\Assets\GameFramework\UnityGameFramework\Libraries, replace the dll with the GameFramework content. An error will be reported and the namespace reference is missing. Right click the Libraries directory Assembly Definition to generate an assembly named GameFramework, find UnityGameFramework.Editor and UnityGameFramework.Runtime, add a reference to the GameFramework assembly, and the error will disappear.
3. Check whether the unsafe code is ticked.

Simulate remote AB hot configuration

HFS virtual file server

HFS download address: HFS

AB configuration

The packaged directory structure is like this

Create a file named version.txt in the AB directory and check the AB configuration with json protocol. It is best to open the VersiongInfo.cs script to configure this file. After all, I don't know the code change. If I just copy my field, I have to fill in this hole.

namespace StarForce
    public class VersionInfo
        // Do you need to force the update of the game app
        public bool ForceUpdateGame

        // Latest game version number
        public string LatestGameVersion

        // Latest game build number
        public int InternalGameVersion

        // Latest resource build number
        public int InternalResourceVersion

        // Resource update download address
        public string UpdatePrefixUri

        // Resource version list length
        public int VersionListLength

        // Resource version list hash value
        public int VersionListHashCode

        // Compressed length of resource version list
        public int VersionListCompressedLength

        // Compressed hash value of resource version list
        public int VersionListCompressedHashCode

The VersionList data here is based on StarForce\AB\BuildReport StarForce \ ab \ buildreport \ 0_ 1_ 0_ XX \ buildlog.txt _1_0_XX\BuildLog.txt found

    "ForceGameUpdate":false,//Force update
    "LatestGameVersion":"0.1.0",//Latest game version number
    "InternalGameVersion":1,//Latest game build number
    "InternalResourceVersion":3,//Latest resource build number
    "UpdatePrefixUri":" ", / / server resource update address
    "VersionListLength":7104,//Specifically refers to the size of the GameFrameworkVersion.xxxxx.dat file
    "VersionListHashCode":2063015162,//GameFrameworkVersion.xxxxx.dat file hash
    "VersionListCompressedLength":2559,//Specifically refers to the compressed size of the GameFrameworkVersion.xxxxx.dat file
    "VersionListCompressedHashCode":-131527863,//Compressed hash of GameFrameworkVersion.xxxxx.dat file

Open the file StarForce\Assets\GameMain\Configs\BuildInfo.txt

  "GameVersion": "0.1.0",//Latest game version number
  "InternalGameVersion": 0,//Latest game build number
  "CheckVersionUrl": " ", / / server file version.txt address
  "WindowsAppUrl": "",//win resource server
  "MacOSAppUrl": "",//macOS resource server
  "IOSAppUrl": "",//ios resource server
  "AndroidAppUrl": "",//android resource server
  "END_OF_JSON": ""

Open HFS.exe and store Window64 and version.txt files in the full directory

Check whether all procedures are ticked

Remove the Editor Resource Mode check box

Package run.

Code hotter

XIL warehouse address: XIL
XIL user manual, see the official documents and source code

Configure XIL for StartForce

1. Put the three directories of Demo, hotScripts and XIL into the StartForce/Assets directory

2. Create a new HotProject in the StartForce directory ~ put the Hot directory, DyncDll.csproj file and Hot.sln solution in the XIL directory

Fix compilation errors

1.Hot.sln solution. Look at the dll reference in the solution. If the yellow warning is reported, it needs to be repaired,

2. Open DyncDLL.csproj file and modify the dependent path.

3. How to repair it? How to know what needs to be done and what doesn't need to be done. I adhere to the consistent principle and add it when necessary, such as Analytics (player data embedding point interface), Newtonsoft.Json (json tool), Purchasing.Common, UntiyEngine.Purchasing (IAP internal purchase payment interface), etc. I can directly delete them. I can modify the corresponding path of the machine if necessary.

4. The editor runs the demo to fix strange errors

5. Make preparations before the test.

1. In which GF process should the dll be loaded?

Procedure preload.preloadresource to load resources.

        private void PreloadResources()
            // Preload configs

            // Preload data tables
            foreach (string dataTableName in DataTableNames)

            // Preload dictionaries

            // Preload fonts

        private void LoadDLL(string dllName)
            string dllAssetName = AssetUtility.GetDLLAsset(dllName, false);


            m_LoadedFlag.Add(dllAssetName, false);

            GameEntry.Resource.LoadBinary(dllAssetName, new LoadBinaryCallbacks(
                (assetName, asset, duration, userData) =>
                    m_LoadedFlag[dllAssetName] = true;

                    wxb.hotMgr.DLL = asset;
                    wxb.hotMgr.isGF = true;
                    HelloWorld hellowrod = GameEntry.WebRequest.gameObject.AddComponent<HelloWorld>();



                (assetName, status, errorMessage, userData) =>
                    Log.Error("Can not load font '{0}' from '{1}' with error message '{2}'.", dllAssetName, assetName, errorMessage);

2. In what form does DLL type AB package?

Change DyncDll.dll to DyncDll.dll.bytes
Package and load in the form of Load From Binary.

3. What form of domain can Xil support now?

The demo example supports file loading. The GF loading framework of client packaged exe needs to be added to load the adapter with byte [].

		byte[] dll { get; set; }
        public EditorResLoadRuntime(byte[] dll)
            this.dll = dll;

        public Stream GetStream()
            return new MemoryStream(dll);

The complete code will be uploaded to the github repository
Warehouse address: GF-XIL
1. Install hfs and put the packaged resources and version.txt on it.
2. Change the UpdatePrefixUri of version.txt to your own ip address
3. Change the ip in BuildInfo file to your own ip address
4. Put the StarForce Launcher, Main and Menu scenarios into BuildSettings and package an exe that can run
5. If you want to run the demo in the editor, click Hotfix inject in Editor.

Starfrom + Xil integration summary

It took a day to get out and run. In the middle, because of the lack of documents, I have to gnaw the source code, and the progress is really slow.
Fortunately, we added a group, and everyone answered very warmly. Because there was a time difference between Q & A and made low-level mistakes, he delusionally gave dll AB package directly,
For this reason, the configuration and source code are also changed (unity can't package unrecognized assets (maybe the underlying packaging source code can be changed)). I don't deserve MD, hahaha.

In general, the online documents are detailed, and some details may be outdated. You still need to interrupt more and run the source code.

Tags: Unity Project

Posted on Thu, 25 Nov 2021 19:06:57 -0500 by Base