Sign In Register

How can we help you today?

Start a new topic
Answered

gamespark's ue4 plugin following abadly designed diagram

in ue4 version of gamespark plugin gS's api was exposed in blueprint though a sceneComponent.
"class GAMESPARKS_API UGameSparksComponent : public USceneComponent"

whoever did the design he most probably dont know that by default ue4 always destroy sceneComponents durng server Travel or moving to a new level.

on those moment GS's componenet will be deleted. hence,  Gs's connection will be lost. to prevent this . 

on the other hand if the design was done by a uObject then it could have been saved in gameInstance.

so kindly ask the developer of this plugin to  expose GS's api either as an static function library or  by some way so that GS's actor does not get deleted


Best Answer

-The component is only a proxy to the GameSparks module. Every GameSparks component simply points to the module and allows the game instance to interact with it by connecting/disconnecting and setting up listeners. 

-If you travel to a new level you will not need to reconnect and whatever is destroyed is simply a pointer that you can remake, provided you didn't manually disconnect using end game event (You can make an exception for level transition). 

-When travelling to a new level you will be allowed to use GameSparks API because you've connected in a previous level. 

-This design is unique to Unreal and works a charm. We are well aware of how Unreal works and assure you we've taken the necessary steps for things to work as they should. 

-Our approach is a socket approach unlike any other backend provider, this means every device opens a socket to the backend (Through the module I mentioned earlier) and it stays open until you close it or the game instance is no more. 


To make this work for you:


- In your first level initiate the connection to GameSparks using the GameSparks component in your Gamemode.

- In every other level have an IF function to check if the Module is connected, if it is, then do not do anything and have the component exist for future purposes (If needs be) and if the module is not connected then reconnect using the GameSparks component. To check if the module is connected simply get a reference for the GameSparks component and get the 'isAvailable' boolean.


Hope this helps, 

Omar



Answer

-The component is only a proxy to the GameSparks module. Every GameSparks component simply points to the module and allows the game instance to interact with it by connecting/disconnecting and setting up listeners. 

-If you travel to a new level you will not need to reconnect and whatever is destroyed is simply a pointer that you can remake, provided you didn't manually disconnect using end game event (You can make an exception for level transition). 

-When travelling to a new level you will be allowed to use GameSparks API because you've connected in a previous level. 

-This design is unique to Unreal and works a charm. We are well aware of how Unreal works and assure you we've taken the necessary steps for things to work as they should. 

-Our approach is a socket approach unlike any other backend provider, this means every device opens a socket to the backend (Through the module I mentioned earlier) and it stays open until you close it or the game instance is no more. 


To make this work for you:


- In your first level initiate the connection to GameSparks using the GameSparks component in your Gamemode.

- In every other level have an IF function to check if the Module is connected, if it is, then do not do anything and have the component exist for future purposes (If needs be) and if the module is not connected then reconnect using the GameSparks component. To check if the module is connected simply get a reference for the GameSparks component and get the 'isAvailable' boolean.


Hope this helps, 

Omar



1 person likes this

I'm having an issue with the architect as it's currently designed. I'm not asking for a change, but the design as is causing me some troubles. So some assistance would be great.


I have a handful of game components that no matter what Map I'm on will always be registered 100% of the time to GS.


Right now it's a personal player data update and a messaging system. During play, we use the Spark.Message on GS to update the player data. So if they are in a battle match, or if they are navigating through the menu's data is send via message. same with the messaging system, if there is a message no matter which mode they are in we want to handle these messages.


I'm trying to use Game Instance as it's the only map global class. However, I can't seem to use the Add GSListener to the game instance.


It seems that a global GS Listener isn't so easy to pull off. Though I admit my UE-fu is fairly weak at the moment. Since the GSListeners need to be a component, the component being destroyed is a concern after every map level change :(


i decided to modify the plugin architecture. and it worked like a charm. previously gs's shutdown call was not getting called during quite(). now it started to work just after changing the architecture.
may be they have a tutorial somewhere to make everything work perfectly with existing way of plugin. but i failed to make it work.

if i mange time then i will send a pull request to their repo.
 i have to clean up the code before sharing it

Login to post a comment