x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Custom UGameEngine functions not being called?

I'm trying to setup a custom UGameEngine but my Init() function is not getting called?(no break points are being hit) so i started up the shooter example and much to my surprise, I'm getting the same results. I have an object that needs to be persistent throughout the entirety of the game and the entirety of the game depends on it. I need to call a function from the gamemode because I need to know if it's a server. I started with using game instance and setting the dedicated server to start on a certain map with a gamemode that handles setup and then load a map to handle lobby stuff. The issue with this is that apparently when using the PIE both the server and client start on the currently selected map. So this wont work. But if I was able to use and debug a custom UGameEngine, that would be great! But from what I can tell. it's not working.

It's literally driving me crazy that I can't do what would normally be a relatively simple thing. I guess if I can't get any help here, I'm going to have to resort to customizing the UE4 source. Which i don't want to do because it takes so long to compile. I'm also getting discouraged by the massive lack of documentation. I've spent over a week trying to do this and so far, no solution that I have been able to come up with will work because of the lack of control that I have.

Any help is much appreciated.

Product Version: Not Selected
Tags:
more ▼

asked Jan 24 '15 at 07:28 AM in C++ Programming

avatar image

MJ_01
822 38 39 240

avatar image Duncan Dam Jan 24 '15 at 08:00 AM

Not related to your question but if you want to run server and client not at the same time, make a .bat file in your project folder and add this ( [ and ] not included )

ForDedicatedServer: "[EditorPath].exe" [YourProjectNamePath].uproject [MapName]?game=[GameMode] -server -log

ForClient: "[EditorPath].exe" [YourProjectNamePath].uproject [ServerIP] -game

for the [GameMode] mine is something like /Script/ShooterGame.ShooterGame_FreeForAll and the ServerIP will be 127.0.0.1 if you want to test on same computer.

You can run server first let it finish initialize then run the client, you can do independent debug on each.

avatar image MJ_01 Jan 24 '15 at 08:06 AM

Thanks! I'll play with that tomorrow. I really wish it were possible to debug the server and client separately. I'll probably look into what I can about that in the morning.

avatar image Duncan Dam Jan 24 '15 at 08:14 AM

Yes, it will debug separately just put -log in client too if you want to debug client, we use this all the time for our multiplayer game to run dedicated server without build from source code, but if you call UMG in any default class of GameMode like Controller or Pawn then the dedicated server might not gonna work, this bug is gonna be fixed in 4.7.

avatar image MJ_01 Jan 24 '15 at 08:18 AM

Oh really?! Thank you very much for the info! I'll definitely be working with this tomorrow!

avatar image falola Feb 16 '15 at 10:37 PM

Did you ever figure out how the custom UGameEngine is being attached in order to debug it?

avatar image zompi2 Feb 19 '15 at 04:36 PM

Hi, I was trying to do something similar. I also need a custom UGameEngine class. One thing you need to do is to set in DefaultEngine.ini:

 [/Script/Engine.Engine]
 GameEngine=/Script/YourGame.YourCustomEngineClass

But it will work only in game, but not in the editor! To have custom Engine in editor you must create custom class from UUnrealEdEngine and set

 [/Script/Engine.Engine]
 EditorEngine=/Script/UnrealEd.EditorEngine
 UnrealEdEngine=/Script/YourGame.YourCustomEditorEngineClass

And now we have two the same classes one for game and one for engine... Kinda annoying, isn't there any way to make a super engine class for this?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question