System to allow menu-driven RPGs to be played with a mouse

This is for people involved in the developement of Snes9x, or SNES emulators in general.
BUG REPORTS BELONG IN TECH SUPPORT/BUG TRACKING!
Post Reply
Martoon
Snes9x White Belt
Posts: 3
Joined: Tue Sep 20, 2011 3:09 am

System to allow menu-driven RPGs to be played with a mouse

Post by Martoon »

(tl;dr overview in bold)

There are a lot of good turn-based RPGs for the SNES. Most of the gameplay consists of selecting things from menus (attack, magic, use item, defend, etc.). Whenever I play one of these on an emulator, I always think of how nice it would be to just click a menu selection with a mouse instead of pressing down, down, right, right, A on a dpad controller. Now with emulators being viable on more mobile devices, I think this even more when doing this with an onscreen virtual dpad or tiny thumb keyboard.

I'm thinking of developing a scriptable interface that would translate mouse clicks to simulated dpad presses. Any given game would need a custom script to support it.

I'm thinking Lua for the scripting language, since it's small and easy to embed (just a handful of C files to include with the project) and I've always found the C-to-Lua glue to be pretty clean to implement.

The interface would provide functions through which the script could determine which menu (if any) is currently active, and where the selection cursor is. This could be done via a couple different methods. Either by directly referencing memory in the SNES memory space (if the scripter knew which memory locations held variables for menu states), or by scanning the SNES display buffer for reference images (with masks) that would be included with the script. The reference images would be things like menu borders and selection cursors.

The interface would also provide, of course, functions to simulate dpad presses.

Developing a script for a game would be a somewhat complex process that would likely involve a fair amount of trial and error. I think after someone had done a couple, though, they would get a process down.

I think Snes9x would be the best place for me to try this, since it appears to be the most solid, portable, open-source SNES emulator available. I haven't done a lot of emulator hacking (mostly just a few MAME modifications), but I have a pretty solid understanding of how they work and how they're generally structured.

Should I try to tackle this, my questions for the dev community here are:
  • Do you think users would have any interest in this, assuming it worked well and the games they wanted to play were supported?
  • Do you think the more technical users and/or developers would write scripts for games?
  • Do you anticipate any insurmountable issues I might encounter that would simply prevent this concept from working?
  • Would someone already more familiar with the Snes9x codebase be willing to answer a few questions, and point me in the right direction for where I'd need to add hooks, access buffers, etc.? I could manage without the help, but it always goes much faster if someone can answer things directly. I'd also host the codebase on a public repository (e.g., SourceForge), so if anyone else wanted to contribute, that'd be great.
adventure_of_link
Hero of Hyrule | Official Port Recruiter
Posts: 2588
Joined: Mon May 24, 2004 5:06 pm
Location: 255.255.255.255

Post by adventure_of_link »

I think it's a good idea, but consider this:

* where are you gonna have the buffers to scroll your mouse/device through the menus (eg, the spell/item you want is on page 2 or 3 or a bit further down the list, or something)?
* what about selecting change/parry in final fantasy games?
* in the case of FF2/4, how about equipping items in battle?
Image

Unofficial Test Monkey For:
* Snes9X GX (Wii)
* Snes9X EX (Android)
* Snes9X 64-bits (PC/Mac)

ZSNES|Ben Heck|NSRT|Bob Smiley
Martoon
Snes9x White Belt
Posts: 3
Joined: Tue Sep 20, 2011 3:09 am

Post by Martoon »

adventure_of_link wrote:I think it's a good idea, but consider this:

* where are you gonna have the buffers to scroll your mouse/device through the menus (eg, the spell/item you want is on page 2 or 3 or a bit further down the list, or something)?
* what about selecting change/parry in final fantasy games?
* in the case of FF2/4, how about equipping items in battle?
Good point! I hadn't thought of these.

The scripting interface will need to provide functions to add auxiliary GUI elements to the screen (I'd think buttons would generally do the job) for things like page up/down, change, equip, etc.
User avatar
OV2
Official Win32 Porter/Dev
Posts: 679
Joined: Thu Aug 30, 2007 10:15 pm

Post by OV2 »

You might want to take a look at snes9x-rr, which already implemented lua scripting (albeit for TASing purposes).
AFAIK it's currently only up to v1.52, but it might be a good reference.
If you don't already know: the main snes9x repository is here.

As for questions and help: simply post them here, I'm sure we can help you out.
Martoon
Snes9x White Belt
Posts: 3
Joined: Tue Sep 20, 2011 3:09 am

Post by Martoon »

OV2 wrote:You might want to take a look at snes9x-rr, which already implemented lua scripting (albeit for TASing purposes).
AFAIK it's currently only up to v1.52, but it might be a good reference.
If you don't already know: the main snes9x repository is here.

As for questions and help: simply post them here, I'm sure we can help you out.
Cool, taking a look at snes9x-rr. That'll be a great starting reference, since it's binding some of the same things I will (memory reads, joypad setting, etc.).

Nope, I wasn't aware of the github repo. I've been building from the tar on ipher's site.

I'll be back here with any questions or problems I run into. Thanks!
Post Reply