News: 11 March 2016 - Forum Rules

Author Topic: Thoughts about writing a game from scratch for MAME?  (Read 1228 times)

JoeStrout

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Thoughts about writing a game from scratch for MAME?
« on: July 10, 2021, 10:02:50 am »
Hi all!  Newbie here.

I grew up doing (among other things) 6502 assembly language coding.  I've lately had a bit of an urge to get back into it again.  And I've also been playing around with MAME a lot recently, setting up a custom countertop machine.

So... I'm toying with the idea of picking some particular arcade hardware (almost certainly 6502-based), and trying to write a custom game.  A bit of googling indicates that this isn't generally done, in part because it's easy for such code to inadvertently take advantage of something that doesn't work on the real hardware, and then when the emulators are updated to be even more authentic, the custom ROM no longer works (and people blame the emulator writers).

I understand that problem, but I still can't stop thinking about it.

So, please share your thoughts!  Encouragement and discouragement are both appreciated, as are any jumping-off points or information on similar projects in the past.  And, if you were going to pick hardware for such a project, what would you choose?  I'd want something 6502-based and reasonably capable, but not too complicated.  And the more common (and well-understood) the hardware, the better.

Jorpho

  • Hero Member
  • *****
  • Posts: 4950
  • The cat screams with the voice of a man.
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #1 on: July 10, 2021, 08:16:55 pm »
I daresay this is rather fundamentally absurd.

Even if you wanted to torture yourself subject yourself to an exercise in writing a game in 6502 assembly, you would be much better off writing for a console or a computer with more extensive documentation and tools than some random arcade machine – especially since then there's a much better chance that people might play your game on real hardware.

MAME in general doesn't seem to be especially supportive of hacks and custom games anyway.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

FAST6191

  • Hero Member
  • *****
  • Posts: 3242
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #2 on: July 11, 2021, 08:42:35 am »
There are people still doing homebrew games for 6502 consoles -- super bat puncher for the NES being one of the more notable http://morphcat.de/superbatpuncher/ being one of the more notable. Functionally I see no difference in doing it for another piece of 6502 based hardware.

To expand on above. MAME stuff tends to revolve around accurate emulation of specific boards, and games are usually so few in number for a given board that they don't necessarily revolve around the games themselves but still seriously appreciate them. That also means most builds, especially modern ones, are geared towards running only hash matching versions of games they already know with no simple "ignore the hash, run it anyway" type option and any requests to such an end on the support forums being dismissed fairly... not harshly but most will not expect to see it next version, hence the rep of not being too friendly to hacks. If you are considering writing a game in 6502 for as yet unknown hardware then you can probably compile something that will have less functionality than baseline source code.
At the same time the MAME/MESS source code is generally regarded as some of the best hardware documentation we have for any consoles really, certainly I have no qualms at all about sending someone that way if they are interested in hacking some arcade games (again with the game appreciation many will often detail what banks contain what type of data for given games where on the NES or something most emulator forums will point you at https://datacrystal.romhacking.net/ , whatever community exists for that game/franchise or tell you to sort it yourself, though this is not unexpected -- between regions, v1.1 and so forth the otherwise failure that was the N64 squeaks in at just over 1000 ROMs these days https://datomatic.no-intro.org/index.php?page=download&s=64 where most arcade boards are less than 10 and even the crazy ones won't top 60).

PolishedTurd

  • Full Member
  • ***
  • Posts: 214
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #3 on: July 11, 2021, 08:34:02 pm »
It sounds like a brutal exercise, but if you can find or construct some adequate tools, I would love to see it. The arcade machines of the 70s-90s have a charm, look, sound and feel to them that no home console ever matched.

The NES is also 6502-based and dear to my heart. In particular, the VRC7 sound chip and powerful MMC5 mapper came late in its life cycle and were not explored to their potential. I would love to see someone flex these in any fashion, whether in a hack or homebrew game. You have an advantage working with the NES in terms of emulators, tools, available disassemblies and so on.

Jorpho

  • Hero Member
  • *****
  • Posts: 4950
  • The cat screams with the voice of a man.
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #4 on: July 12, 2021, 12:37:47 am »
The NES is also 6502-based and dear to my heart.
A lot of things are 6502-based: the Atari 8-bit machines, the Apple II, C64, and the Lynx, as per wiki.

ETA: Oh! And the PC-Engine/TG16, technically. And I'm sure I'm forgetting more.
« Last Edit: July 12, 2021, 02:45:03 pm by Jorpho »
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

JoeStrout

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #5 on: July 12, 2021, 01:28:55 pm »
Thanks all!  Yes, my own 6502 experience is from the Apple II, and I know it was an enormously popular chip used in a whole lot of machines.  But somehow I find myself drawn to trying to make a game for an arcade machine, rather than a home computer or console.  Perhaps it's because I've done computer/console games before (still do, in fact), and I'd like to do something different.  Or perhaps I admire the (usually solo) devs who cranked out those games back in the day.  And like @PolishedTurd says, there is a certain charm to those older arcade machines that I just don't feel on console and computer games (though they have their own kind of charm of course).

@FAST6191, you mentioned that some arcade boards have nearly 60 games.  That's quite a bit more than I expected!  Honestly I'd be happy with any board that has 10 games or more for it; that's plenty of sample code to learn from, and probably enough to ensure that the emulator isn't too tightly tuned to one specific game.

Is there a specific board you might recommend?  I'm still learning my way around this space and even finding out which games share a common board is proving tricky for me.

Jorpho

  • Hero Member
  • *****
  • Posts: 4950
  • The cat screams with the voice of a man.
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #6 on: July 12, 2021, 02:50:33 pm »
I guess it's nice for your own edification, but is there really any point in writing software for specific arcade hardware if practically no one is going to be able to use it?

Anyway, I quite like http://www.system16.com/ when it comes to arcade hardware. You can try https://www.google.com/search?q=site%3Asystem16.com+6502 , for instance.

Perhaps you could consider writing something for the Nintendo VS System? That's sort-of NES compatible.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

JoeStrout

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #7 on: July 12, 2021, 03:42:15 pm »
I know, it is a little pointless.  It'd probably be just a fun exercise — some people do crossword puzzles, I write software for obsolete hardware.  Equally valid ways to spend one's free time, I'd say.

On the other hand, if something cool and fun came out of it, maybe it could be added to the ROMs for Free Download list, which is pretty thin.

I've been looking at the ATARI 6502 COLOUR RASTER HARDWARE board.  Seems like about the era I was looking for, and has a decent selection of games for it.  (Though some of them are claimed to have 2 CPUs, while others have just one; are these really all the same board?)

FAST6191

  • Hero Member
  • *****
  • Posts: 3242
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #8 on: July 12, 2021, 03:50:58 pm »
Arcade stuff has never really been my thing, certainly nothing from the 6502 and similar eras (some dalliances with 16 bit era equivalents, a few older ones in a random camper van park by the seaside once and after that I would jump in when things went 3d if I was going to -- much rather hack silent scope or house of the dead than the older stuff there if I am going to get into arcades*), to want to make that kind of suggestion. Equally I am not sure of the value of code samples in this regard if you are still mostly going to be disassembling them (must admit I have not followed any arcade disassembly projects like I have for the various pokemon, mario, sonic, zelda and whatnot, the decompilation stuff, nor anything like the tool assisted speedrun stuff that also goes down similar paths. Pulling apart existing stuff is great for people learning ROM hacking but for learning coding I would far rather rock up with general programming understanding, general approaches used in assembly or at least a really low level compiled language like C, maybe some safe coding skills and sorts of things that round that out, or maybe I should just say decent embedded programming if we are talking about early chips possibly still in use. If I am recruiting someone as it were then someone that read https://docs.google.com/document/d/1iNSQIyNpVGHeak6isbP6AHdHD50gs8MNXF1GCf08efg/pub?embedded=true , the memory/hardware layout and the a CPU listing is probably more valuable than someone that knows a lot about a specific game they disassembled.

MAME/MESS themselves in the code there should detail what games a given board supports. Get a list of board names and wikipedia, as much as I hate linking it, is also not the worst for getting a list of games for things. https://en.wikipedia.org/wiki/CP_System_II https://en.wikipedia.org/wiki/CP_System https://en.wikipedia.org/wiki/Atari_System https://en.wikipedia.org/wiki/Konami_GX400 and so forth. Many MAME sets and dats to manage them (don't know if I would suggest the no-intro group I linked earlier for MAME dats as they are generally more of a console operation but they move in the same worlds as the dats most would use) will also note board differences and games that run on them.

*arcades were a thing around here, stuck around even after the death of arcades in the US and were around last time I was at the seaside (which was before stay in your home, citizen), however there was nothing really resembling an arcade culture here. From a hacker/programmer perspective today I would probably also not differentiate them that much from home consoles -- to me they are typically like a home console but with some more memory and storage to play with, some of which the home consoles with all the extra chips appearing throughout their life (or the later stuff still I normally find myself playing on, never mind general purpose PC of the modern world) might have even come close to equalling, and maybe with a few strategies in game design that rejoin us now known as microtransactions.

JoeStrout

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #9 on: July 12, 2021, 04:05:08 pm »
Oh goodness — I didn't mean to imply that I needed code samples to learn programming!  :)  I've been a professional programmer for 30 years.  The code samples are to help work out what the hardware does.  (I guess I would also be digging into the MAME source, since as you said that's probably the best documentation on this old hardware anyway.)

Just for fun, I did a little analysis of the monster list at https://www.system16.com/list.php, to see which systems are most common.  Here are the top 20, with counts:

  • SNK NeoGeo MVS: 241
  • Sega Naomi: 91
  • Sega STV (ST-V): 78
  • Sega Naomi GD-ROM: 73
  • CP System II (CPS2): 58
  • Atari Discrete Logic: 58
  • PGM: 58
  • Nintendo Vs.: 58
  • Nintendo Playchoice 10: 57
  • Sega Mega-Tech: 56
  • Konami Bemani System 573 Digital: 56
  • Data East DECO Cassette System: 54
  • Taito F3 System: 49
  • Sega Mechanical: 46
  • Sega Discrete Logic: 45
  • Seta 1st Generation: 45
  • Konami Scramble: 43
  • Namco System 246: 43
  • CPS: 40
  • Namco System 12: 39
  • Sega Medal: 35
  • Sammy Atomiswave: 34
  • Sega System 16B: 33
  • Sega Lindbergh Yellow: 31
  • Taito Licensed Games: 30
  • Sega Electromechanical Pinball: 30
  • Taito 8080 Based: 29
  • Namco System 10: 29
  • Namco System 1: 28
  • Konami Bemani PC: 28

The top 6502 system on this list is the Nintendo Vs (good call @Jorpho!).  The Data East DECO Cassette System is the only other one here in the top 20.


Jorpho

  • Hero Member
  • *****
  • Posts: 4950
  • The cat screams with the voice of a man.
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #10 on: July 12, 2021, 05:29:11 pm »
I should perhaps point out this lovely video from Retro Game Mechanics Explained regarding Atari's vector hardware, which is apparently 6502-based.
https://www.youtube.com/watch?v=smStEPSRKBs
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

FAST6191

  • Hero Member
  • *****
  • Posts: 3242
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #11 on: July 13, 2021, 04:09:48 pm »
That is what I thought, however I don't know any ROM hackers that have learned primarily or gleaned all that much by disassembling games, or that have that as a path when learning a new system. Most instead find hardware specs (be it official SDK or generate later), whatever homebrew writing guides have been made ( http://www.coranac.com/tonc/text/ is for the GBA but the sort of thing, for 6502 then back to the NES http://wiki.nesdev.com/w/index.php/NES_reference_guide . Doubt much of this will exist for arcade boards, save whatever you infer back from their home equivalents and possibly any demoscene stuff*), whatever emulator source code or hardware listings get made, a handful appear from some of the dark depths of cheat making (especially game genie or later systems where the binary is in RAM and thus you are playing assembly hacker if you want), a few from old books and moving sideways (I have one on my shelf beside me actually) or maybe writing at least a basic emulator themselves.
Certainly many have found interesting tricks used in games, oddities when assembly is used in anger (or lesser compilers are involved), hidden functionality and patched out options (common enough on pre compiler setups) but as a learning exercise... unless you are learning to navigate your way around learning disassembly or figuring out the quirks of given emulator setups then I am less sure of the merits (you would probably dodge the "learn from whatever arcade coder was bored and wanted to go home on Friday night so did something that just about worked" but it would still be effort over something a bit cleaner).

* https://trixter.oldskool.org/2015/04/07/8088-mph-we-break-all-your-emulators/ and the kind of knowledge that goes into make such things, and as I am linking fun things I better do something 6502 related
https://www.youtube.com/watch?v=fWqBmmPQP40

goldenband

  • Sr. Member
  • ****
  • Posts: 372
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #12 on: July 13, 2021, 08:09:39 pm »
The DECO System would seem like the ideal target platform. People who own the hardware could actually play it and wouldn't even need to switch out any chips!

Chronosplit

  • Hero Member
  • *****
  • Posts: 1582
    • View Profile
Re: Thoughts about writing a game from scratch for MAME?
« Reply #13 on: July 31, 2021, 06:33:38 pm »
Not sure how far along you are on this, but there are four prime candidates for homebrew on the arcade circuit because they effectively have console versions and have played host to a large amount of homebrew.  Those four are the NES (Console itself and Nintendo Vs.), Sega Genesis (Console itself and a couple of systems similar to the Nintendo Vs.), NeoGeo (AES and MVS), and the Dreamcast (the console itself and Sammy's Atomiswave).

Neither really fit what you're looking for in requirements except the Vs., but I could see no better place to first start at when it comes to this.  Either of these would result in people being much more likely to actually play these on real hardware, a platform that is easier to test with, and the possibility of even selling copies if you wish.
« Last Edit: July 31, 2021, 09:17:35 pm by Chronosplit »