Not really more free time if you have to run after two toddlers and work remotely at the same time, but yes, some progress has been made. I'll post a more detailed update when we have something to show, but currently, I'm porting VPX physics into Unity's ECS, while Ravarcade is looking into the Bullet physics engine.
Thanks Freezy, sounds good. Yeah I hear you...I'm juggling home schooling with a 9 and 11 year old, work and trying to do a little work on a vpx table. Never enough time!
I think I got the foundation of the physics port more or less working. Both @ravarcade and I have been busy with this for the past months. We first started at looking into Unity's new DOTS physics engine and if we could customize it easily enough to get VPX's physics in there, but at least for me it was too overwhelming, because both DOTS physics and the underlying ECS are very new technologies and still under development, so it was just too much to take in all at once.
Then, while @ravarcade started integrating the Bullet Physics engine, I've started looking at how to port the VPX C++ code into ECS. So for the geeks, maybe a few words about ECS first. ECS is Unity's new data-oriented approach for game design. "New" as in newly adapted by Unity, it has actually been around for a while already.
The idea is that instead of game objects which contain logic and data altogether, the data and the logic is separated. The object becomes a super lightweight entity (the "E") the data is split into components (the "C"), and game logic moves to systems (the "S").
Systems only pick the data they need. The ECS engine aligns this data in the RAM, and when a system operates, that data gets all at once loaded into the super fast L-caches of the CPU, allowing the system to execute insanely fast.
Then Unity developed something really amazing called the Burst compiler. This guy takes your managed C# code and spits out highly optimized native code. It uses the CPU's SIMD instructions, meaning as soon as you do vector math (which is basically all you do in a physics engine), it can execute multiple instructions at once. Game devs have seen a 50x performance boost of their games just by ticking the "Enable Burst" box.
There are obviously drawbacks, though. Handling data can become meticulous. Just want to save an array somewhere? You're shit out of luck, have fun with BlobArrays, DynamicBuffers and NativeArrays. It takes a while to get used to, and I'm still not sure if my data layout is the efficient one (probably not).
Anyway.
While I think we can still get a lot faster in terms of performance, it seems to be in the same ball park as VPX right now. Here a small test with a few balls:
You'll notice that ball spin is still somehow screwed up. Also, I haven't ported all the colliders yet, for example rubbers or gates don't exist in the physics world (everything is rendered though).
But what's really cool now is that instead of having one huge player class of several thousands of lines, we have neatly organized systems that do the same job. ECS forces you to avoid globals and dozens of unused member variables, so you know exactly what data you're dealing with, which is a big deal when reading (and maintaining) code. Here's the PR with a schema for those interested.
So while there were a few unpleasant moments, I'm quite happy how it turned out so far. I also have to say that it's quite uncommon that the co-founder and CTO of a company of the size of Unity jumps in and helps you debugging your code. Thanks Joachim!
Next steps are fixing bugs like ball spin, and I might have a look into parallelization. Because now we have systems, we can run them in parallel. It comes with a small overhead, but if 10 balls can be simulated on 10 cores simultaneously it might be worth it. There are other low-hanging fruits like swapping the broadphase algorithm of the ball-ball collisions, which seems the slowest part currently.
Then I'll continue porting the remaining game items like gates, targets, bumpers, etc. This should be quite straight-forward.
Great to see this moving forward more! Looks excellent.
@Ravarcade has done some amazing things with BAM on Future Pinball over the years (and the last few in particular)... so he is an absolute great asset to help with development.
I promise I'll try to stop distracting him too much from VPE... but the pup plug-in he and @DJRobX made for BAM is just so damn cool and makes my stuff look amazing in VR!
Just imagine how the VPE tables will look in VR! That is a big thing to keep in mind! When I do mods or updates to a FP table in BAM.... doing them in VR is amazing and really changes how you would make a table, or adjust the lighting... everything is so much cooler to work with that way in realtime!
Let's not underestimate the importance of complete features like backglass, scoring, text, media (videos) and how essential that stuff is. I know the VP crowd is used to letting the "rom" do everything along those lines, and there's never been much focus on original tables in comparison because of that.... but imagine what can be done on VPE for original tables with the right tool set.
The hard work for these recent VPX tables along the lines of flupper, G5K, Knorr, Bord (and others) with all that attention to detail on their offline renders will pay off big time...and I can't wait to see what those guys can do!
The future looks exciting... and we can't thank you guys enough for your hard work!
Yeah, I'd like to see a form of PinUp crossover support a'la BAM's new PinEvent come with VPE. It'd be a nice feature to be able to run the videos on the backglass in virtual reality, or in FSS, or to be able to run actual videos on a screen on the playfield or apron.
Favorite Pinball: Attack from Mars, Abra Ca Dabra and many old EM-Tables
Posted 29 May 2020 - 05:54 AM
Great work and thank you, that you keep us informed. Can't wait to play the first table in VPE.
Gesendet von meinem CMR-W09 mit Tapatalk
Rajo Joey - My front-end-files; Hundreds of Audio- and Videorecordings in high quality for Playfield (4k/60FPS) and Backglass (HD), Wheels & POV-Files: The Media-Post
Yeah, I'd like to see a form of PinUp crossover support a'la BAM's new PinEvent come with VPE. It'd be a nice feature to be able to run the videos on the backglass in virtual reality, or in FSS, or to be able to run actual videos on a screen on the playfield or apron.
It's pretty easy to setup a texture to display video in Unity. I'm guessing this will be an easy addition
Thanks guys! Ravarcade is a very nice addition indeed, and our skills are mostly complementary, so he's fantastic to work with. Also we have both NailBuster and DJRobX on the team, so I have no doubt that Pup will see the light of day eventually.