Jump to content



Photo
* * * * * 25 votes

WIP: Visual Pinball in Unity


  • Please log in to reply
811 replies to this topic

#1 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 683 posts

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

  • Favorite Pinball: T2, TOM, AFM

Posted 13 February 2020 - 11:55 AM

*
POPULAR

Update January 2022:

 

Firstly, for those coming from Retroplay's YouTube channel, please be aware that Dave Gilmore has built a business around selling and redistributing what our community provides for free. Despite our vocal feedback and creators even leaving the community, he continues to do so. He is a parasite and you should probably show him the finger instead of giving him money.

 

Secondly, the updated WIP thread is here.

 

 

Hi!

A few months ago we were discussing among devs how a next-generation pinball simulator would look. We all love Visual Pinball, so it was clear from the beginning that it should plug into the existing ecosystem, rather than re-invent everything from scratch.

I wrote a protocol here. There's a summary at the bottom. You should probably go read it before continuing here, since it contains a lot of info. :)

Since I've spent the better part of last year working on a JavaScript port of Visual Pinball (which, by the way, is nearly finished), I have a good idea of the effort it would take to port Visual Pinball to C#.

So I couple of weeks ago I started with the data layer and with the help of @shaderbytes managed to convert the geometry, materials and textures into Unity's asset format. It's called Visual Pinball Engine, or VPE. All is entirely static and completely unplayable, but we thought that now would be a good moment to involve the community. :)

Because we can not only read VPX files, we can also write them. And I think table authors will like this, because it will allow you to edit your builds in real-time in a quite sophisticated editor:



As you can see, the editor knows what a flipper is. Unity's editor allows a wide range of customizations. For example, in the 3D view port, we could render the drag point handles of the splines when a rubber or ramp is selected, and make them editable directly in 3D.

The values you see in the inspector are all accessible and editable while running the game, which should be useful when tweaking physics parameters.

Then, importing models should be much more streamlined with Unity. You basically model your stuff in Blender (or whatever modelling tool you're comfortable with), save, switch to Unity, and it will automatically re-import your changes. This is a common workflow in game development.

So we think that this would be a big improvement for authors. But there's also a few things for players. :)

Firstly, Unity's High Definition Render Pipeline just became stable in the latest release. Here's a demo with me playing around with a flasher.



Remember this is a very naive conversion of Visual Pinball's materials. Authors will have a full PBR renderer at their disposal, allowing to tweak many parameters to make the materials look more realistic.

HDRP also comes with experimental ray tracing support. Here's a demo of me playing with ray traced real-time shadows:



Probably not something for day one, but still fun to play with. :)

Oh, and I didn't make a demo, but obviously Unity comes with VR support out of the box.

By now you're probably wondering how this is supposed to stay backwards-compatible with Visual Pinball. Well, it won't entirely. If you create or tweak materials with parameters that don't exist in VP, well, we can't port them back. But the goal is to piggyback the Unity-specific stuff in the .vpx file as separate data while keeping the properties that exist in both engines in sync.

So, to conclude: Table authors, if you have specific pain points you'd like us to address with the editor, let us know! If you have an opinion about a new scripting engine, let us know as well. While in order to keep backwards compatibility, VBScript will be supported, a big part of table scripts deal with limitations of VP, so we'd like to know which parts an engine could adopt, and if rewriting your scripts with a clean and smart API is an option for you at all.

Developers, if you want to contribute and are comfortable with C#, ping me, we have a Discord channel. These are our next tasks.

One important thing to mention: VPE is a library, and its core is game-engine agnostic. This means everything Unity-related is in a separate project, allowing other game engines like Godot to plug into the core the same way.

And last but not least, here's the repo:

https://github.com/f...lPinball.Engine

Cheers!

    -freezy.


Update 2020-02-19:

 

Flippers are moving.

 

 

 

Update 2020-03-22

 

Quick test with VPM:

 

 

 

Update 2020-05-28

 

First port of VPX physics:

 

 

Update 2020-06-08

 

Gates, spinners and bumpers ported.

 

https://www.youtube.com/watch?v=veadt9vaTRM

 

 

Update 2020-08-03

 

I've created a Wiki to collect screenshots in Unity. LINK

 

Update 2020-10-03

 

Various updates

 

Update 2021-03-16

 

First MPF integration.

 

https://www.youtube.com/watch?v=cdzvMUpdDgs


Edited by freezy, 01 February 2022 - 07:44 AM.


#2 blindpeser

blindpeser

    Enthusiast

  • Members
  • PipPipPip
  • 419 posts

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

  • Favorite Pinball: WCS94

Posted 13 February 2020 - 12:51 PM

Wow, I do not understand everything completely, but this sounds awesome and promising!

Edited by blindpeser, 13 February 2020 - 12:51 PM.


#3 Herweh

Herweh

    Backglass fan

  • VIP
  • 452 posts
  • Location:Germany

  • Flag: Germany

  • Favorite Pinball: Yes

Posted 13 February 2020 - 01:40 PM

Wow, freezy, this looks absolutely fantastic and breathtaking. I‘m more than thrilled.

herwehb2s-avatar-jr-100.pngbreakshot-sig-small3.pngatlantis-sig-small.pngmousinaround-sig6.pngsc-badge1.pnglw-sig.pngembryon-logo0.pngladyluck.pngapollo13_badge3.pngwhirlwind_badge.png


#4 fuzzel

fuzzel

    spaghetti code

  • VP Dev Team
  • PipPipPipPipPip
  • 2,818 posts

  • Flag: Germany

  • Favorite Pinball: yes I have

Posted 13 February 2020 - 02:01 PM

Awesome... I can finally retire :D

#5 BorgDog

BorgDog

    We come in peace.. shoot to kill.. shoot to kill.

  • Members
  • PipPipPipPip
  • 1,427 posts
  • Location:Leavenworth, WA

  • Flag: United States of America

  • Favorite Pinball: Alien Star, TNA



Posted 13 February 2020 - 02:08 PM

Looks like a great way forward.  Also looks like I am going to have to learn a lot of new stuff if I'm going to continue to make tables. 

 

So visual pinball in unity.. VPU??  LOL



#6 bord

bord

    Pinball Fan

  • Members
  • PipPipPipPip
  • 603 posts

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

  • Favorite Pinball: Star Gazer, Whirlwind, Frontier

Posted 13 February 2020 - 02:19 PM

Well, you had me at PBR materials and HDRP!

 

Will this support GPU instancing? Seems like a huge amount of polys on a pinball game go to repeated meshes (posts, screws, nuts).

 

Also, how does this work w/ physics? Unity physics or VP physics?

 

Very promising stuff. More interested in the render engine side improvements than the 3D realtime editor side, honestly.



#7 tictox

tictox

    Enthusiast

  • Members
  • PipPipPip
  • 143 posts

  • Flag: South Africa

  • Favorite Pinball: space

Posted 13 February 2020 - 02:22 PM

enfin!!!!! super :tup:.

peux tu intégrer un environnement 3d comme celui de realizzer , pour une gestion temps réel des lumières (éclairage ambiant) et insertion des tables à l’échelle , pour la création de salle vr?

 

dans ta 3e video tu n'as pas activé la lumière volumétrique, elle est opérationnelle ?

 

when parsing the VPX file we did not manage to extract the EXR asset used in VPX properly yet. Freezy did give me some insight into the way it is serialized in VPX but i never looked further into it. I think currently the scenes just used the default built in procedural HDR of Unity. For those not understanding fully what freezy was saying. The tool currently takes a VPX compiled binary and parses it to rebuild the entire table in unity. Well at least much of it already. Its not complete but it is pretty amazing. Mostly freezy is the Genius in all this ;) I just helped a little along the way


Edited by tictox, 13 February 2020 - 02:22 PM.


#8 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 683 posts

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

  • Favorite Pinball: T2, TOM, AFM

Posted 13 February 2020 - 02:36 PM

@tictox: Forgot you have a different alias here - so the Unity pro here is @tictox for those who are confused :)

 

@bord: Yes, Unity supports GPU instancing, but it's difficult to apply the way the VPX files are set up nowadays. We basically would have to somehow recognize identical meshes. About physics, currently the plan is to port VP physics. This makes sure the current tables out there will work without having to be re-tweaked. And VP physics are really good.



#9 tictox

tictox

    Enthusiast

  • Members
  • PipPipPip
  • 143 posts

  • Flag: South Africa

  • Favorite Pinball: space

Posted 13 February 2020 - 02:39 PM

sadly an old username I cant change here. Im shaderbytes everywhere else online ;) 



#10 LynnInDenver

LynnInDenver

    Pinball Fan

  • Members
  • PipPipPipPip
  • 570 posts
  • Location:Denver

  • Flag: United States of America

  • Favorite Pinball: Genie

Posted 13 February 2020 - 02:40 PM

So, is the intent is that eventually we can develop and run a table in VPE directly, using (most) of the scripting techniques we've already learned for VPX?

 

I definitely have some interest.



#11 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 683 posts

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

  • Favorite Pinball: T2, TOM, AFM

Posted 13 February 2020 - 02:49 PM

@LynnInDenver: Definitely yes about the develop and run part. About the scripting techniques, it depends. If it's a technique to compensate for missing render features (such as ball shadow), probably not. We'll try to detect those, disable them, and implement them in the engine directly.



#12 rothbauerw

rothbauerw

    Enthusiast

  • Members
  • PipPipPip
  • 345 posts
  • Location:Wisconsin - USA

  • Flag: United States of America

  • Favorite Pinball: Dr Who, Tee'd Off, Jive Time

Posted 13 February 2020 - 03:31 PM

Really cool! From my perspective, I would say don't worry too much about the scripting. It really doesn't take that long to script a table nowadays. I wouldn't let needing to go through and remove ball shadows or rebuild in some other scripting language stop you from choosing the best path forward.

#13 DJRobX

DJRobX

    Pinball Fan

  • VP Dev Team
  • PipPipPipPip
  • 941 posts
  • Location:Valencia, CA

  • Flag: United States of America

  • Favorite Pinball: F14 Tomcat

Posted 13 February 2020 - 04:08 PM

Really cool! From my perspective, I would say don't worry too much about the scripting. It really doesn't take that long to script a table nowadays. I wouldn't let needing to go through and remove ball shadows or rebuild in some other scripting language stop you from choosing the best path forward.

Right, the fact that it can import and mostly play them at all is amazing.   People will be modifying them and optimizing them for VPE in short order, so I agree, I wouldn't sweat some of the finer details like that.   On the other hand, there are so many "permission to mod: no" tables out there by authors who have left the building, a little bit of compatibility magic would probably make life a lot easier on folks. 



#14 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 683 posts

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

  • Favorite Pinball: T2, TOM, AFM

Posted 13 February 2020 - 04:29 PM


Right, the fact that it can import and mostly play them at all is amazing.

Hold your horses, a tiny little amount of work is still needed until we can play anything. :)

 

But yes, the goal is a retro-compatible player.



#15 rascal

rascal

    two-faced as they come

  • VIP
  • 1,373 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 13 February 2020 - 04:49 PM

Unity has the ability to port to many different platforms, does this mean that we potentially will be able to play VP tables on android and linux without needing wine? Maybe even play on a raspberry pi?


Awesome... I can finally retire :D

 

NOOOOOOOOO PLEASE!!!!


Posted Image


#16 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 683 posts

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

  • Favorite Pinball: T2, TOM, AFM

Posted 13 February 2020 - 05:04 PM

With a new scripting engine and if toxie or djrobx manage to port pinmame to llvm, i'd say yes :)

#17 TerryRed

TerryRed

    Pinball Fan

  • Silver Supporter
  • 1,808 posts

  • Flag: Canada

  • Favorite Pinball: Too many to choose...

Contributor

Posted 13 February 2020 - 05:37 PM

This looks fantastic and is definitely a step in the right direction!

 

If this could somehow bring VP into focus to help make this more of the standard for the next major version of VP.... I think the devs, table authors...everyone would be excited to move forward with a more modern VP!

 

Finally our GPU's will get to be used to their max potential, not just for gameplay, but for real-time 3D authoring!

 

Stunning stuff!


Edited by TerryRed, 13 February 2020 - 05:58 PM.


#18 DCrosby

DCrosby

    Enthusiast

  • Platinum Supporter
  • 125 posts

  • Flag: United States of America

  • Favorite Pinball: Phantom Of The Opera (Currently, may change tomorrow) ;D

Posted 13 February 2020 - 06:12 PM

Attached File  BlueMyself.png   70.98KB   22 downloads

 

Wow, alone having a 3D editor, where I can see where my bumpers are would be huge... but being a Unreal/Unity Developer for years now, I've been missing a proper Material editor, with Emissive and roughness values.... OMG!

What does this do to collision, and stuff that's all obviously still a part of VPX, right ?

I'd say also that the light calculations for on/off, and being able to transition from texture/material A to Material B for GI calculated tables would right now be #2 on my list besides 3D Representation of the table. 

 

:dblthumb:  :otvclap:  :db:


OMG, and I just realized, a proper debugger, with breakpoints ????? :D Say YES please !!!!



#19 Rawd

Rawd

    Pinball Wizard

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

  • Flag: Canada

  • Favorite Pinball: Triple Strike



Posted 13 February 2020 - 06:15 PM

This is pretty exciting stuff.  In the last few years I have become very comfortable with Unity development.  It will be sweet to be able to work on tables/VR rooms in a realtime 3D editor, while maintaining VP's physics engine.  It should run better on lesser CPU/GPU, and as Rascal said..  we should be able to port to other systems/consoles.  Fun times ahead!  :)



 


#20 DCrosby

DCrosby

    Enthusiast

  • Platinum Supporter
  • 125 posts

  • Flag: United States of America

  • Favorite Pinball: Phantom Of The Opera (Currently, may change tomorrow) ;D

Posted 13 February 2020 - 06:15 PM

Also last I used HDRI in Unity, it was using a PNG which it then encoded the luminane into the alpha, which is kind of how HDR stores data magnitude (4 Channels).... I don't know if that helps, but that's how Marmoset Lighting used HDRI's for calculating ambient lighting for scenes in Unity.