Sunday, May 10, 2020

Holy optimizations, Batman!

Spent a "little" time optimizing the code base, along with actually trying to work out the kinks of why optimized mode doesn't work. I'm not all the way there yet, but the results so far are very nice! 

Note: The flickering apparent in both videos is mostly picked up by the camera only and isn't really noticeable IRL, and the refresh rate can be pushed up further. Just keeping it a bit "low" to avoid confusing myself while debugging the rest of the code in case it causes crashes/erratic behavior etc.
For instance - 
Here's a clip of SD-card videos running as fast as possible in the old code. 
Notice the slow motion (faked by frame-skipping previously, removed here). 




And here's the same clip after optimization. 
Compared to the old version, it's a lot smoother and I'm actually running the videos at 40fps here (faster than original 30). Notice the long blank space between the videos, where the old version barely finished rendering the first one when the second one was timed to start. :) 




Some crude counter increments:

Previous one-second count: 28402
New one-second count: 91857

Quite the improvement! 
Very satisfied with the results so far!

In case you didn't notice, I used two simultaneously running SD-animations (background & fx) during the second video. Works great and allows me to spice things up. #thumbsup 
And the cable mess have been mostly corrected now, all lights tested and working. :) 


5 comments:

  1. Hello, sorry for my English, I am using the Google translator.
    Just incredible the result! Congratulations on the work and the sharing. The design is simply sumptuous. It makes you want to create so much, but paradoxically it is terribly scary, especially electronics and programming ...
    I will have a few "simple", general questions. Do I dare here?

    ReplyDelete
    Replies
    1. Sure!
      Fire away and I'll try to answer a.s.a.p. :)

      Delete
    2. Ok thank you, all the projects I have seen on blogs use control boards to drive flipps, slingshots and bumpers. Do you think that it is possible to control these parts directly with 48v switch, without going through a board? Like the old pinball machines, I think.
      Regarding the installation of the playfield, why paint the wooden panel white?
      Is it possible to send me the movement in mm of the slingshot, off to on position, please.
      Finally, the best combo for you with the controlers? Arduino and... or not?
      I'm not going to go into a global construction, just test a few elements, for fun (I hope), for knowledge and to introduce my son to the technique.
      Thank you for your time and again congratulations on your wonderful result.

      Delete
    3. Yes, it is possible - but you lose control over the parts since they will always fire (even during maintenance etc).

      The board is painted white since the artwork I used does not have white in it (impossible to print white). So when placed onto a white background the image looks normal. :)

      Not sure what the movement in mm is, but if you are serious about building I would suggesting buying a few parts to get the measurements correct.

      I use only a Chipkit MAX32-board to control everything these days. Works like a charm and plenty of horsepower to power everything. That said - the audio board is an external board called WavTrigger.

      Hope it helps and thanks for checking in! :)

      Delete
    4. Thank you very much for your feedback. For the slingshot I was simply thinking of moving the rubber, on the playfield. Maybe 15 mm ...
      I hope I can also give you feedback on my tests. A +

      Delete