You'll wish you had sooner or later
I’d love to learn, but……You'll wish you had sooner or later
It would have taken longer to set it up and yes you would have a number of classes. But it would be easier to maintain not harder. Thats the point of OO. makes that easier.I’d love to learn, but……
as far as i can see if you adopted the OO approach to this, I’d have tons of functions and classes and structures and it would have taken a month of sundays to get it all designed and coded up, and it would be hard to maintain???
i did actually start creating an oo version of it - but I got sidetracked. (i also havent got the hardware - thats a lot of breadboard wiring. Although I could of course set it up with a couple of switches, lamps and virtual solenoids - be easy to expand I guess). Id be happy to share what I have - but its currently incomplete.i am prepared to be proved wrong, I want to be proven wrong and I want to learn- someone is welcome to take my code and redo it in an OO way (once i’ve finished).
It will be interesting to see how easy i find my code to maintain; and also, how easy it is to adapt to a second game. (i have another populated playfield in waiting!!!)
If the OO was done correctly you would in theory be able to change the rules without touching the underlying code for the most part.Tomorrow i’ve got a ton of game rules testing to do, then some light shows to code in, plus i am now going to add in a config file that holds game settings, high scores, etc. i’ve also got to wire in the two lamps in the 2 pop bumpers (i can’t get an addressable led in there - bit would like to!) ……
I'd be up for that on the electronics and programming side, a bit short on space to have a spare cab and playfield. I suppose the way to accelerate this is to have a virtual interface to test the logic on, or at least a gui to be able to hook up to in the code.Cool - maybe when I've got the game going, I can share the code and also the hardware - the board I have built is pretty simple, it has an ESP32s processor and then some input and some output shift registers (and some resistors), that's all you
need to code a game, but would be handy to mock up the switch matrix, add some addressable leds to mimic the playfield leds and also add some ordinary leds to the outputs instead of solenoids. (I was going to add leds to the outputs on the board, but then I didnt because the MOSFET driver boards have a led on them anyway, but actually it would be handy to have a led on each output, for developing, testing, debugging the board itself.
you mean one of these:I was tempted to ask if you wanted to part with one of your CPU boards so I could dabble. But then I would feel compelled to poke at it more. So many irons in the fire.
I still haven't finished fiddling with the mod I was planning for my Cosmic Gunfight - though I did get it working sorta. I was going to look on the internets to see if there's an off the shelf PCB that will let me multiplex teh outputs lamps rather than creating a circuit board myself. (I have no knowledge of this - im sure I could learn, but theres that irons in the fire thing again )
I had envisaged some kind of json file to dictate the game rules with my OO systemOk so i’ve got as far as getting a game going, it plays and all the rules are in there, Ive tested them all and all debugged and working, got end of ball bonus routine going too. Got the score displays working and showing scores with commas in eg "1,234,560" not 1234560. Couldn't find an easy way to do this so created a function to do it.
Currently left on my Software to-do list:
- Hook up the pop bumper lights to 5v – test they work. (not s/w but needs doing before I forget)
- Sound - find a hardware solution, get sound samples, program in the sounds to the game, test
- Lighting animations - attract mode and in-game
- Add read and write to a json config file to hold game settings, balls per game, score thresholds for extra ball/replay, easy and hard game settings, eg. when does extra ball light and when do specials light, etc HSTD, HSTD names, scores etc.
- Setup mode – to configure the above, clear HSTD etc.
- Attract mode to show more than 1 HSTD
- doGameOver() – If HSTD beaten, allow entry of player(s) names.
Not bad, thats amazing!The costs for the electronics so far is not bad:
Controller PCB (5 made) £6.65
ESP32s chip £2.91
595 and 165 chips £3.00
Pin headers, dil and in line sockets, etc £2.00
Chunky Transformer - ebay £11.00
Bridge rectifier £0.50
5v Regulator £1.50
Terminal connector & jumpers £2.30
Line EMF filter £5.00
Mains cable and plug - free off old device £0.00
6 X Max7219 8 X 32 dot matrix displays £23.95
RTC clock module £1.45
4 X 4-way irf540 Mosfet power driver boards £16.00
5v 10A PSU £9.41
SD card and sound board £7.00
ws2812B Led Strings £18.36
TOTAL £111.03
Not bad for a pinball controller with lights, sounds, solenoid control and score displays.
I do love these pre-built modules that can be picked up from China... Small power converters, Amps, Players. Certainly take the pain out ot cobbling something together!had another go with the sound card and a faster micro sd card. these boards are amazing:
View attachment 150602
it’s tiny as you can see compared to my thumb. it’s got a built in 5w amp which is pretty good. i’ll post a video in a bit.
I’ve got sound in the game now. the hard bit is choosing suitable sounds.
it’s mono and only single file play at once. i could use two of them to get a background track as well as other sounds. but in this project, i’m just doing one sound at a time.Does that little sound card support multiple channels? or just one track at a time? Will you want a background track + samples on top etc...
yep possibly although they’re really two back boxes. i’m still deliberating……..There might be a use here for the less-favoured M&M Pac-man/Eight ball Deluxe LE/Centaur II type backbox