Jump to content



Photo
* * * * * 26 votes

WIP: Visual Pinball in Unity


  • Please log in to reply
813 replies to this topic

#221 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 11 May 2020 - 06:46 PM

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.

 

EDIT: Also released dmdext 1.8, which took some time as well.


Edited by freezy, 11 May 2020 - 06:47 PM.


#222 Mr H

Mr H

    Enthusiast

  • Members
  • PipPipPip
  • 96 posts

  • Flag: Australia

  • Favorite Pinball: Monsterbash

Posted 15 May 2020 - 10:39 AM

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!



#223 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 28 May 2020 - 08:46 PM

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.

That's it so far from my side!


 


Edited by freezy, 28 May 2020 - 08:49 PM.


#224 toxie

toxie

    VPF Veteran

  • VP Dev Team
  • PipPipPipPipPipPip
  • 5,734 posts
  • Location:berlin, germany

  • Flag: Germany

  • Favorite Pinball: AFM

Posted 28 May 2020 - 09:01 PM

Cool, just quickly browsed over it. You really ported all concepts and code over almost 1:1. Respect that this now all works out!



#225 watacaractr

watacaractr

    Enthusiast

  • Gold Supporter
  • 133 posts
  • Location:Huntington Beach, CA

  • Flag: United States of America

  • Favorite Pinball: Bad Cats, Elvira and the Party Monsters

Posted 28 May 2020 - 09:11 PM

We're ready when you are. :)



#226 unclewilly

unclewilly

    sofa king.....

  • VIP
  • 5,170 posts
  • Location:Baltimore, Maryland

  • Flag: United States of America

  • Favorite Pinball: tz, tom, big hurt, who dunnit



Posted 28 May 2020 - 09:17 PM

You rock freezy

"it will all be ok in the end, if it's not ok, it's not the end"
 
Monster Bash VP10 WIP https://dl.dropboxus... (vpx)WIP15.vpx

uw2.gif


#227 Ben Logan

Ben Logan

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 2,275 posts
  • Location:California

  • Flag: ---------

  • Favorite Pinball: System 11

Posted 28 May 2020 - 09:27 PM

Super exciting, freezy and ravarcade! Thanks so much for the progress report. Keep up the fantastic work. Let us know how we can support you guys.



#228 shannon1

shannon1

    Enthusiast

  • Platinum Supporter
  • 244 posts

  • Flag: United States of America

  • Favorite Pinball: black knight

Posted 28 May 2020 - 09:36 PM

Fantastic work! 



#229 xantari

xantari

    Enthusiast

  • Platinum Supporter
  • 154 posts

  • Flag: United States of America

  • Favorite Pinball: Star Trek TNG

Posted 28 May 2020 - 10:56 PM

This is so exciting!! Can't wait for BAM mode in VP Unity! :-)


Edited by xantari, 28 May 2020 - 10:56 PM.


#230 Slydog43

Slydog43

    Pinball Wizard

  • Platinum Supporter
  • 3,008 posts
  • Location:Hackettstown, NJ

  • Flag: United States of America

  • Favorite Pinball: Addams Family, All Williams 90's Games

Posted 28 May 2020 - 11:14 PM

wow, I was hoping that this project wasn't dead.  Great work guys, the future is so bright!!!!



#231 TerryRed

TerryRed

    Pinball Fan

  • Silver Supporter
  • 1,922 posts

  • Flag: Canada

  • Favorite Pinball: Too many to choose...

Contributor

Posted 28 May 2020 - 11:27 PM

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!



#232 LynnInDenver

LynnInDenver

    Pinball Fan

  • Members
  • PipPipPipPip
  • 570 posts
  • Location:Denver

  • Flag: United States of America

  • Favorite Pinball: Genie

Posted 29 May 2020 - 12:00 AM

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.



#233 bord

bord

    Pinball Fan

  • Members
  • PipPipPipPip
  • 603 posts

  • Flag: ---------

  • Favorite Pinball: Star Gazer, Whirlwind, Frontier

Posted 29 May 2020 - 04:13 AM

Freezy, you made my day. Keep up the great work!



#234 Rajo Joey

Rajo Joey

    Pinball Fan

  • Members
  • PipPipPipPip
  • 1,489 posts
  • Location:Niedersachsen

  • Flag: Germany

  • 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

https://www.facebook...02697096474910/

https://www.facebook...oups/VPAddicts/

https://www.facebook...oups/VPjunkies/


#235 Rawd

Rawd

    Pinball Wizard

  • VIP
  • 4,313 posts
  • Location:Edmonton, Canada

  • Flag: Canada

  • Favorite Pinball: Triple Strike



Posted 29 May 2020 - 05:59 AM

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 :)



 


#236 blindpeser

blindpeser

    Enthusiast

  • Members
  • PipPipPip
  • 421 posts

  • Flag: ---------

  • Favorite Pinball: WCS94

Posted 29 May 2020 - 06:13 AM

Thank you for your effort and the update! @freezy and @Ravarcade

Edited by blindpeser, 29 May 2020 - 06:14 AM.


#237 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 29 May 2020 - 06:44 AM

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. ;)



#238 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 29 May 2020 - 07:58 AM

@fripounet any way you could create a new thread with your brilliant blueprint idea? Thanks! :)



#239 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 29 May 2020 - 11:36 AM

with unreal engine at least there is blueprint to support non coders in c ++

 

Just use the construction kit, which is more than good enough head start. Let me know if you sort the physics out.

 

https://github.com/f...onstruction-kit
 


Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000


#240 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 29 May 2020 - 01:31 PM

 

in vbs it's a breeze

 

C# for basic scripting is also a breeze and can be written and tested breezier than VBScript innit.

 

You will only need basic C# skills for scripting in Unity. And by skills, I mean having the ability to create methods and set variables, lol. 

 

All depends how it's implemented in this, doesn't it.

 

I think rather than constant post here what you reckon is good to use in engines, learn them yourself, make something.


Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000