Thanks Drew,
I appreciate the answer. I'll have a look at both Server Authoritative as well as the GameDataService documentation.
I'll post my findings here as well so people won't have to ask this again in future.
Cheers,
Ryan,
From a high level, the concept you are trying to come up with is called a "Game Server" or what I'd call a "Game Simulation Server" to be more specific.. Since there can be many types of servers in Games (matchmaking, authorization, persistence, etc...).
Basically, you need something running the simulation on the server side. This is what makes multiplayer games so hard - you need to be able to have the game running on the server, and the player clients are basically just giving inputs to their characters (such as t "I'd like to move north").
This means your game client would take in an input of the up arrow being pushed and translate it into a request to the server "id like to move north". Often times the game client would automatically start moving the user north and simulating physics locally, but on the server side, it is doing the same thing and checking that the players requests are valid (e.g. there's no wall there, they aren't paralyzed, etc...).
This is why real-time physics games are so hard.
To solve this problem, I think you have 2 options. 1) look at the Real Time functionality of GameSparks, or 2) build your own simulation server and have GameSparks do a hand-off to them.
One option for hosting simulation servers in option 2 would be in AWS, where you could take advantage of something like GameLift which would help you scale up automatically. Of course this depends on what kind of game you are making - an MMO will have a lot different architecture than an FPS.
Ryan Skelton
Hi team,
Firstly - Big, BIG fan of your services. I've read a significant amount of your documentation and a huge thank you to Liam and Patrick, you have resolved many issues i've had just by answering others questions thoroughly.
I'm quite certain this should be a relatively simple request and there's just some documentation that i'm missing, so i'll explain how my game works at take it from there.
The game is a tap combat game, you have a party of up to 4 hero's on the screen at once (like final fantasy styled games), you gain exp for killing enemies and that exp is spent on stats. stats increase damage but also allow you to purchase equipment.
I am looking for a way to essentially store each characters multipliers, stat levels and equipment levels in the database.
The most simple way i could think of doing this is by creating an event called SAVE_CHAR_0, then increment by 1 for each class. Each event has about 9 attributes at the moment. The idea would be that i would parse in which character class i am as an int (already set up in unity) to my SetEventKey which would then determine which class i am updating.
example code in my head would be something like:
new GameSparks.Api.Requests.LogEventRequest()
.SetEventKey("SAVE_CHAR_" + mainCharClass.ToString())
.SetEventAttribute("WEAPON_LV", mainForgeWeapon)
.SetEventAttribute("ARMOR_LV", topforge)
.SetEventAttribute("HELMET_LV", 100)
.SetEventAttribute("SHIELD_LV", 10)
// there would be maybe another 8 or so attributes in here
.Send((response) => {
if (!response.HasErrors)
{
Debug.Log("Character Class Saved To GameSparks...");
}
else
{
Debug.Log("Error Saving Player Data...");
}
});
now - i haven't tested this yet, but i imagine this would likely work. my issue however, is that i would like to have about 30ish classes. In my scenario i'm looking at repeating the same structure of event 30 times to essentially get the same thing. Being relatively new to programming entirely I could see that there probably would be a way to do this. I know in unity i would use a scriptable object then just fill in those objects, load in an array of scriptable objects and bam my characters are ready to be spawned in as needed.
How would i replicate this in gamesparks? Is my solution already viable or am i creating a significant amount of work for myself?
I've tried going through your collections tutorial, but at the moment i'm just not really grasping it, so i'm not sure if it would be applicable to this scenario.
Finally (and sorry for the multitude of questions), i've been building this in through i believe is referred to as the runtime collection, but i'm also very conscious of how frequently i would be updating this - people would sometimes beat a boss then level up strength 5 times then upgrade a piece of equipment, that would be the equivalent of 6 calls in quick succession, am i looking at bandwidth issues or just being paranoid?
Again - i truly appreciate the work you guys put into answering not just mine but all users queries, i look forward to hearing from you :)
Ryan