How do seperate place DataStores work in roblox? - lua

Lets say, for starters, i have a game. And in that game, I add a few places. If i were to create a datastore in the main GAME, would that transfer to all of the places automatically as well?

Yes, all subsidiary places created under the same game share datastores of the main game. If you want to send specific data to a certain place, use https://developer.roblox.com/en-us/api-reference/function/TeleportService/GetLocalPlayerTeleportData.
Keep in mind that data sent along with teleports is local and can be manipulated by the client.

Related

How do I keep track of a person's total leaderstats in different games?

For example, I would have a main lobby in my Roblox game. Then, a player gets sent into another game and collects coins. When they come back to the lobby after they get a certain amount of coins, I want it to save their all time coins.
I would share code, but I have absolutely no idea how to do this.
Roblox "Games" can hold multiple "Places". Up to 20, I believe, including the "Starting Place". The neat thing about this is that datastores are saved across the entire game. As a result, if you save someone's data in place1, then they move to place2, their data will carry over.
To learn more about Games vs. Places, you can visit the developer API documentation.
EDIT: Alternatively, if you want data to save across multiple games, you would have to look into HTTPService, and off-roblox datastores.

How do I do a live interaction between two device?

I'm new to Swift and native iOS Development in general, and I'm trying to making an app which allow two or more users to send and receive in real time data about something (such as a line path), similarly to what happen in multiplayer games. It isn't a game, by the way. Let's make an example:
Let A and B be two users.
There is a canvas on this app, for example.
A can draw a line (which should be an array of points) and B see what A is drawing in real time (so B receive the array).
As I said, it's similar to what happen in multiplayer games (but here I don't want a server to manage what people do, I'd like something like P2P or a direct connection between devices).
How should I manage this?

Game network programming synchronizing graphs

I am trying to develop a computer game. I want this game to be multiplayer playable. The game is an arcade space shooter
I plan to run the game at server level and then send updates at the clients. The problem that I am facing is object creation. Let's say if a player shots, the shots themselves are new objects. These will need to be created.
In my game I have a hierarchical structure and the shots themselves will be part of this structure. It will be something like a tree. The problem that I have is identifying objects on the clients and server.
How can I make sure that when the client receives some update then it will update the right objects?
What about new object creation. In my case the scene graph is traversed and each object is updated once it gets updates from the server. But updates which creates new object violates this principle. How should I handle them?
Also, I can't really get updates for the entire scene. I would only need to update specific objects that are visible to the player. What should I do with the rest of the objects that aren't visible? What will happen when they become visible? How can I track when objects become visible to a player?
How can I make sure that when the client receives some update then it
will update the right objects?
You can give an unique id to each object server creates. You might want to create a super Object class containing id and let all other game object classes inherit from it. Or, you can have a map to link between id and object. Or, you can mix them. To get an unique id, server can have a global 'nextID' as int and simply assign to a new object and increase it for next one.
But updates which creates new object violates this principle.
I don't really understand the principle you are talking about but if you are worried about editing your scene graph (or game object list) while traversing it, you can put the newly created objects into another list and just insert the new ones after traversing is done. They will start getting updated from next update. (You should consider how you will remove an object too)
What should I do with the rest of the objects that aren't visible?
What will happen when they become visible?
Well, you are the one who should figure it out because it really depends on your game system. My suggestion is that try to skip their updates and see what problems appear and fix them.
How can I track when objects become visible to a player?
Also, several ways to handle this. Server can detect everything for clients and send only visible object info for each client. Or, each client can detect them and send a request to server for starting to update visible ones. Or, it could be mixed way.
Try server-driven one first and see if server can perform it with maximum number of clients.To use client-driven one, remember each client still needs to update all object location regardless of their visibility but send a request for AI updates for only visible ones.
Again, there are many ways to handle this kind of problems and it really depends on your game system requirements. That's why it's hard to answer your question without knowing your game system well enough. Try to investigate how other similar multiplayer games are designed from some books or google. Good luck!

Passing object/NSData between iOS devices

I'm creating a game, turn based, and I was thinking of using Game Center to handle it, but the passed game-object is evidently max 64kb. Is there another way to pass objects between devices for this use, without having to create a database or storage-server as middle man? The game-object itself for me is probably a lot less than 64kb, but there are some initial variables I would like to send, such as images. With my calculations, the initial data for one game is about 500kb, but after getting those images once, the passed game object is just a couple of kb's, and are never going to include those images again.
Is there a way to send these images directly?
There are a few ways to get around the limit.
This answer mentions Alljoyn which would allow you to transfer that size of files.
You could also send them indirectly by transferring them to your own server, then passing a link to the file to the other player. For a turn based game, this would have good advantages of enhanced reliability as you could put in retries on error for both the upload to the server and the download to the device and control it yourself. I would recommend AFHTTPClient for this, also.
Is there another way to pass objects between devices for this use, without having to create a database or storage-server as middle man?
Without your own server, there isn't.

Approach to Saving a game in Unity3D

I have searched a lot on how to save a game in Unity 3D. Everyone has advised to use XML serialization or Player Prefs. What i am unable to figure out is what exactly to save. My game is a tower Defence game so when I quit i need to save
Towers (multiple Prefabs , location and each on a particular
upgrade,animation currently playing etc)
Enemies (multiple enemy prefabs on the battle field, their position , animation , enemy path
, health etc)
Enemy Wave
Path Calculations
Difficulty
Level
Score
Lives Left
Total money
what should be my approach trying to save all this information. What is the level of granularity I will have to go to ? . Can I save every gameObject and everything related to that game object will be automatically saved. or do i save every class ? ... or do i need to save every variable used in the game.
It depends on your code design. But avoid saving all data (like serialisation). All that have initial default values or non-important for player (such animation position) should save only changed properties. After game is loaded you should create objects from scratch, init them and set values from saved file.
For simple games can suggest to use Player Prefs to just save such info as current level, score.
For saving thousands of random objects consider saving control points and restore level loading them and regenerate random points around them.
Also good approach is to save data into web cloud.

Resources