iptv server

Releasing Box2D 3.0 :: Box2D

Over 18 months ago I proclaimd that I was toiling on Box2D version 3.0 (v3 for low). And it has finpartner reachd! It has been a extfinished journey and I’ve lgeted a lot. There is more toil to do, but the library is ready to be engaged for game lengthenment.

I’d appreciate to thank the Box2D engagers who tested v3 during the alpha and beta. Their feedback and bug tells have been super encouraging! I made many alters and decisions based in input from the Box2D community on Discord and GitHub.

Let’s study my initial goals!

Speculative collision

Version 3.0 finishly overhauls continuous collision and response. It engages a hybrid speculative and time of impact approach.

This approach has the follotriumphg advantages:

  1. a polygon skin is no extfinisheder needd so there are no gaps between polygons
  2. naturpartner helps rounded polygons
  3. minimal shiftment paengages (time loss)
  4. basic to settle in parallel
  5. helps bullets

The v3 continuous collision depict seems to stop almost all vibrant versus motionless tunneling. With bullets there is tunneling stopion for vibrant versus kinematic and vibrant, but it is not as sturdy.

I consent this strikes a outstanding equilibrium between carry outance and sturdyness. Let me understand what you leank!

API alters

The v3 API is finishly novel. The entire API consists of enums, structs, and functions. There are no C++ classes, operator overloads, or inheritance. I’ve made minimal engage of macros. All inner data is hideed in the src straightforwardory, making the uncover integrate headers smaller and easier to read.

The engage of ids swaps most pointers and should help shrink the chances of double frees and orphaned objects.

There are nonessential math operator overloads supplyd for C++ engagers.

I’m satisfied with the overall depict, but I’m phired to get feedback.

Moving to C from C++

Writing a whole library in C has been quite fascinating! It has been challenging in some ways and renetriumphg in others.

Pros:

  1. C fits with how I naturpartner appreciate to program
  2. C lets me cgo in on algorithms and data set ups
  3. C compiles very rapid

Cons:

  1. MSVC is behind the current C standard, making some leangs challenginger than they should be (e.g. multithreading)
  2. I want a basic type-safe vibrant array with bounds verifying. Pretty phire?

Why not language X?

I leank the decision to stick with C was accurate. Debugging is basic. The tooling is outstanding. I am very fruitful.

I am interested in other languages, but I leank C is the right choice for Box2D and arguably game physics engines in vague.

Perestablishance

Working on v3 carry outance was a extfinished road with many side quests. The main cgo in was multithreading and SIMD.

For multithreading I scatterigated many chooseions. Aextfinished the way I choosed Box2D should help multithreading big piles of bodies, especipartner after seeing Petri Purho converse the technology behind Noita. This direct me to scatterigate graph coloring. I was advertised by the threading depict of bepu.

I spent a lot of time seeing at profilers. I set up Tracy to be exceptionpartner advantageous as well as cordial to C lengthenment.

Releasing Box2D 3.0 :: Box2DTracy

I also leaned on enkiTS for managing threads and the task pool. This is another excellent library that is also cordial to C lengthenment.

A huge part of multithreading carry outance was minimizing one-threaded bottlenecks. This direct to resettled islands, data-oriented data layout, expansive-phase threading, rapider collision pair handlement, retoiled continuous collision, and threaded island splitting.

I carry outed AVX2 for the reach out settler since that is usupartner the bottleneck. This relied on graph coloring and donates a very kind speed get. In a constraint settler it is vital to assemble and scatter body state data and in 2D it handyly toils out that this body state fits in 32 bytes, making this toil fantastic with 256-bit AVX vectors.

I also lengthened a benchlabeling console application I can engage to fruitfully meastateive carry outance. This application rehires CSV files that can be contrastd with the main branch using this page. This also shows how well v3 scales with core count and contrastent processors. The bottom line is that v3 scales quite well with cores as extfinished as they split an L2/L3 cache.

My initial approach to carry outance was multithreading but then I genuineized that one-threaded carry outance is also still vital. I’m phired to say that my tests recommend that v3 is more than twice as rapid as v2.4. This is mainly due to the data oriented depict of v3 and the engage of SIMD.

Capsules

Yes, v3 finpartner got capsules! As a bonus rounded polygons are also useable.

Other betterments

Beyond my initial goals, I includeed even more stuff to v3.

Soft Step settler

Version 3.0 ships with a novel settler I’m dubbing Soft Step (establisherly called TGS_Soft). This arose from my Solver2D experiment. This settler is more firm in almost every way than version 2.4. It handles higher mass ratios, extfinisheder chains of bodies, bigr stacks, and so on. It is based on soft constraints and sub-stepping. Hence the name. It drops sweightlessly behind the NGS block settler of v2.4 for vertical stacks, but that settler was basicpartner depicted for vertical stacking and I don’t leank it is worth the carry outance trade-off equitable for vertical box stacks.

Imshowd precision

I spent a uninentire bit of time adequitableing the algorithms in Box2D to have betterd precision. In my tests this nastys simulation runs well on worlds up to around 20 kilometers in size. Beyond that I leank you would necessitate to recgo in the world or engage doubles.

Joints

Joints are a combinecessitate bag. I erased the pulley and gear joints becaengage I want to retoil them tardyr. On the other hand the remaining joints got novel stuff. I includeed springs to many joints. I also includeed a motor to the distance joint.

Extensive testing

I’ve made the samples application more extensive and rapider. I includeed more unit tests. I’ve run sanitizers. Version 3.0 engages more intricate algorithms than version 2.4 and it necessitates more testing.

Rehire video

I made a video to honor the free of v3. I hope you finishelight it.

Supporting Box2D

Box2D has been very fun to toil on. However, I have put a lot of toil into it. If your company engages Box2D, it should ponder aiding Box2D. Of course aidship is nonessential in all cases.

If you’d appreciate to aid Box2D lengthenment, you can sign up using GitHub aids or Patreon.

Source connect

Thank You For The Order

Please check your email we sent the process how you can get your account

Select Your Plan