Skip to main content
4 votes

Sync one thousand vector3 across network with minimal bytes?

Standard compression algorithms are pretty efficient even at the fastest setting. As a quick test I filled a text file with 34k bytes. Compressing with 7-zip on fastest setting gave me a file of 1k. ...
Esben Skov Pedersen's user avatar
3 votes
Accepted

Do you recommend having a template scripts?

If you find yourself copy/pasting code, nine times out of ten you're missing an abstraction. That's not a guarantee, but it is generally correct. Especially as a beginner, you're going to miss ...
Flater's user avatar
  • 59.5k
3 votes

Sync one thousand vector3 across network with minimal bytes?

It seems to me that if you have 1000 guys on the screen and they are flocking, the exact position of each wont be so important as when you have 10? Could you have the soldiers group up as the total ...
Ewan's user avatar
  • 84.4k
2 votes

API design with conditional compilation: stubs and exceptions vs public API change?

Neither option is good. Conditional compilation requires two sets of binaries, and just complicates the build process. Instead, declare an interface in your project that has the methods or properties ...
Greg Burghardt's user avatar
2 votes
Accepted

State machine - how to handle outside environment values?

What’s the problem? Three actions are needed to manage the state transition: detecting the causes that trigger a state change; determining the target state; switch from the current to the target ...
Christophe's user avatar
  • 82.2k
2 votes
Accepted

Is it ok to Inject a whole object instead of only the dependencies

What you are describing is the service locator pattern. Most times it is considered an anti-pattern, however given that Unity instantiates the components, and likely requires a constructor with ...
Greg Burghardt's user avatar
2 votes

Avoiding duplicate code between the player and npc classes deriving from Unity's MonoBehaviour

You would keep these two classes seperate. You should think about this like a “has behaviour” relationship instead of an “is” relationship. Make a class Npc and a class FightingBehaviour. You add ...
Dirk Boer's user avatar
  • 454
2 votes

C#: Structuring Saved Data for a Game

I want 2 classes that can access it - one that checks and modifies the values during gameplay and another that actually saves and loads the data to disk. I am all for segregating single ...
Flater's user avatar
  • 59.5k
2 votes
Accepted

How to do grid systems with floats given precision causes problems

The approach I use with floats in general is not to assume they're ever an integer value, even if that's what they would be mathematically. And also to test with distinctly non-integer values. Where ...
Errorsatz's user avatar
  • 776
1 vote
Accepted

Are These Both The Same Or Different If Statements

No, they are not the same. IF Alive and Dying were mutually exclusive (i.e. it's always one or the other), then it would mostly be the same (see below for pedantic caveat). But as there is a third ...
Flater's user avatar
  • 59.5k
1 vote
Accepted

Transforming a long-running operation into a step by step operation?

Hard constraints You need to assign the data to a Mesh. That needs to happen. There's no way around it. The Unity API isn't thread safe, so it must happen in the main thread. There's no way around ...
R. Schmitz's user avatar
  • 2,598
1 vote

Sync one thousand vector3 across network with minimal bytes?

Many of the ideas you posted are good. At some point you will hit saturation point, so there are some trade-offs you are going to need to make. Some of those trade-offs depend on how large your grid ...
Berin Loritsch's user avatar

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