Announcement

Collapse
No announcement yet.

Unable to package a custom game mode

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to package a custom game mode

    Howdy folks. I've been playing the game for the last few months in the instagib ctf community at unreal-battles discord. Mostly enjoyed it but the spawn system in instagib is broken.

    It's the biggest reason for people in that group to stop playing so I wanted to try and fix it. A quick look at the source made it pretty clear what the problem was (an "if instagib" flag which bypasses logic to stop people spawning right next to each other) so assumed it would be easy.

    I've spent a couple of days now getting to grips with things and am stuck now at the last hurdle.

    What I've done so far:

    Cloned the release branch on github (https://github.com/EpicGames/UnrealT...t/tree/release) and followed the getting started steps to set everything up.

    Followed the guide on the wiki (https://wiki.unrealengine.com/C%2B%2..._Mode_Tutorial) to create a C++ game mode (iCTFPlus). It's fairly simple and just overrides AdjustNearbyPlayerStartScore in UTGameMode to reintroduce distance checks in instagib and tweak the distances a little bit. It's set up exactly as the guide with a few C++ classes to extend UTCTFGameMode and do the override and a blueprint to do the basic game settings.


    Run the mode from the console with the command
    Code:
    /Engine/Binaries/Win64/UE4Editor UnrealTournament -game ctf-face?game=/iCTFPlusGameMode/BP_iCTFPlusGameMode.BP_iCTFPlusGameMode_C
    This starts up fine and I can see from some logging that my new logic is being called on spawn. So far so good.

    Next up is to package it up, make sure it works then get it onto the server. This is where I'm stuck.

    Based on a combination of a guide on the wiki https://wiki.unrealengine.com/Cookin...eal_Tournament) and some help from someone else I've successfully built a .pak by creating an empty map in my content directory using the editor then run the following command in console
    Code:
     /Engine/Build/BatchFiles/RunUAT.bat MakeUTDLC -DLCName=iCTFPlusGameMode -platform=Win64 -version=3525360
    Where version = the number shown on the homescreen of the current UT released game.
    At this point I thought I'd be able to chuck that .pak into the folder with the downloaded content at Documents\UnrealTournament\Saved\Paks\DownloadedPaks, start up the game and see my game mode available when starting a game. Instead the game crashes when I try and start a new game locally.

    From browsing the forums and talking to some other people who have done some modding I was pointed towards this post https://www.epicgames.com/unrealtour...github-release as the reason for this. Tried to get some help in discord but got nothing and I am guessing there's not much help to get here either if it's that the community sources aren't up to date, but thought I'd post on the chance that either someone has a magic solution or someone at Epic will wake up and solve the problem.
    Last edited by Synapse-; 08-13-2017, 09:13 AM.

  • #2
    I tried again based on a post from Winter in the linked forum post:

    Originally posted by Ϣίητεѓ View Post
    The release branch is very close to the master branch since UT is on hold since kinda latest release.
    Solution/trick for testing mods with current release using the master branch.
    Edit version.h and change BUILT_FROM_CHANGELIST property to fit with release version number (3525109)


    With that i was able to test my mod on UT4 server.
    Basically just switched my local github to the clean-master branch, modified version.h with the new version number and rebuilt UnrealLightMass, ShaderCompiler and UnrealTournament projects before re-running the package command:
    Code:
      /Engine/Build/BatchFiles/RunUAT.bat MakeUTDLC -DLCName=iCTFPlusGameMode -platform=Win64 -version=3525360
    I get the following in the log:
    Code:
    [2017.08.13-13.21.07:050][144]LogWindows:Error: === Critical error: ===
    [2017.08.13-13.21.07:050][144]LogWindows:Error:
    [2017.08.13-13.21.07:050][144]LogWindows:Error: Fatal error: [File:D:\Build\++UT+Release-Next+Full\Sync\Engine\Source\Runtime\CoreUObject\Private\Misc\PackageName.cpp] [Line: 381]
    [2017.08.13-13.21.07:050][144]LogWindows:Error: LongPackageNameToFilename failed to convert '/iCTFPlusGameMode/iCTFPlusGameMode'. Path does not map to any roots.
    Not sure if there was meant to be more to what Winter posted than just doing that but the simple approach hasn't worked for me.

    I've uploaded the current state of the game mode to github if anyone feels inclined to take a peek:
    https://github.com/tristanmccarthy/iCTFPlus
    Last edited by Synapse-; 08-13-2017, 09:32 AM.

    Comment


    • #3
      Have you started the editor once with the plugin installed? ... respectively is your "Content" folder added to the Paths definition in the Engine.ini file under [Core.System]?

      Such as:

      \UnrealTournament\UnrealTournament\Saved\Config\Windows\Engine.ini
      Code:
      [Core.System]
      Paths=../../../Engine/Content
      Paths=%GAMEDIR%Content
      Paths=../../../UnrealTournament/Plugins/ContentOnly/Content
      Paths=../../../UnrealTournament/Plugins/SampleGameMode/Content
      Paths=../../../UnrealTournament/Plugins/iCTFPlusGameMode/Content

      Btw.
      Winter/XtremeXp talked about compiling/building a compatible mod and not specifically packaging. One is for source compiling and the other for asset "cooking".

      PS: What is the "BP_iCTFPlusGameMode.uasset" asset doing what you can't do with C++. If you don't need any assets, you also don't need to package/cook any content.
      PPS: ChoosePlayerStart and FindPlayerStart are fine for Blueprints. The only problem you might have, GameMode::RatePlayerStart can't be accessed from Blueprint which you have to re-implement in pure-Blueprint.
      ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
      ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

      Comment


      • #4
        Paks don't work for C++. Build produces DLLs that you need to send to people who want to play you'd mod. There is not automated delivery pipeline for C++, either.
        HABOUJI! Ouboudah! Batai d'va!
        BeyondUnreal - Liandri Archives [An extensive repository of Unreal lore.] - Join us on IRC [irc.utchat.com - #beyondunreal]

        Comment


        • #5
          Originally posted by Sir_Brizz View Post
          Paks don't work for C++. Build produces DLLs that you need to send to people who want to play you'd mod.
          Content plugins required to be packaged (cooked). It's the same for "C++" plugins which than have to be compiled for the editor, all the clients platforms and all the server editors (with Editor and a single client being the minial targets you need to build the source for).

          Originally posted by Sir_Brizz View Post
          There is not automated delivery pipeline for C++, either.
          Could be solved with a plugin loader in C++ for any future mod. It shouldn't be that hard. Also, there could be some tricks to actually get DLLs-in-PAKs being "supported" by the engine.
          ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
          ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

          Comment


          • #6
            Having C++ in Paks is feasible and used to work. It was disabled because of security concerns. I wasn't trying to imply that there couldn't be a delivery pipeline for C++ mods, but that one doesn't exist and probably won't ever exist.
            HABOUJI! Ouboudah! Batai d'va!
            BeyondUnreal - Liandri Archives [An extensive repository of Unreal lore.] - Join us on IRC [irc.utchat.com - #beyondunreal]

            Comment


            • #7
              Nonetheless, the "delivery pipeline" comes after building/packaging , and not even required for the OP's portrayed problem per se. Not sure if he managed to fix that (in addition with compiling on outdated respectively newer sources).

              Also (as mentioned in a previous post script), as long as his mod stays as simple as the current version of the C++ code, he could use event-based Blueprint to achieve the same (or at least with a similar functionality due to some props and functions not being BP-callable which are used in RatePlayerStart).

               
              Spoiler

              ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
              ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

              Comment


              • #8
                Can't really disagree.

                As far as fixing the issues he is talking about in BP, though, there aren't many options other than just using Tick and looping through the actors.
                HABOUJI! Ouboudah! Batai d'va!
                BeyondUnreal - Liandri Archives [An extensive repository of Unreal lore.] - Join us on IRC [irc.utchat.com - #beyondunreal]

                Comment


                • #9
                  Thanks for the responses. I'm away for a few weeks so kinda let this go cold, will take another look when I'm back. Can already see from the comments that I've misunderstood some things

                  Comment


                  • #10
                    Originally posted by RattleSN4K3 View Post

                    PS: What is the "BP_iCTFPlusGameMode.uasset" asset doing what you can't do with C++. If you don't need any assets, you also don't need to package/cook any content.
                    PPS: ChoosePlayerStart and FindPlayerStart are fine for Blueprints. The only problem you might have, GameMode::RatePlayerStart can't be accessed from Blueprint which you have to re-implement in pure-Blueprint.
                    All that uasset is doing is providing the basic game mode settings, as I'm not sure how to do the same with C++.
                    As I said I've basically followed the guide to get where I am, so blueprint side of it is just game mode name, default mutator, telling it to use ctf hud etc.

                    If I can do all this with C++ only that would just allow me to distribute a dll? Presumably with this being server side I'd only need it to be on the hub?

                    If I've understood correctly, how would I extend the C++ I have to define all the game mode settings which are currently in the blueprint?

                    The one thing I am really trying to change is the logic in GameMode::AdjustNearbyPlayerStartScore as that's where the logic to not spawn in people's faces is ignored for instagib.
                    Last edited by Synapse-; 08-18-2017, 04:58 PM.

                    Comment


                    • #11
                      I added the settings from your BP to the CPP gamemode for you. This should work without the BP.

                      https://github.com/tristanmccarthy/i...s/pull/1/files

                      Presumably with this being server side I'd only need it to be on the hub?
                      I think so, yes.
                      Last edited by Crafty; 08-19-2017, 12:55 PM.
                      C++: Spray prototype | Compilation Tweaks | Maps: Quayside (inactive)

                      Comment


                      • #12
                        Originally posted by Synapse- View Post
                        If I can do all this with C++ only that would just allow me to distribute a dll?
                        You can distribute it, but that has to be done manually. Anyone who wants to play that gamemode running on that server needs to download the DLLs manually and install it manually out of the game (this is what Sir_Brizz mentioned earlier).

                        Originally posted by Synapse- View Post
                        Presumably with this being server side I'd only need it to be on the hub?
                        Nope. Clients will require to know the class defintion of some class (for instance the GameMode class), and in same case even the replicated instance (GameState, Pawn, etc.), thus they need to have the DLLs installed. The reason you only have to install a Blueprint package on the hub and players are able to play it comes from the system Epic has implemented to auto download mods on connection (although it's still not fully how UE3 made it to work).

                        Gameplay mods are rarely server side only. Blueprint doesn't even allow to set a package server side only (see Package flags in UnrealScript; not even sure if C++ could in UE4).



                        ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
                        ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

                        Comment


                        • #13
                          Ok, it's a big pain, to be sure. Sounds like you are getting a c++ only solution going here, but for what it's worth, here are some things that I do to release content with c++.

                          As already stated, there is no good pipeline solution yet and the files must be installed manually on both the server and the client. not really good, ya know? so yea if you can just go with c++ alone, that's going to be best for running a server smoothly. for my stuff, not so much an issue at this time because we are not open to the public yet. when we do go public, this is going to be a huge problem for us

                          You have your Content inside your plugin directory. I don't know if they have fixed this yet, but a long time ago I started to put my content in the UnrealTournament\Content area, because their packaging tools would not create the pak file correctly any other way. Thought I'd mention it, and I have not tried putting my stuff inside the plugin directory in a long while. if you are see the pak file created ok then I supposed it could be fine, but it's possible even then that it's not actually packaging your blueprint into that file. I ran into this exact problem of it creating the pak but not putting the blueprint into it so many times in the long ago past, and the solution was to move the Content to where UT Content is, ie, UnrealTournament\Content\<plugin>

                          also, only by using the command line you mention can you build the pak file, as far as I know. the tools in the editor used to work and then just stopped working at some point, so I converted to using command lines and have stuck with it ever since, as it's been reliable. I am assuming you know where it puts the pak file, as they bury it in some obscure intermediate directory, but it's there to be found if you look for it long enough...

                          so once we have the binaries and the pak file, we copy then binaries straight into the ut area in Program Files, and we also copy the pak file into same area, where they keep all their paks like te UT pak file. whereas binaries go into the plugin's binary directory, all the paks go to the same place in the ut pak area, not in the plugin directory. you also need to copy in the uplugin file to the plugin directory. you know it works when you can just start up UT offline and then start up a custom game using your plugin, or invoke it from the command console.

                          anyways, much better for you, if are you seeking to have a general public server which is without hassles, to just ditch paks and go with straight c++(or perhaps the other way around also (BP only), but the two don't seem to go well together). I mention all this just to note that it is possible, it's just very difficult and a lot of hassle for everyone. judging by the state of UT, I am guessing no good solution is coming any time soon and so we will need to write some sort of installation program for our mod when it comes out, not really ideal.

                          if you still want to give the c++/BP approach a try, let me know and I can share my build/release batch files with you.
                          Last edited by warhead328; 08-24-2017, 12:29 PM.
                          Bombing Run for UT3 Coder https://forums.epicgames.com/threads...ease-Candidate
                          The Reliquary TRBP team Coder http://unrealtournament2004.filefron...tEffects;92208
                          https://www.youtube.com/channel/UC0p...Q7l8s-0ug_Etgg

                          Comment


                          • #14
                            Thanks for the responses all, and thank you crafty for the code showing incorporating the settings into the C++. I'm back from my hols now so going to try this again. Will try the C++ only route and see how that goes. Likely be back with more daft questions soon enough

                            Comment


                            • #15
                              Righto, still ongoing and as yet unsuccessful.

                              I incorporated Crafty's code so that I no longer need the uasset, it's now C++ only. That's on my master branch on https://github.com/tristanmccarthy/iCTFPlus.
                              Using the clean-master branch from https://github.com/EpicGames/UnrealT...e/clean-master I can build it successfully using the Development config in visual studio. If I then run the game from compiled source using command ./Engine/Binaries/Win64/UE4Editor UnrealTournament -game in console the game mode is there in the list and I can start a local game using it, so in theory it all works.

                              Back to the same problem as before, getting it into a state where it can be distributed and actually used by players on the current launcher build.

                              I've built the game mode using Shipping config which gives me UE4-iCTFPlusGameMode-Win64-Shipping.dll and UE4-Win64-Shipping.modules. I tried putting these into my plugin directory in my launcher installed game C:\Program Files\Epic Games\UnrealTournament\UnrealTournament\Plugins\iCTFPlus\Binaries\Win64 but when I start up the game nothing happens. No game mode, and nothing in the logs.

                              Just playing about, I tried instead putting the dll into the game's binaries directory C:\Program Files\Epic Games\UnrealTournament\UnrealTournament\Binaries\Win64 and updating UE4-Win64-Shipping.modules in that dir to include my game mode. This resulted in an error message in the game logs:
                              Code:
                              LogModuleManager:Warning: Found module file ../../../UnrealTournament/Binaries/Win64/UE4-iCTFPlusGameMode-Win64-Shipping.dll (API version 3228288), but it was incompatible with the current engine API version (3525109). This is likely a stale module that must be recompiled.
                              Fairly promising as I'm at least getting some feedback. From here I went back to Winters post on this thread and did what was suggested there. I updated version.h with BUILT_FROM_CHANGELIST set to 3525109, then rebuilt everything. The new Shipping dll went into the game binaries dir as before as that seemed to at least be getting read from there, but this time I was back to nothing happening. No game mode when trying to start a local game and nothing in the log so I'm a bit stumped again.

                              Comment

                              Working...
                              X