Shaggy
Shaggy8mo ago

Is this framework server authorative ?

Is there a possibility of running a simulation of game scene on a server and write dedicated server logic for game control and session management.
3 Replies
kapa.ai
kapa.ai8mo ago
Hi @Shaggy. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, Normcore does support server-authoritative operations. Traditionally, Normcore uses Ownership and Lifetime Flags to provide server authority. This covers most applications, but there are cases where you may want to run your own authoritative game server. Normcore Private includes the ability to run a headless Linux Unity game server next to each room server. When a room server is started, a copy of your game server is started in a container that runs next to the room server itself. A custom authoritative server works just like any other Unity client in the room except that it has the ability to modify any state in the datastore, including ownership of any model or object[^1^]. For cheat prevention, Normcore Private supports authoritative game servers[^2^]. In terms of session management, Normcore uses lifetime flags to tell the server how long the state for a model should be retained. Models can be set to persist between sessions, or they can be automatically deleted when the owner or the last client leaves the room[^3^]. For example, if you want to instantiate a prefab that persists between sessions, you can use the destroyWhenOwnerOrLastClientLeaves flag to denote that the object should persist[^7^].
public void CreatePersistentObject() {
// Instantiate the My Object prefab and tell Normcore to let it persist even after everyone leaves the room
GameObject myPersistentObject = Realtime.Instantiate("My Object", destroyWhenOwnerOrLastClientLeaves: false);
}
public void CreatePersistentObject() {
// Instantiate the My Object prefab and tell Normcore to let it persist even after everyone leaves the room
GameObject myPersistentObject = Realtime.Instantiate("My Object", destroyWhenOwnerOrLastClientLeaves: false);
}
If you want to destroy a prefab when a client disconnects, you can set the prefab to be owned by this client and to be destroyed when the owner is disconnected[^6^]. ^1^]: [Normcore Private - Authoritative Servers (https://normcore.io/documentation/normcore-private/authoritative-servers) ^2^]: [Architecture - Common Questions (https://normcore.io/documentation/architecture/common-questions#how-do-i-implement-cheat-prevention) ^3^]: [Room - Server Authority + Ownership + Lifetime Flags - Lifetime flags (https://normcore.io/documentation/room/ownership-and-lifetime-flags#lifetime-flags) ^6^]: [Room - Server Authority + Ownership + Lifetime Flags - Lifetime flags - Destroy a prefab when a client disconnects Part 2 (https://normcore.io/documentation/room/ownership-and-lifetime-flags#destroy-a-prefab-when-a-client-disconnects) ^7^]: [Room - Server Authority + Ownership + Lifetime Flags - Lifetime flags - Instantiate a prefab that persists between sessions (https://normcore.io/documentation/room/ownership-and-lifetime-flags#instantiate-a-prefab-that-persists-between-sessions) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai8mo ago
<@835576164621877329> kapa.ai is still learning and improving, please let us know how it did by reacting below
Mechabit
Mechabit8mo ago
the bot is right, you need normcore private license to get authoritative servers. with normcore public you can sort of do it by having one of the players act as the authority

Did you find this page helpful?