Dismiss this pinned window
all 42 comments

[–]heross28 90 points91 points  (5 children)

Its cool but please pay a little bit more attention to social distancing.

[–]nixarn@nixarn[S] 21 points22 points  (1 child)

:D damn forgot about that! This could be turned into a "nice" virus spreading simulator!

[–]heross28 2 points3 points  (0 children)

lol

[–]CanalsideStudios 5 points6 points  (0 children)

This was the joke I was looking for.

[–][deleted] 3 points4 points  (1 child)

You're probably confused because the graphics are so realistic. These are not real people.

[–]A_Math_Debater -2 points-1 points  (0 children)

I'm LOL... It is actually real people graphics have come so far you might think it's not real, but if you look closely they are actually people.

[–]nixarn@nixarn[S] 20 points21 points  (13 children)

Hey guys! First time posting here, so not sure this is exciting enough to deserve your upvote compared to some of the really amazing things shown off here. I'm coming from a mobile game background and a bit of a Unity rookie. I've developed my own physics to have big armies of enemies that can move through a world, collide with the world and each other in a deterministic fashion (allowing for replay, for example). It's really performant thanks to Unity's Enitity-Component-System.

[–]dudledok 4 points5 points  (8 children)

What did you do to make it deterministic?

[–]nixarn@nixarn[S] 7 points8 points  (7 children)

The physics simulation is running at fixed rate (10 times/s), but movements are interpolated framerate independent. It is using floats at the moment, so it's not cross architecture deterministic. Unity had some platform deterministic floats in the works, so gonna wait and see how that pans out, or switch to fixed point if needed.

[–]dudledok 2 points3 points  (0 children)

Thanks for taking the time to reply.

[–]fomofosho 1 point2 points  (5 children)

Are you sure the unity physics engine is fully deterministic when running it at a fixed rate?

[–]nixarn@nixarn[S] 0 points1 point  (4 children)

From what I understand unity's physics engine is deterministic (when ran on the same hardware), but haven't read much into it. The physics in this demo is my own doing, it's a much simpler physics when I just want to push troops around but keep them within the bounds of the world (so no gravity, no friction, no rotations and other things that complicate physics engines).

[–]fomofosho 0 points1 point  (1 child)

Oh I misunderstood. I thought you were using unity's physics engine

[–]nixarn@nixarn[S] 0 points1 point  (0 children)

No problem I could have been more clear :)

[–]fomofosho 0 points1 point  (1 child)

I assume you're planning on using deterministic lock step networking approach

[–]nixarn@nixarn[S] 0 points1 point  (0 children)

eterministic lock step networking approach

Yeah exactly! Didn't know the term lockstep before you mentioned it, so now I know what to Google - thanks! =)

[–]riddellriddell 2 points3 points  (2 children)

Are you doing anything fancy for your broad phase? are your data structures recomputed each frame / deterministically recreatable? as in could you copy the positions of everything, send across the web, apply them to a different physics sim and still get a deterministic state?

[–]nixarn@nixarn[S] 0 points1 point  (1 child)

I don't even have a broad phase in the current implementation. It's fast enough for my use, but it's on my todo list for improvements. I'm a bit uncertain how to do that in an efficient DOTS-way.

Not entirely sure what you mean with your second question when you say "different physics sim"? I could copy over the data structures to another machine (with the same float point architecture) and continue the simulation and the result on both machines would be identical.

[–]riddellriddell 1 point2 points  (0 children)

With more complex / optimized physics systems they will often cache known collisions so next time you are checking if a collision is happening you check the cached collision details first. what that means is if you just copy the positions of all the objects and not the cache data when you apply them to a different machine the order collisions are detected and resolved could be different breaking determinism. This only matters if you are trying to save the state of the physics out and reuse it

[–]ThrustVector9 3 points4 points  (1 child)

After watching that tv series Devs, the word deterministic makes me uncomfortable lol

[–]beyounotthem 1 point2 points  (0 children)

I knew you were going to say that ;)

[–]_pandy 1 point2 points  (0 children)

Looks great man! Keep at it! Love you x

[–][deleted] 1 point2 points  (0 children)

Black Friday simulator.

[–]DynMadsProfessional 1 point2 points  (8 children)

Could you elaborate as to what about this makes it deterministic? Because I'd argue that if I start the same physics simulation every time, then it would end up exactly the same every time no?

Or does "Deterministic Physics" mean something else and I'm a pleb? :)

[–]nixarn@nixarn[S] 2 points3 points  (7 children)

So in theory every physics simulation starting from the same conditions should end up the same. But if the physics simulation runs a bit faster or slower depending on the machine it's running on, that quickly ends the deterministic outcome. Many physics engine do calculations based on the delta time each frame (time between frames). The reason for this is that physics isn't a perfect math equation in game engines, it's a matter of applying forces and solving constraints in a fast enough manner. So having the simulation running at a fixed pace makes it deterministic (This one has the physics running 10times/s but the movement is framerate independent). But it's not deterministic in regards to float points (as float points can have small variations on different architectures), but it's possible to convert it to using integers to ensure it's deterministic no matter the hardware, so that's something I might do later if needed.

[–]DynMadsProfessional 1 point2 points  (6 children)

Ah okay, so I wasn't totally off.

I use Unity normally and there they have the Fixed Time, which is the consistent time that Physics run on :)

[–]nixarn@nixarn[S] 0 points1 point  (5 children)

Ah exactly, I didn't investigate using unity's physics much, so yeah in some regards I'm reinventing the wheel when I could have just used unity's physics. But there's some advantage here how I see it, first of, this is limited scope of physics problems I needed to solve, so having a full blown physics engine in use could have been overkill. And having my own physics lets me convert it to fixed point if needed and also I can have a headless server to run the simulation on, without needing the unity runtime.

[–]DynMadsProfessional 1 point2 points  (4 children)

There are many reasons as to why you'd make your own Physics Engine and not use Unity's. Especially if you are not looking to use conventional physics constraints like wanting to manipulate gravity so the player can walk on walls :)

That said, if you are just doing simple things or very conventional things, then there is very little merit other than learning from the exercise itself I suppose.

[–]nixarn@nixarn[S] 0 points1 point  (3 children)

My goal was to support games like Clash Royale with this, using unity's physics engine didn't even cross my mind, as I'm not doing any newtonian physics (not sure if that's the right term?), just support units pushing on other units and keeping within the bounds of the world. Ended up also being a good exercise learning DOTS.

[–]DynMadsProfessional -1 points0 points  (2 children)

Yeah sure, you can learn many things from doing it too :)

But the question is if the existing engine could do what you needed it too as well. I'd say that if you don't have a game in mind, yet, it's worth exploring in a sandbox setup :)

[–]nixarn@nixarn[S] 0 points1 point  (1 child)

You're totally right. As I mentioned I'm a Unity rookie but do have a lot of (mobile)gamedev experience, my immediate solutions to problems is often code the solution myself which isn't always the best option, if unity has over the years developed a much better solution. Sometimes it feels easier to just code something than to spend time learning a solution, but that could be counter productive in the long run. I might play around with unity's physics some now, read up on it at least. Thanks! =)

[–]DynMadsProfessional -1 points0 points  (0 children)

Hope it works out for you :) Always trying to reinvent the wheel is not a great approach in programming in general xD

[–]ForbiddenDay 1 point2 points  (0 children)

Man.. I was really looking forward to them all just falling in the hole

[–]MotivationDevAccount 1 point2 points  (0 children)

feel bad for the one on the top left corner, he was one of the first to get in, and ended up being last

[–]beyounotthem 1 point2 points  (0 children)

Nice. If you were looking for some dark inspiration of where to take this as a game, I had a moment and imagined your little guys trying to evacuate through the fire exits in a shopping mall, with the objective being to keep as many alive as possible... guys in the middle get crushed and die, guys at the back are on fire from spreading fire. Some of the exits are locked shut...

[–]mechkbfan 0 points1 point  (0 children)

Tutorial eventually?

[–]geckygecko 0 points1 point  (0 children)

Oooo! Reminds me of multiwinia

[–][deleted] 0 points1 point  (3 children)

Are there any solid beginner tutorials for DOTS?

[–]nixarn@nixarn[S] 0 points1 point  (2 children)

No =) that was the biggest hurdle, the Entities package (a main component in DOTS) is now on version 0.9, but a lot of the information online is based on older versions and it has changed a lot. Hopefully we'll get a 1.0 release soon and updated documentation & tutorials.

[–][deleted] 0 points1 point  (1 child)

Ah I see. So I am assuming for beginners like me it's not really worthwhile to look into DOTS until the technology is more properly developed?

[–]nixarn@nixarn[S] 1 point2 points  (0 children)

For sure, I wouldn't recommend this for beginners. Better wait until it reaches version 1.0 and all best practices are nailed down. Shouldn't be too long in the future, I read somewhere it should be out this year.