The NEW Build Your Own Arcade Controls

Software Support => GroovyMAME => Topic started by: yo1dog on July 07, 2019, 04:20:18 am

Title: Arcade Genius - Automated Compatability Tester
Post by: yo1dog on July 07, 2019, 04:20:18 am

(http://forum.arcadecontrols.com/index.php?action=dlattach;topic=159740.0;attach=378455;image)

arcadegenius.yo1.dog
 (https://arcadegenius.yo1.dog/?state=%7B%22monitorConfiguratorGroupItemIds%22%3A%5B%22d38d61be-bd06-42e4-9a82-11d257f8518b%22%5D%2C%22monitorConfiguratorModelineConfig-d38d61be-bd06-42e4-9a82-11d257f8518b%22%3A%7B%22preset%22%3A%22generic_15%22%2C%22orientation%22%3A%22horizontal%22%2C%22ranges%22%3A%5B%5D%2C%22allowInterlaced%22%3Afalse%2C%22allowDoublescan%22%3Atrue%7D%2C%22controlPanelConfigurator-__single%22%3A%7B%22buttonClusters%22%3A%5B%7B%22id%22%3A%2251e9d33c-3494-42a7-96f1-b8ee58ea613c%22%2C%22name%22%3A%22Red+Buttons%22%2C%22numButtons%22%3A3%2C%22isOnOppositeScreenSide%22%3Afalse%7D%2C%7B%22id%22%3A%22a6e1e83e-5fb0-4e93-bcb5-2e787022cdce%22%2C%22name%22%3A%22Blue+Buttons%22%2C%22numButtons%22%3A3%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22sControlSets%22%3A%5B%7B%22sControls%22%3A%5B%7B%22name%22%3A%22Red+Joystick%22%2C%22type%22%3A%22joy-8way%22%2C%22numButtons%22%3A0%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22buttonClusterId%22%3A%2251e9d33c-3494-42a7-96f1-b8ee58ea613c%22%7D%2C%7B%22sControls%22%3A%5B%7B%22name%22%3A%22Blue+Joystick%22%2C%22type%22%3A%22joy-8way%22%2C%22numButtons%22%3A0%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22buttonClusterId%22%3A%22a6e1e83e-5fb0-4e93-bcb5-2e787022cdce%22%7D%5D%7D%2C%22machineNameListInput%22%3A%22mslug%5Cnelevator%5Cnmissile%5Cnpacman%5Cnsimpsons%22%7D)

Warning: This tool is still in Alpha stage.

For a while I have had the idea for a tool to help people quickly figure out which games would be supported at what level on various configurations of MAME cabinets. This includes both controls and video.

Ideally the tool would be able to answer these kinds of questions:

It would tell you that Metal Slug would play great, Elevator Action would be playable but suffer from the lack of a 4 way joystick, Missile Command would be unplayable due to the lack of a trackball, and Pacman would look terrible due to it being a vertical game on a horizontal 15khz CRT (and would also suffer from the lack of a 4 way joystick).

Of course, there are a lot of opinions and words like "playable", "looks terrible", etc. are very subjective. My idea was for the tool to point out potential issues and start with a default set of "opinions" of how important each of those issues are. But, those opinions would be editable by the user. For example, the user could change the opinions such that even if fractional scaling of the video would be required, the video looks "good" not "bad". Or that an 8-way joystick is a "good" not "bad" control for 4-way games.

Video Compatibility
I tackled what I thought would be the hardest part of this first: how to determine video compatibility. I realized this problem was already solved by people like Calamity and the GroovyMAME project. You give GroovyMAME your monitor specs and a ROM name and it determines the best modeline that can be used. It even tells you what types of compromises had to be made (fractional scaling, uneven stretching, interlacing, doublescan, etc.). So, I ripped the SwitchRes/modeline C++ code right out of GroovyMAME and compiled it to run in WebAssembly in a browser. Using the exact same code as GroovyMAME ensures the tool returns the exact same results as if you were testing it on an actual setup running GroovyMAME theoretically******

******A bunch of asterisks here because 1. C++ is defiantly not my strong suit so it's possible I messed up something when porting the code and 2. I won't pretend like I understand enough to know if I am accounting for all variables involved.

Controls Compatibility
The next step is controls. The plan is to leverage the controls.dat project - specifically my controls.json project (http://forum.arcadecontrols.com/index.php/topic,150639.0.html). The hope is this will help people determine what controls they really need on their control panel. When they see that only 2 games on their list of 50 favorite games requires a spinner, they may decide not to include one. Or that the 5th and 6th buttons for player 3 and 4 are used by 0 games and can be removed. It could get really intense with a control panel builder/layout tool that encourages/enforces best practices like button layout, control spacing, player spacing, viewing angle, etc. That may be a little too ambitious.

Future
In the future I can see the tool helping with other aspects of MAME cabinet setups - especially the parts that can be difficult for newbies. For example, it could help you pick your graphics card, OS, etc. for best compatibility with CRT Emudriver. Explain your options for lightguns depending on your setup. Etc. General advice can become much more concise and specific when you know the details of the person's setup.

Known Bugs
Title: Re: MAME Genius - Automated Compatability Tester
Post by: Arroyo on July 07, 2019, 09:01:06 am
Brilliant!  This is a fantastic idea.

Don’t know if the data in mame includes original physical screen size (19” vs 25”, etc.) but if so can input in the first feature request? 

Nice work!
Title: Re: MAME Genius - Automated Compatability Tester
Post by: Mike A on July 07, 2019, 09:54:49 am
This would be awesome. If a piece of software told someone their idea sucked then I would be off the hook.
Title: Re: MAME Genius - Automated Compatability Tester
Post by: yo1dog on July 15, 2019, 02:27:55 pm
Added support for checking compatibility with controls. The UI for both configuring and displaying the results is still very primitive, but all the data is now there. Referring back to the example question proposed in the original post:

Ideally the tool would be able to answer these kinds of questions:
  • If I build a cabinet with 2x 8-way joysticks, 6 buttons each, and a horizontal NTSC CRT TV, which of my favorite games will be supported by this setup?
  • What if I used a 31kHz PC monitor instead?
  • Do I really need a spinner?

It would tell you that Metal Slug would play great, Elevator Action would be playable but suffer from the lack of a 4 way joystick, Missile Command would be unplayable due to the lack of a trackball, and Pacman would look terrible due to it being a vertical game on a horizontal 15khz CRT (and would also suffer from the lack of a 4 way joystick).

The tool is now at a state where this can be done. Here is a link to an example configuration showing just that:

Example (https://yo1.dog/mameGenius/?state=%7B%22monitorConfiguratorGroupItemIds%22%3A%5B%22d38d61be-bd06-42e4-9a82-11d257f8518b%22%5D%2C%22monitorConfiguratorModelineConfig-d38d61be-bd06-42e4-9a82-11d257f8518b%22%3A%7B%22preset%22%3A%22generic_15%22%2C%22orientation%22%3A%22horizontal%22%2C%22ranges%22%3A%5B%5D%2C%22allowInterlaced%22%3Afalse%2C%22allowDoublescan%22%3Atrue%7D%2C%22controlPanelConfigurator-__single%22%3A%7B%22buttonClusters%22%3A%5B%7B%22id%22%3A%2251e9d33c-3494-42a7-96f1-b8ee58ea613c%22%2C%22name%22%3A%22Buttons+1%22%2C%22numButtons%22%3A6%7D%2C%7B%22id%22%3A%22a6e1e83e-5fb0-4e93-bcb5-2e787022cdce%22%2C%22name%22%3A%22Buttons+2%22%2C%22numButtons%22%3A6%7D%5D%2C%22sControlSets%22%3A%5B%7B%22id%22%3A%22aa0a4954-899a-45da-b7d7-a9a9b02e750b%22%2C%22name%22%3A%228-way+Joystick+1%22%2C%22sControls%22%3A%5B%7B%22type%22%3A%22joy-8way%22%2C%22numButtons%22%3A0%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22buttonClusterId%22%3A%2251e9d33c-3494-42a7-96f1-b8ee58ea613c%22%7D%2C%7B%22id%22%3A%22304616b0-2340-4da8-89e9-66b9e552f6d0%22%2C%22name%22%3A%228-way+Joystick+2%22%2C%22sControls%22%3A%5B%7B%22type%22%3A%22joy-8way%22%2C%22numButtons%22%3A0%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22buttonClusterId%22%3A%22a6e1e83e-5fb0-4e93-bcb5-2e787022cdce%22%7D%5D%7D%2C%22machineNameListInput%22%3A%22mslug%5Cnelevator%5Cnmissile%5Cnpacman%22%7D)

And a screenshot of the results:
(http://forum.arcadecontrols.com/index.php?action=dlattach;topic=159740.0;attach=378093;image)

Again, the UI is very simple and does not explicitly list the compatibility issues. However, if you look at the JSON in the details, you can see all the data needed to power that UI exists. Next step is to build it.

Title: Re: MAME Genius - Automated Compatability Tester
Post by: Calamity on July 15, 2019, 02:36:17 pm
Hi yo1dog,

For some reason the "arcade_15ex" preset still doesn't work (you're probably aware of this since you mentioned about issues with some presets).

I'd love to get the classic modeline format in addition to the split format you get now.
Title: Re: MAME Genius - Automated Compatability Tester
Post by: yo1dog on July 15, 2019, 02:43:22 pm
Hi yo1dog,

For some reason the "arcade_15ex" preset still doesn't work (you're probably aware of this since you mentioned about issues with some presets).

I'd love to get the classic modeline format in addition to the split format you get now.

Yea I still need to look into that bug. I've been focusing on other more fun stuff for now. I'll throw in the classic modeline format as well.
Title: Re: MAME Genius - Automated Compatability Tester
Post by: Arroyo on July 15, 2019, 03:14:58 pm
Nice work.
Title: Re: MAME Genius - Automated Compatability Tester
Post by: Substring on July 16, 2019, 05:36:51 pm
Awesome tool, keep up the good work!
Title: Re: MAME Genius - Automated Compatability Tester
Post by: yo1dog on July 17, 2019, 08:37:13 pm
I've got a bunch of work done on the UI. You can now see the compatibility results in a friendly UI. It tells you why your monitor won't work and what controls are missing or are being substituted.

I also threw in some things like a JSON tree view for exploring the raw data.

Check it out: Example Link. (https://yo1.dog/mameGenius/?state=%7B%22monitorConfiguratorGroupItemIds%22%3A%5B%22d38d61be-bd06-42e4-9a82-11d257f8518b%22%5D%2C%22monitorConfiguratorModelineConfig-d38d61be-bd06-42e4-9a82-11d257f8518b%22%3A%7B%22preset%22%3A%22generic_15%22%2C%22orientation%22%3A%22horizontal%22%2C%22ranges%22%3A%5B%5D%2C%22allowInterlaced%22%3Afalse%2C%22allowDoublescan%22%3Atrue%7D%2C%22controlPanelConfigurator-__single%22%3A%7B%22buttonClusters%22%3A%5B%7B%22id%22%3A%2251e9d33c-3494-42a7-96f1-b8ee58ea613c%22%2C%22name%22%3A%22Red+Buttons%22%2C%22numButtons%22%3A3%2C%22isOnOppositeScreenSide%22%3Afalse%7D%2C%7B%22id%22%3A%22a6e1e83e-5fb0-4e93-bcb5-2e787022cdce%22%2C%22name%22%3A%22Blue+Buttons%22%2C%22numButtons%22%3A3%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22sControlSets%22%3A%5B%7B%22sControls%22%3A%5B%7B%22name%22%3A%22Red+Joystick%22%2C%22type%22%3A%22joy-8way%22%2C%22numButtons%22%3A0%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22buttonClusterId%22%3A%2251e9d33c-3494-42a7-96f1-b8ee58ea613c%22%7D%2C%7B%22sControls%22%3A%5B%7B%22name%22%3A%22Blue+Joystick%22%2C%22type%22%3A%22joy-8way%22%2C%22numButtons%22%3A0%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22buttonClusterId%22%3A%22a6e1e83e-5fb0-4e93-bcb5-2e787022cdce%22%7D%5D%7D%2C%22machineNameListInput%22%3A%22mslug%5Cnelevator%5Cnmissile%5Cnpacman%5Cnsimpsons%22%7D)



(http://forum.arcadecontrols.com/index.php?action=dlattach;topic=159740.0;attach=378130;image)
Title: Re: MAME Genius - Automated Compatability Tester
Post by: yo1dog on July 20, 2019, 07:29:45 pm
Some more UI updates. I also made the large resources load async/dynamically as needed so initial loading is much faster. No reason for the main UI to wait on the large JSON files to load when they are not needed until a compatibility check.

A lot of unseen changes around control compatibility checking. Before it was simply allocating the best CP control in order of the game controls. Now it uses rounds of  optimization to ensure the best compatibility outcome. Lots of other unseen framework changes as I learn webpack (this is my first project with it).

Also a spiffy new logo.

Check it out: Example Link. (https://yo1.dog/mameGenius/?state=%7B%22monitorConfiguratorGroupItemIds%22%3A%5B%22d38d61be-bd06-42e4-9a82-11d257f8518b%22%5D%2C%22monitorConfiguratorModelineConfig-d38d61be-bd06-42e4-9a82-11d257f8518b%22%3A%7B%22preset%22%3A%22generic_15%22%2C%22orientation%22%3A%22horizontal%22%2C%22ranges%22%3A%5B%5D%2C%22allowInterlaced%22%3Afalse%2C%22allowDoublescan%22%3Atrue%7D%2C%22controlPanelConfigurator-__single%22%3A%7B%22buttonClusters%22%3A%5B%7B%22id%22%3A%2251e9d33c-3494-42a7-96f1-b8ee58ea613c%22%2C%22name%22%3A%22Red+Buttons%22%2C%22numButtons%22%3A3%2C%22isOnOppositeScreenSide%22%3Afalse%7D%2C%7B%22id%22%3A%22a6e1e83e-5fb0-4e93-bcb5-2e787022cdce%22%2C%22name%22%3A%22Blue+Buttons%22%2C%22numButtons%22%3A3%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22sControlSets%22%3A%5B%7B%22sControls%22%3A%5B%7B%22name%22%3A%22Red+Joystick%22%2C%22type%22%3A%22joy-8way%22%2C%22numButtons%22%3A0%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22buttonClusterId%22%3A%2251e9d33c-3494-42a7-96f1-b8ee58ea613c%22%7D%2C%7B%22sControls%22%3A%5B%7B%22name%22%3A%22Blue+Joystick%22%2C%22type%22%3A%22joy-8way%22%2C%22numButtons%22%3A0%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22buttonClusterId%22%3A%22a6e1e83e-5fb0-4e93-bcb5-2e787022cdce%22%7D%5D%7D%2C%22machineNameListInput%22%3A%22mslug%5Cnelevator%5Cnmissile%5Cnpacman%5Cnsimpsons%22%7D)
Title: Re: MAME Genius - Automated Compatability Tester
Post by: yo1dog on July 21, 2019, 05:44:17 pm
For some reason the "arcade_15ex" preset still doesn't work (you're probably aware of this since you mentioned about issues with some presets).

I'd love to get the classic modeline format in addition to the split format you get now.

Fixed the bug with some of the presets not working. I also added the classic modeline format to the data output (just for you Calamity ;))

Check it out: Example Link. (https://yo1.dog/mameGenius/?state=%7B%22monitorConfiguratorGroupItemIds%22%3A%5B%22d38d61be-bd06-42e4-9a82-11d257f8518b%22%5D%2C%22monitorConfiguratorModelineConfig-d38d61be-bd06-42e4-9a82-11d257f8518b%22%3A%7B%22preset%22%3A%22generic_15%22%2C%22orientation%22%3A%22horizontal%22%2C%22ranges%22%3A%5B%5D%2C%22allowInterlaced%22%3Afalse%2C%22allowDoublescan%22%3Atrue%7D%2C%22controlPanelConfigurator-__single%22%3A%7B%22buttonClusters%22%3A%5B%7B%22id%22%3A%2251e9d33c-3494-42a7-96f1-b8ee58ea613c%22%2C%22name%22%3A%22Red+Buttons%22%2C%22numButtons%22%3A3%2C%22isOnOppositeScreenSide%22%3Afalse%7D%2C%7B%22id%22%3A%22a6e1e83e-5fb0-4e93-bcb5-2e787022cdce%22%2C%22name%22%3A%22Blue+Buttons%22%2C%22numButtons%22%3A3%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22sControlSets%22%3A%5B%7B%22sControls%22%3A%5B%7B%22name%22%3A%22Red+Joystick%22%2C%22type%22%3A%22joy-8way%22%2C%22numButtons%22%3A0%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22buttonClusterId%22%3A%2251e9d33c-3494-42a7-96f1-b8ee58ea613c%22%7D%2C%7B%22sControls%22%3A%5B%7B%22name%22%3A%22Blue+Joystick%22%2C%22type%22%3A%22joy-8way%22%2C%22numButtons%22%3A0%2C%22isOnOppositeScreenSide%22%3Afalse%7D%5D%2C%22buttonClusterId%22%3A%22a6e1e83e-5fb0-4e93-bcb5-2e787022cdce%22%7D%5D%7D%2C%22machineNameListInput%22%3A%22mslug%5Cnelevator%5Cnmissile%5Cnpacman%5Cnsimpsons%22%7D)

(http://forum.arcadecontrols.com/index.php?action=dlattach;topic=159740.0;attach=378192;image)
Title: Re: MAME Genius - Automated Compatability Tester
Post by: Arroyo on July 21, 2019, 08:49:57 pm
Nice job, keep it up!
Title: Re: MAME Genius - Automated Compatability Tester
Post by: yo1dog on August 06, 2019, 05:07:39 pm

(http://forum.arcadecontrols.com/index.php?action=dlattach;topic=159740.0;attach=378451;image)

A lot more unseen changes have taken place.

I believe the added strictness of TypeScript will make the project easier to manage. Plus when used with IDEs such as VSCode you get full IntelliSense code-completion which makes development easier and faster. And because it's a superset, anyone familiar with JavaScript should be able to jump into the code without issue.

TypeScript has become quite popular (https://redmonk.com/sogrady/2018/08/10/language-rankings-6-18/) and I've been wanting to do a project with it. I have stuck with JavaScript it in the past to avoid the build step and source maps, but this project uses webpack which already requires those. If it doesn't work out, transitioning back to JavaScript is very easy.
Title: Re: MAME Genius - Automated Compatability Tester
Post by: krick on August 06, 2019, 05:29:29 pm
I believe the added strictness of TypeScript will make the project easier to manage. Plus when used with IDEs such as VSCode you get full IntelliSense code-completion which makes development easier and faster. And because it's a superset, anyone familiar with JavaScript should be able to jump into the code without issue.

TypeScript has become quite popular (https://redmonk.com/sogrady/2018/08/10/language-rankings-6-18/) and I've been wanting to do a project with it. I have stuck with JavaScript it in the past to avoid the build step and source maps, but this project uses webpack which already requires those. If it doesn't work out, transitioning back to JavaScript is very easy.

You're preaching to the choir.  JavaScript is the devil.  I don't know how any serious development work actually uses it.  It's a horrible, horrible language.  I know that JavaScript can never truly go away but I'd love to see TypeScript replace it as much as possible.
Title: Re: MAME Genius - Automated Compatability Tester
Post by: yo1dog on August 07, 2019, 11:59:41 am
This will sound like I am defending JavaScript, but really by only point is that it's a tool. It will be useful in some scenarios and detrimental in others. I guess I am defending it in that I disagree that it is an inherently horrible and useless language. Though, I defiantly understand if JavaScript's quirks turn you away. I have similar feelings about other languages.

We've used JavaScript as our primary backend language (Node.JS/Express stack) for years at my current job with success. Like any loosely typed language, there are defiantly foot guns everywhere. The two biggest ones I see are: putting no effort into interface design and trying to be too clever with type coercion. TypeScript helps by giving you more restrictions, but you can still shoot yourself in the foot using type assertions and "any". It's a superset of JavaScript so many of the same language/syntax issues still exist. But, once you learn the language and especially the pitfalls it can be very powerful tool for rapid development. We make heavy use of linters to catch anti-patterns and put safeties on those foot guns for the newer developers.

Not having to think about classes, inheritance, or complex interfaces (duck-typing) is certainly nice. Also, the language has gotten MUCH better since es6/es2017 and continues to make massive strides with rolling updates.
Title: Re: MAME Genius - Automated Compatability Tester
Post by: krick on August 07, 2019, 01:12:43 pm
This will sound like I am defending JavaScript, but really by only point is that it's a tool. It will be useful in some scenarios and detrimental in others. I guess I am defending it in that I disagree that it is an inherently horrible and useless language. Though, I defiantly understand if JavaScript's quirks turn you away. I have similar feelings about other languages.

I never said it's a useless language.  There's a lot it does right.  The main problem I have with JavaScript is that it wasn't designed and just sort of happened (see also PHP).  As a consequence, there's a lot of icky baggage that it carries forward in the name of backwards compatibility and this is the main source of bugs and performance issues (see also Microsoft Windows).  I feel that if they could jettison the bad parts of JavaScript and come out with a properly designed JavaScript 2.0, the world would be a much better place.   Since that can't happen, Using something like TypeScript on top of it is probably the best path forward.

I sincerely apologize for derailing your thread.  I can delete my comments if you want.
Title: Re: MAME Genius - Automated Compatability Tester
Post by: yo1dog on August 07, 2019, 03:52:07 pm
I agree completely. I almost used PHP as a comparison as well.

Not a derailment. This thread has been about the development of the tool which certainly encompasses discussions of the language it is built in. I appreciate the input.

I've been loving TypeScript. Before I had basically poor-man's TypeScript by using jsdocs to type annotate everything. That at least got me code completion but still no type checking. I then tried to use linters to implement type checking; it worked but the jsdoc syntax is awkward and heavy.
Title: Re: MAME Genius - Automated Compatability Tester
Post by: yo1dog on August 07, 2019, 03:59:36 pm
I just remembered another reason why I was avoiding TypeScript at first. The TypeScript server was slowwww. Code completion was slow and builds (initial and incremental) took forever. But then I figured out why (by accident, actually):

I was referencing giant ~8MB JSON files (MAME --list output and controls.dat) and TypeScript's automatic type acquisition was creating obscenely large types for them which was bogging everything down. I told TypeScript not to do that and it was lightning quick.
Title: Re: Arcade Genius - Automated Compatability Tester
Post by: yo1dog on August 07, 2019, 08:23:00 pm
Renamed the project to "Arcade Genius". New logos to go along with the new name.

PL1 pointed out that the MAME name and logo are trademarked. While I am sure it would have been fine given this is a free to use tool, I went ahead and changed all the branding. There's not much that is specific to MAME anyway.

(http://forum.arcadecontrols.com/index.php?action=dlattach;topic=159740.0;attach=378455;image)

(http://forum.arcadecontrols.com/index.php?action=dlattach;topic=159740.0;attach=378456;image)
Title: Re: Arcade Genius - Automated Compatability Tester
Post by: Substring on August 08, 2019, 01:49:26 am
One suggestion : it could be interesting to dpecify which mame version dat you're using, as well as which switchres version too. I guess the json part states mame version (0.172 ?), but there can be differences between 2 versions.

This brings an idea : maybe allowing people to choose their mame version could be a nice feature (but a hell for you to fibd and parse all of them, considering switchres also evolved over time). Not everyone is running 0.172, or the last cutting edge version.