Search Unity

shaderbytes pinball megathread

Discussion in 'Made With Unity' started by shaderbytes, Jan 26, 2018.

  1. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    896
    Hi all

    Let be honest this is a niche genre of gaming but that doesnt take away any of the technicalities in producing such a heavy physics related game.

    So the aim of this thread is for any pinball developers and also future developers who want to make a pinball game coming and posting questions and solutions in one place so hopefully it will be the one place to look to for any mechanics related to this genre that requires building in unity.

    I have extensive knowledge in this field and have built 5 fully working tables for many years and versions of unity.. Im posting 4 of them here now as examples/proof of my experience, I am willing to help where i can but help does not end at me it is open to anyone to post replies should they feel fit, this is a public forum after all.

    I decided to update every table to Unity 2018 and i am using Post Process v2, the data is stored and retrieved to a local database via SQLite, most all UI is using the built in Unity UI

    pinball fishtales
    https://drive.google.com/open?id=1fUFF4hTIBqbYJkHdCY9SDpOi8QMtcN-z

    pinball jurassicpark
    https://drive.google.com/open?id=1lQviDbw-Ef-uKNTdnlaTTYztSY_pG94z

    tommy pinball
    https://drive.google.com/open?id=1LX16kgzZOi8T0KjxVlI-CTX5k277WF3J

    pinball elvis
    https://drive.google.com/open?id=1ouzV2sqQPBtACVLWjdZjcvBlhyuGZyn_

    You need a gaming pc to run these games , windows only. I have a gtx 970 which was the most popular card 2 years back, I have not tested on lighter/older cards but i doubt it will run properly as i am using deferred rendering and many poly and post process. Run of the mill stuff for a gaming pc to run.



    Cheers
    fishtales.jpg
    jurassicpark.jpg
    tommy.jpg
    elvis.jpg
     
  2. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    3,231
    I watched the video, it looks really good!

    You're providing the final game, not the Unity project(s), right? It would be interesting to look at the Unity project to find out how such pinball game is put together, less interesting if it's an .exe only.

    I'm not saying you have to provide the source, you most likely have good reasons not to do that, but it would definitely catch more attention from developers then. There is little to learn from just the .exe file.
     
  3. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    896
    i understand but as you mentioned i wont be giving away the project files but i am happy to help out anyone in this field and I will explain how i did something specific should the need arise. Recently (last year ) I built my own 2d spline,radius corner tool in unity to help create some of the geometry. I would normally export that and tweak in blender and then bring it into the relevant pinball project.
     
  4. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    896
    ss.jpg

    Here is an example of my flippers for example. I built some tech in my path tools to build them for me and create place the colliders.( you can set the front and back radius and it finds the common tangent in code) I used to only have one collider originally, now i use two. Both are primitive capsule colliders, so i can use continuous dynamic on them. ( you cant use this setting on non primitive colliders ) Also look at the game object set up , the colliders and the mesh have their own gameobject. This makes it possible to replace the mesh as you see fit without losing the flipper/mesh/collider setup. if you create flippers have a generic housing game object, attach your component behaviour onto that. let you mesh and your colliders be children of that housing game object
     
    Last edited: Jan 27, 2018
  5. Danicano

    Danicano

    Joined:
    Mar 10, 2015
    Posts:
    18
    Sincerely, I think that your will to help us is awesome and I can’t never express enough gratitude.
    Now lets analysing everything and trying things!
    Thanks and thanks again!
     
    shaderbytes likes this.
  6. Danicano

    Danicano

    Joined:
    Mar 10, 2015
    Posts:
    18
    You said before that use DoTween to make interpolations. In case of the flippers, why do you use it? Maybe to slow down the flippers movement at the end in order to apply high forces and thus not breaking the joint???
    There's a lot of physics/maths to be learned in order to attain your programming level....
     
  7. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    896
    I do use tweens to simulate a motor force buildup and also to have two different forces at play. In real life a flipper has two solenoid forces , one for the main movement and one for the very last bit of movement and holding the flipper. This second force is much less voltage than the main movement, this allows players to also perform all sorts of flipper tricks. im not emulating this exactly but just approximating the behaviour by using tweened force values. You can even examine the interpolation graph of a solenoid , it is not linear at all, something like this.. 1-s2.0-S0924424716310056-gr17.jpg

    So I use two different tweens, one for the up motion and one the down motion , the one i use interpolation (easing) Ease.InExpo, the other i use Ease.OutExpo which would look similar to the graph above. Again not exact , the graph above is not exact either but it is the logic that matters , the shape would be similar to that.
     
  8. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    896
    It is funny you mention breaking the joint because why a flipper has two forces like this in real life is also to not break the flipper solenoids.The force value used to move the flippers very fast is very strong and requires a high voltage. If the flipper reached the end of of its rotation and the player just held the flipper buttons in and this force was not changed , the solenoids would burn out. So they have a leaf switch of sorts that triggers just as the flipper is getting to the end. This then triggers a low voltage to hold the flippers so it does not burn out. This mechanical reason of survival inherently gave the flipper play its characteristics and so people learned to do all sorts of flipper tricks knowing this end of rotation voltage and force is less.
     
  9. Danicano

    Danicano

    Joined:
    Mar 10, 2015
    Posts:
    18
    One question.
    Do you increase the time scale? Doing so the feel of the table is that of more speed, but in reality things move slowly (I think) thus avoiding fast speed rigidbodies problems... just curious.
     
    Last edited: May 8, 2018
  10. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    896
    no my gravity is increased on my tables. Table slope is about 6 degrees, gravity is about 120 i think. anyway gravity is increased only because of the size of my assets which are very big, so they would seem to move slowly with the regular gravity settings.
     
  11. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    896
    Another Sim im busy working on, the table is named Junkyard" :

    ss10.jpg


    Trying out the new HDRP of unity 2018.2. Still a WIP but you can see the current build in action here :

     
    Denisowator and eluukkanen like this.
  12. eluukkanen

    eluukkanen

    Joined:
    Oct 1, 2015
    Posts:
    17
    Lovely pinball machine! It was really nice to even watch from the video! Well done!
     
  13. Denisowator

    Denisowator

    Joined:
    Apr 22, 2014
    Posts:
    918
    The amount of photo-realism in this is mind blowing! I've been to quite a few arcades as a kid. And if you showed an image of this randomly with no context, I'd think it was real life.
     
    shaderbytes likes this.
  14. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    896
    Thanks @Denisowator , aside from the great work from the HDRP guys, Over the years I've learnt that saturation is the biggest pitfall to many graphics striving for photo realism , most are simply too saturated which is not how we see things in real life for the most part. My wood fence in the background for example is still a bit too saturated but the table materials are not ;) I still keep learning and adjusting these things everyday. Im still not happy with the flashers and am currently still adjusting things there to get a better look