32

The trick Elite likely uses is that they don't pre-generate the whole galaxy and store it in a database. They likely generate most of the galaxy at runtime when it is needed. I would do this using a pseudorandom but deterministic algorithm which can generate the properties of every object in the galaxy at runtime just from its position. So when a player ...


14

Yes, you can. There are already online platforms that are doing exactly that, by providing you the hash of the online secret key that is used as the seed for the random generation. Same seed = same random result. Now when the hand/ game is over, you can reveal the original secret. Players can verify by hashing it themselves and compare it to the previous ...


6

The Garbage Collector (GC) is not really an obstacle to implement an Entity-Component-System (ECS) architecture. All you need is a root object for your ECS. It would hold references to the containers you use for your components (and references to your systems, if that makes sense in your implementation). Those containers will likely hold arrays of components,...


3

See mental poker. That article describes a problem that's a bit harder than the one that you outline, as you are asking merely how to prove to the players that you gave them the "right" cards. For that problem, you can simply post a hash of the deck before the game, then post the deck afterwards. The players can then check that the deck hashes to ...


3

You don't gain any benefit from polling for input faster than you act on it. Even if you read the input early on your input thread, it's just going to sit in queue for the next game update step to pick it up, accomplishing nothing in the meantime. So the situation is equivalent to the game update thread just reading all the input since the last update, and ...


3

In the book, the subsection 5.4.3 you took the example from is about "ideas". It doesn't seem like the code snippet is meant to be great C++, just good enough to serve as an example that explains the concept. Yes, you can substitute any hash map. "how would you then access the hash table in the rest of the game engine?" From the book, ...


3

It's fair to say that for the sort of authoritative server / pure client which nearly all MMORPGs use for unavoidable security reasons, the server is typically developed with the specific purpose of serving that specific data which the client engine needs to consume in order to function. This works much the same for highly visual business applications, which ...


2

This is the idea how to upload data to gpu: glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_vboID); void *vbo = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); memcpy(vbo, indices, byteSize); glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);


2

FString (and all types that are prefixed with U,F,T etc.) are custom Unreal Types. They have special behaviour and work hand-in-hand with Unreal's Typesystem and Garbage Collection. Use string and other raw types if you want to program plain C++ Code. Use the Unreal Types if you want to interface with your Game.


2

The idiomatic way of using Unity is that your should not separate your game architecture into models, views and controllers. A gameObject should contain its own data, logic and presentation, distributed among multiple MonoBehaviours, where each behaviour represents a single functionality of that gameObject. And when you have data which is shared between ...


2

The performance cost of garbage-collection can be greatly reduced by avoiding the creation of garbage. Garbage is created whenever you create a short-living object. Like in this example: foreach (var thing in veryLargeCollection) { new ConsoleOutputter(new ThingFormatter(new ThingReader(thing).Read()).Format()).Write(); } Each loop iteration will ...


2

In addition to the points that have been made about not actually generating all the data there's another factor: You can't actually draw 10,000,000 stars. Nobody has a display that can handle it. Therefore, there's no need to have 10,000,000 stars loaded. Select X, Y, Brightness, Color, ID from StarTable Where X > CurrentX - 200ly And X < CurrentX + ...


2

There are several options to use. I'll go through some of them here. Stateless vs Stateful Stateless server Stateless servers do not hold any state by themselves. When an event happens (a request or a message from network arrives) the server fetches data from a database using data from the event (player ID, message ID, etc), processes the request and then ...


2

The approach and some evolutions / pitfalls Fairly standard. To give your approach a handle of sorts: you want to centralise most or all interactions to go through some high level (if not top level) controller, say Environment, which reduces coupling. We'll call it something like "top level interactions mediator / intermediary / proxy". See ...


2

Option 1: TL;DR, just use classes, and only classes If you don't care a whit about performance, go with the class-based version and forget the rest forever after, because it is far and away the easiest thing to model mentally and to code. There is little reason not use only classes at beginning of your project and until such time as performance becomes a ...


2

This is too context-dependent. Some MMORPG games that I had a chance to look at in terms of source code preferred to develop the server and the client as separate codebases. Some of them didn't even share any code between the two. If it was a custom engine I too would probably prefer them to be separate. But if you are using an already established game ...


1

One of the best ways to handle events in Unity is... using UnityEvents! In this example, we have a singleton called TurnManager with functions we can call when a turn starts or ends. Units subscribe to the relevant event so they are notified when a turn starts or ends. public class TurnManager : MonoBehavior { //singleton pattern for convenience ...


1

You can get the best of both worlds by creating as many threads as you have CPU cores of the server (you might want to make this number configurable in case you have other unrelated threads running at the same time which also require non-negligible CPU load). Then make each thread responsible for managing a set of currently active rooms in sequential order. ...


1

You are looking for an alternative to dependency injection. I'll offer you a perspective shift: The game world is external. You are just sending and receiving messages. It is not a great idea to have a dependency on something external that you can't control. Wait. We are making games. And a game is a piece of software, it isn't a portal to another world. Or ...


1

There is another performance-related aspect of ECS: parallelization. During the update cycle, each system writes to the limited set of components, often just 1. The components that are not being written at that moment may be safely shared across the multiple threads, which allows multiple systems to run in parallel. Garbage-collected language may be even ...


1

AppDomain The most established and bulletproof method for plugin isolation is to use AppDomain. Anything allocated withing one AppDomain will be disposed together when AppDomain unloads or reloads. As a downside, communication between domains (the default and isolated one) is tricky, because it requires serialization and deserialization, which may lead to ...


1

Flat update loop The multi-phase design may be the root of the problem, because it creates a dependency graph of its own, misaligned to ECS's dependency graph. The most direct solution would be to express the phases as a single ECS update. If certain update function needs to be called multiple times (i.e. in different phases) during the update loop, you can ...


1

Entity component systems store data in one of three ways: Centrally allocated arrays, accessable by all systems. Contigious arrays of subsets of components that each system is interested in. Contigious array of "entities" allocated in a centrally located memory buffer. Naughty Dog uses scenario 1. An entity in this context is just a collection of ...


1

Component-per-buff may cause some serious performance issues. Of course, at this point we can only speculate about the performance, but so far I can only see the downsides — at least in comparison to a more traditional approach. Some of the the major arguments for using ECS stem from it's ability to exploit cache locality and parallelism for the performance ...


1

I'll just cover the is_key_pressed I proposed in comments. You could have a list of input handlers strategies. It would be a list of key-value pairs. Where they key is… well, a key, that could be pressed. And the value is what happens when the key is pressed. You would have the type of the values be IInputStrategy (or IHandleInput using lolcat interface name ...


1

The OOP way to do this, would be to give the class wall a method handleCollision(ball) (although instead of ball, you might want to use the base-class of ball which represents any object which has a velocity and can bounce off of things). And because you have both horizontal walls and vertical walls which do different things when a ball collides with them, ...


1

I'd argue you should keep the implementation alongside the definition in this case. It gives you a lot of flexibility. But .. You don't want to be serialising methods, so your players/NPCs should have references to the above via an ID/Key when serialised. [assuming the hotkey is not user-configurable, it's fine there. If it is, that should live elsewhere as ...


1

Philipp already gave a great answer, but I'll address your question about how Elite Dangerous operates their database. Elite Dangerous manages to store the data of 400 billion solar systems and has no issues with loading times, somehow. How can they display many stars in the background? How do they manage to store a lot more data than I already do? Elite ...


1

There are many ways to get to this, and you might need several iterations over the architecture before getting it right. Because of this, this answer will be quite broad. You could consider your game from three different points of view: the simulation, i.e. what happens in the game the 3d render of the game, i.e. the display of how is your world organized ...


1

Before answering your other questions one thing that could break your design. If you delete an asset in the middle of the vector all other asset indices will move and effectively ruin your cache ids since now all handles point to the wrong asset. You probably want to use something else for identifier. Either a key or switching the vector to a map could be ...


Only top voted, non community-wiki answers of a minimum length are eligible