Jump to content

WIP: Visual Pinball in Unity (2021 Edition)


Recommended Posts

Just go to the site (https://docs.visualpinball.org/) and follow the directions for installation.  You can make a blank table in vpx, save it and import that into vpe.  If you import a table like "Cuphead",make sure that your flippers, plunger and bumpers have default VP names.  If any of these have meshes that replace the base items make sure that they are named like this "LeftFlipper_mesh".  I'm still having issues with some textures but it's a learning process.

 

Here's what Cuphead looks like when imported.

Untitled.png.3d2fb4fdaf06abf20687427634ac33b8.png.872f082d1aaf6d364e81f9a7fae8a41a.thumb.png.b131bc459931020dd67931fd77630459.png

Link to comment
Share on other sites

2 hours ago, scottacus said:

Just go to the site (https://docs.visualpinball.org/) and follow the directions for installation.  You can make a blank table in vpx, save it and import that into vpe.  If you import a table like "Cuphead",make sure that your flippers, plunger and bumpers have default VP names.  If any of these have meshes that replace the base items make sure that they are named like this "LeftFlipper_mesh".  I'm still having issues with some textures but it's a learning process.

 

Here's what Cuphead looks like when imported.

Untitled.png.3d2fb4fdaf06abf20687427634ac33b8.png.872f082d1aaf6d364e81f9a7fae8a41a.thumb.png.b131bc459931020dd67931fd77630459.png

Thanks Scottacus !!!!!!!!! ;);););) I'll try ;););)

 

Link to comment
Share on other sites

insert

 

insert flasher

flasher.thumb.jpg.78955820186b7cf9c2c555bc932a990a.jpg

 

of course windows / animation only for a quick preview of the effect, for those who don't know how to code in c # (like me). for a real light attract, obligatory C # script (as there are more than 40 effects, you need more than 40 scripts).

I got my answer on the unity script community.

example for an effect :

 

IEnumerator WipeUpTurnOn (List objects)
{
   float y = 0
   float time = 0
   float duration = 4
 
   while (time < duration)
   {
      foreach (object in objects)
      {
         if object already on {continue}
               //or perhaps remove from the list after changing
         if object.position.y < y {Change Material ON}
      {
      y += 0.1
      time += deltatime
      yield return null
   }
}

 

as vp is open source, its should be accessible

 

source light seq  it's C++, must convert it to C#, normally it should be exploitable with unity ?

 

other example but c++

 

// left side of the playfield wipes on going down while the right side wipes on doing up
   case SeqStripe2VertOff:
      inverse = true;
   case SeqStripe2VertOn:
      m_th1.type = eSeqLine;
      m_th1.x = m_GridXCenter - 1.0f;
      m_th1.stepX = 0;
      m_th1.processStepX = -1.0f;
      m_th1.y = 0;
      m_th1.stepY = 1.0f;
      m_th1.processStepY = 0;
      m_th1.length = m_lightSeqGridWidth / 2 + m_GridXCenterAdjust;
      m_th1.frameCount = m_lightSeqGridHeight;
      m_th2.type = eSeqLine;
      m_th2.x = m_GridXCenter;
      m_th2.stepX = 0;
      m_th2.processStepX = 1.0f;
      m_th2.y = (float)(m_lightSeqGridHeight - 1);
      m_th2.stepY = -1.0f;
      m_th2.processStepY = 0;
      m_th2.length = m_lightSeqGridWidth / 2 + m_GridXCenterAdjust;
      m_th2.frameCount = m_lightSeqGridHeight;
      break;

 

Edited by fastdraw
Link to comment
Share on other sites

Impressive work @fastdraw!  I've been working at getting vpe/unity to communicate with mpf via configs to drive a mpf-media controller to display ball in play, player up and score.  I've also had mpf start different modes which will be an important building block for making EM tables.  Here's a video of three bumper, four lane test table with vpe/unity running on the right and mpf-mc  top left and part of the mpf interface in the lower left.

 

 

Link to comment
Share on other sites

On 6/20/2021 at 10:56 PM, freezy said:

File Format

...

Having an VCS-compatible format is a big deal in my opinion. It allows working much more transparently. "Small" table tweaks could end up in pull requests in the original table repository instead of new mod releases, and this might result in the community working closer together with less friction and conflicts.

 

Hey freezy,

this is exactly how I imagine the hopefully near future will be! While you sketch a picture of how the creative process of the authors & modders can greatly benefit from the collaborative model used since decades in software development, I'm thinking more about how we as pinball players can benefit from it.

For example: When i fire up the cab after a week or two, i would love to see my frontend (say PinballY) telling me that n of the installed tables are outdated (~have received an update in the central VPE/VPX repository) and m tables have been added to the repository in the meantime. Do i want to sync to the latest versions before playing? Hell, YES! Because that means that i don't have to watch each and every forum thread repeatedly whether a table has received an update or not or if a table has been added. And then having to manually download & 'setup' these tables and searching for additional assets, etc. pp.. Please don't get me wrong - i don't expect to be fed automatically with the results of painstaking work of the authors without any appreciation. I just think it would  make our life so much easier! (I don't want to miss a "sudo apt-get update" on Linux and do all steps by hand, taking the whole evening...)

It would ultimately mean that everyone could focus on playing the tables instead of spending large portions of the spare time to just staying up-to-date and maintaining the rig. Or alternatively - spend more time for creative work, where also others can benefit. I mentioned assets: Yes, why not pull backglasses, wheel logos, etc. automatically (or interactively by browsing the repository with your frontend) as well?

 

One important aspect (imho) is to reduce the manual work everyone has to do before playing a table to his liking and avoiding to touch the table(file) itself to do so. Example: the camera setting / viewpoint. Why should i be forced to adjust that for each table separately? What if i wanted to switch viewpoint while playing? Having typically 2-3 favorite viewing presets? Think of Pinball FX2/3. As a player, I just want to toggle through my viewpoint presets with a function key or my cab buttons. And they have to be separate from the tables and work across all tables (at least for the majority of tables).

 

Next could be the lighting settings. In VPX, some tables bring a handful of lighting presets & options. Other tables don't. This could be handled centrally in VPE. (Maybe the principles of Unity dictate that change anyway...)

And lastly - while i'm at it - the options (config dialogs) and hotkeys which currently every table offers in a different way. I would like - when i'm allowed to ask for it - to see that unified too. We should have one known way how to access & show options a table might offer.

 

Everyone involved in the project: You're doing great work. VPE will rock! I'm confident and can hardly wait! 

Edited by KRouge
Link to comment
Share on other sites

@scottacus  excellent👍

I had installed the mpf, but as I had no use for it and no knowledge of how it works (I have all uninstalled python and mpf).
because my priority objective (more than all) is light animation.
C # is already a hassle for me, so if we add the python layer in addition, my brain will smoke.
but as mpf manages magnificent attract light, i will look into it later.
for now I'm doing the traditional way (script drag and drop),

Link to comment
Share on other sites

@KRougeI think you've misunderstood the point about the repositories. There's never going to be a single repo with all tables that you can just pull from. The VCS-friendly format is the authoring format, not the format in which tables are shared between players. So I'm sorry but you'll still going to have to go visit the release threads or individual repos if you want to stay up to date.

 

@scottacusDon't spend too much time on lighting yet. We barely have a physical setup that works well, let alone all the logic part worked out. Flashers aren't even imported yet.

Link to comment
Share on other sites

I love how all the big brains are combining to form one huge superbrain :D

 

Having this on Github as a community driven project, can only mean great things and when all the other big brains catch wind... the brain will grow even larger.

 

Also how is the Multithreading going to be handled? as with all the multicore cpu's coming out now(or the last 15 years) does unity handle all that out of the box? More cores = better performance? or 1 core mainly?

 

Been watching with interest for ages now :D

 

Edited by pitty
Link to comment
Share on other sites

Well, rendering and audio have their own thread in Unity. But when it comes to code in general, there is no such thing as "out of the box" handling of multi core programming. Unity has awesome support for multithreading, but you have to structure your code and logic in a way it's actually possible to run on multiple cores. And the way the physics simulation works, it's actually quite hard to do. We might be able process ball collisions for multiple balls in parallel, but otherwise it's not trivial. Additionally, scheduling code on another core is not for free, so if you're doing it 1000 times per second it can become a bottleneck as well.

 

So there are a few things we can do, but don't expect miracles.

Link to comment
Share on other sites

@scottacus

rainbow effect but manual 

would need the c # script, to apply it on the lights (auto)

 

rainbow c#:

 

public static Color Rainbow(float progress)
{
    float div = (Math.Abs(progress % 1) * 6);
    int ascending = (int) ((div % 1) * 255);
    int descending = 255 - ascending;

    switch ((int) div)
    {
        case 0:
            return Color.FromArgb(255, 255, ascending, 0);
        case 1:
            return Color.FromArgb(255, descending, 255, 0);
        case 2:
            return Color.FromArgb(255, 0, 255, ascending);
        case 3:
            return Color.FromArgb(255, 0, descending, 255);
        case 4:
            return Color.FromArgb(255, ascending, 0, 255);
        default: // case 5:
            return Color.FromArgb(255, 255, 0, descending);
    }
}

 

 

Edited by fastdraw
Link to comment
Share on other sites

@freezy I totally got that you were talking about the authoring side in your original post. With my response, I just wanted to create a complementing vision how beneficial it would be to have a central repository for the finished tables as well. I'm not asking anyone to create that respository right now for my personal convenience. I tried to spark an idea here. The term binary artifactory (Nexus and alike) would have been more appropriate, but it's not so well known generally.

Why shouldn't a central respository for tables + additional assets be possible? After all, vpforums.org / vpuniverse.com are 'repositories' as well (with additional commenting, which is nice), except that we don't use an API to pull but do by hand. And since these are only two - they are pretty 'central', don't you think? It's all just based on the agreement what to use by the community & the creators.

Imho we intend to be state-of-the-art on the authoring side (which is a fantastic thing), but fall back into Internet history 15 years ago when it comes to distributing & accessing the binary results. You could - if you will - say it also with a sharper tongue: We are totally misusing the forums to host large files releases because there is nothing better available (easily) as of now. But again: i was about a vision, right?

 

Edited by KRouge
Link to comment
Share on other sites

I did that with vpdb.io a few years ago. Fully API driven, structured data, plus a nice UI. But it's hard to convince authors to publish to a site outside of their actual community. It's cool tech, but tech is only half of the picture. You also need people, the community, and the community is here at the forums, which are primarily made for that. Of course nothing would prevent someone to do both, and afaik Dazz is looking for a coder, but it will take time and unfortunately I can't clone myself. ;)

Link to comment
Share on other sites

Never heard of vpdb.io - but it makes a great first impression! Looks like a viable solution and it's completely in your hand!! What do we want more!?! :):)

 

Quote

But it's hard to convince authors to publish to a site outside of their actual community

 

You have to make it very easy for the authors to follow this path. I.e. make it a natural part of the build process / workflow (At least for VPE). Add vpdb.io support into the VPE Unity editor and let the table creators choose how to use it with a few simple clicks.

 

[o] Publish to vpdb.io
    Please choose vpdb.io section
    [o] Alpha (restricted)
        U: [____________]
        P: [____________]
    [ ] Beta (public)
    [ ] Release (public)

 

Also, either the frontend authors have to support vpdb.io as well or there needs to be support in the VPE Player in order to pull (or sync) the local tables in an installation with vpdb.io. Both would be possible.

Ultimately, you could even be able to navigate through all tables with your frontend before even pulling them locally. This would only be necessary when deciding to 'play' a table the first time. (This might be a strech goal)

 

Simpler approach would be that your frontend has an administrative section where you can decide which tables (alpha/beta/release/...) to sync locally and then afterwars browse you local tables in a classic way.

Edited by KRouge
Link to comment
Share on other sites

The more I look into vpdb.io the more excited i get. It looks perfect to me - not only in the context which we're talking about - but perfect by itself! The 3D preview is GREAT!!

 

I just changed my mind: Forget about the idea of browsing tables with your pinball frontend upfront and deciding which ones to sync/pull from there. Instead we could use the web part of vpdb.io like it's intended - check out tables, look for ratings, etc. But add a functionality to 'mark' tables (or whole sections/tags like 'beta' or author 'xyz') on a personalized basis. ~add another button besides 'download' named 'sync'.

A pinball frontend with vpdb.io support (or a simple, yet to be written client app) would sync all marked tables next time it's started (using the users credentials).

This way, the amount of code needed to be added to the pinball frontend remains low (compared to full browsing capabilties).

The amount of code needed in the VPE editor to allow an automated upload to vpdb.io seems to be not much to me as well (imho).

Link to comment
Share on other sites

On 7/11/2021 at 12:55 PM, freezy said:

Again, you're missing the part where the community platform is not the same as the download platform.

You're right. I did not pay attention to that since i'm not familiar enough with the preferences of the community and the will to change.

Now how do we solve this? Do we need to solve this right from the start anyway?

Vpdb.io support as i sketched it out seems to be such a great addition, i would just risk to try it out and see if it grows over time. (But that's just my opinion)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...