Jump to content

Developer Discussions: Alpha 17


Roland

Developer Discussions: Alpha 17  

1 member has voted

  1. 1. Developer Discussions: Alpha 17

    • Newly Updated
      1
    • Check out the newest reveals by Madmole
      0
    • Over 100 new perk books with set collecting and bonuses
      0


Recommended Posts

Physics engines are great for things like vehicles, and realism overkill, but IMO I don't think anything besides the vehicles really need to use any kind of complex physics engine. TFP could write a lower level physics handler for things like gibs, and whatnot, and run them both. I don't know anything about how unity works, and what freedoms the coders have though...

 

You can write your own physics from the ground up or integrate another physics library of your choice. That's a hell of a lot of work though and if you intend to integrate it into unity's built-in physics engine then there's little point, and quite a few disadvantages, in adding a second set of physics.

 

Many years ago I coded accurate particle physics into unity for fun, I can see why physics engines cheat quite a bit because accurate physics is incredibly hard on the system resources.

Link to comment
Share on other sites

That sounds like the same problem. The root cause of it is likely to do with the utterly crazy way modern processors deal with floating point numbers. In just about everything else in computing things are deterministic, not with floating point arithmetic. Some genius decided early on that modern processors should use a floating point instead of a fixed point, mainly for the gain in processing speed. This has been the chagrin of many developers of both hardware and software over the years... myself included. The upshot of this is that if you try to calculate the same number twice it's pretty unlikely that you'll receive the exact same result, the more calculations required to get the answer the less likely the answer is to correlate.

 

Floating point is generally about the same speed as integer math on similar operations like 2 + 2. It was made for the extreme ranges of numbers you can use, but at a loss of precision, since both are typically 32 bit values, but floats need some of those bit for the exponent, thus reducing the significand's range of values.

 

https://en.wikipedia.org/wiki/Floating_point

 

"is arithmetic using formulaic representation of real numbers as an approximation so as to support a trade-off between range and precision. For this reason, floating-point computation is often found in systems which include very small and very large real numbers, which require fast processing times. A number is, in general, represented approximately to a fixed number of significant digits (the significand) and scaled using an exponent in some fixed base"

Link to comment
Share on other sites

Floating point is generally about the same speed as integer math on similar operations like 2 + 2. It was made for the extreme ranges of numbers you can use, but at a loss of precision, since both are typically 32 bit values, but floats need some of those bit for the exponent, thus reducing the significand's range of values.

 

https://en.wikipedia.org/wiki/Floating_point

 

"is arithmetic using formulaic representation of real numbers as an approximation so as to support a trade-off between range and precision. For this reason, floating-point computation is often found in systems which include very small and very large real numbers, which require fast processing times. A number is, in general, represented approximately to a fixed number of significant digits (the significand) and scaled using an exponent in some fixed base"

 

Many of us would have preferred fixed-point arithmetic despite the slight reduction in speed. Over the years floating-point has caused more problems than it's solved. If it wasn't for the fact that such calculations are built in to the processor I would have written my own fixed-point library and never looked back.

Link to comment
Share on other sites

Physics engines are great for things like vehicles, and realism overkill, but IMO I don't think anything besides the vehicles really need to use any kind of complex physics engine. TFP could write a lower level physics handler for things like gibs, and whatnot, and run them both. I don't know anything about how unity works, and what freedoms the coders have though...

 

Vehicles interacting with the world and entities requires those to have colliders and sometimes rigid bodies. Ragdolls also use physics.

 

Gibs, explosions and such are typically particle effects and do not use the physics system.

Link to comment
Share on other sites

Vehicles interacting with the world and entities requires those to have colliders and sometimes rigid bodies. Ragdolls also use physics.

 

Gibs, explosions and such are typically particle effects and do not use the physics system.

 

So se could have limbs ripped of instead of just exploding?

Link to comment
Share on other sites

You can write your own physics from the ground up or integrate another physics library of your choice. That's a hell of a lot of work though and if you intend to integrate it into unity's built-in physics engine then there's little point, and quite a few disadvantages, in adding a second set of physics.

 

Many years ago I coded accurate particle physics into unity for fun, I can see why physics engines cheat quite a bit because accurate physics is incredibly hard on the system resources.

 

I wouldn't suggest trying to integrate, but run along side, and apply specifically to objects not using the built in physics. Writing your own physics from the ground up isn't so bad if you've done it before, and you are going for the bare minimum, such as bouncing off anything, but only really rolling and sliding on the ground rather than applying full physics to every collision. Bounces don't even have to be completely accurate. Bounding boxes can just be rectangles rather than having a shape.

 

That said, dead bodies ragdolling would still require the more advanced physics engine. I've recently written such physics code for Quake gibs using its limited collision types and limited angle handling, and it runs so well that I don't ever remove the gibs at any point. And at this stage in the development, everything gibs when it dies, so there are a LOT of gibs. You can also kick them around for an unlimited amount of time. The real key to the massive number of gibs is that I take them out of their linked list when not near a player, and not moving, so that when I calculate physics, they are completely ignored. The player or any other moving object can do radius checks to re-add gibs to their linked list.

 

Does unity have a function to trace into models and detect a collision without being forced to use a collision object to detect such a thing? If so, that would be required to avoid using the expensive collision objects.

 

- - - Updated - - -

 

So se could have limbs ripped of instead of just exploding?

 

That would require them to use something for limbs other than particles. Unless someone gets creative.

Link to comment
Share on other sites

Does unity have a function to trace into models and detect a collision without being forced to use a collision object to detect such a thing? If so, that would be required to avoid using the expensive collision objects.

 

Not built-in, you'd essentially have to write your own collider system based on mesh limits to do it and that would get computationally expensive on a complex mesh. It should be relatively simple to apply those interactions to the unity colliders as long as you know the impact point and speed.

 

Update: I was wrong, here's some code that does it straight from the vertex data but its still computationally expensive on a complex mesh.

 

https://forum.unity.com/threads/raycast-without-colliders.14378/

Link to comment
Share on other sites

Many of us would have preferred fixed-point arithmetic despite the slight reduction in speed. Over the years floating-point has caused more problems than it's solved. If it wasn't for the fact that such calculations are built in to the processor I would have written my own fixed-point library and never looked back.

 

I'd rather have the float range of values for the world, not a +/- 2 million range that I have to reduce to get x bits of fraction. If you want precision, you go with double, with its 53 bits of significand precision, which I have seen some people wishing Unity used and someday it probably will as computers reach the everything is 64 bits and so fast and with so much RAM, that we don't care anymore.

Link to comment
Share on other sites

Not built-in, you'd essentially have to write your own collider system based on mesh limits to do it and that would get computationally expensive on a complex mesh. It should be relatively simple to apply those interactions to the unity colliders as long as you know the impact point and speed.

 

Update: I was wrong, here's some code that does it straight from the vertex data but its still computationally expensive on a complex mesh.

 

https://forum.unity.com/threads/raycast-without-colliders.14378/

 

Rectangular bounding boxes would be best for being non-computationally complex.

Link to comment
Share on other sites

I'd rather have the float range of values for the world, not a +/- 2 million range that I have to reduce to get x bits of fraction. If you want precision, you go with double, with its 53 bits of significand precision, which I have seen some people wishing Unity used and someday it probably will as computers reach the everything is 64 bits and so fast and with so much RAM, that we don't care anymore.

 

I already do use doubles, hell, I've had to write my own Vector3d library to do what I want. It's not the range of numbers that bothers me, it's the inaccuracy of replicating results and the weird issues you have with very small or very large numbers which push the limits of the exponent. Combine that with the nightmare of trying to convert a double to within the range of a float and fixed-point looks better by the second.

 

Since unity has largely dropped support for 32 bit systems there's no logical reason not to use 64 bit in the engine except for the amount of work involved in bringing the engine up to date.

 

I can agree to disagree, such things are often a matter of taste and suitability to the job at hand.

 

- - - Updated - - -

 

Rectangular bounding boxes would be best for being non-computationally complex.

 

Then just use a rectangular collider and save yourself the extra work :-)

Link to comment
Share on other sites

Guest Rassilon

Madmole showed new Material, again on his Twitter.

 

May I ask, why not posting Material from the Devs in the Dev Diary of A17 ?

I dont use Twitter and dont want to look up 20 Sources to be up to date with the news :/

Link to comment
Share on other sites

Madmole showed new Material, again on his Twitter.

 

May I ask, why not posting Material from the Devs in the Dev Diary of A17 ?

I dont use Twitter and dont want to look up 20 Sources to be up to date with the news :/

 

Yeah this is a valid question. This is the 3rd time in a row if I remember correctly that MM posted new screenshots only on Twitter, and not on the forum. I do have Twitter, so that's not a problem for me, but for an information-starved forum..

Link to comment
Share on other sites

Madmole showed new Material, again on his Twitter.

 

May I ask, why not posting Material from the Devs in the Dev Diary of A17 ?

I dont use Twitter and dont want to look up 20 Sources to be up to date with the news :/

 

+1

I don't use twitter, but I want to receive all the news about the game.

Furthermore all the hardcore fans interested in the updates are here in the forum.

 

- - - Updated - - -

 

The trees look amazing though (: well done!

Link to comment
Share on other sites

MM might have lost his password for here..

 

Apart for that - a only one place to notify ppl is not possible. Some ppl use tweeter and do not read here. Or oposite such as us :). He is trying to cover as much audience as possible. Some balance is needed though.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...