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,...


5

A lot of systems in a game that needs to be updated are things that are not rendered and don't need any input, they simply need a call to their update function every frame. They don't have any physical representation in the game world... That sounds like an entity that has no Renderer component (doesn't get rendered) and no InputHandler component (doesn't ...


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

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

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

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

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

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 ...


2

I still use interfaces, inheritance and all the rest traditional OOP stuff but far less often. What I gradually began to value most is fast to create and modify while not being too "fragile". Without a big team all the rest is secondary. (honest translator: I gave up on being amazing so I can at least be effective) I came to an approach that works ...


2

For the type of problem you're describing, I'd recommend shifting your focus away from "identity" (is-a) toward "affordance" (has-a). This is part of the classic principle of composition over inheritance, with which Unity's component-based structure tends to work well (and it has a great write-up in the Game Programming Patterns book too)....


2

Single responsibility principle Every script should do exactly one thing. So when you describe the functionality of a script and you use the word "and" in that description, then that's a sign that it should probably be split up. For example, this script could be documented as "This script spawns the stairs and moves the player and updates the ...


1

We had to solve a similar problem when developing Starlink: Battle for Atlas. The game takes place in a system of seven planets, and although only a small chunk of the current planet around the player is fully-loaded at any given time, the allied and enemy factions continue to battle it out on the far side of the planet and all the other planets. We did this ...


1

Solution A (Alternative) seems reasonable given the constraints you mention in your question and I suggest giving it a try. Regarding your hesitancy to stray from an ECS; notice that there is a fundamental conflict between the chunk system, ECS and these updating entities: Your components are stored on a per-chunk basis (as far as I can tell), the chunk ...


1

You don't really need physics. Here is a top down shooter example that you can learn from with code that you can also re-use. https://www.tabageos.com/examples/topDown360Shooter/ It's tile based. For arcs one would utilize geometry. In that example the enemies are somewhat set up to be doing what you describe, for example at the bottom of the code, in the ...


1

A minimal renderer is written at some early stage of a graphics engine's development. At that time, some coordinate system is decided upon based on certain factors which seemed valid to the developer(s) at the time. Those could be factors could be as abritrary as "our artists produce models in Blender, and those models use this coordinate system, so we ...


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

Avoiding conditionals I assume some leeway here, as you've asked for a general approach. The point here is to eliminate the main potential bottlenecks. Unless you are creating very large numbers entities per frame (as in e.g. a particle system), it seems unlikely you will ever need such code - but you asked ;) First we set up our constants: //component type (...


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

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 ...


1

You may follow the path of EVE Online and it's famous Time Dilation. The main idea is to slow physics down when there are too many objects. Other less famous optimizations include clustering objects into bubbles: each bubble includes all objects that are close enough to interact. Consider a bubble to be an unit of containerization. Another great issue of ...


1

A major difficulty with trying to develop emulators for older machines is that on such older platforms, there are aspects of behavior which weren't intentionally designed to fit together in any particular way, but nonetheless happened to fit together in ways that some game designers have exploited. Sometimes these aspects of design may be documented, ...


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 ...


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