Main > Software Forum
Need advice from programmers that deal with memory sniping.
<< < (4/5) > >>
Howard_Casto:
You can't validate anything with a screen capture because  mame allows different filters and the ability to turn off hardware stretch and such.  What your system detects as the selection screen might not be the same on another pc, with different color, filter, rendering and bit-depth settings.  Buddah manages to do so in his video capture code because he searches for two identical frames or solid colors, which is easy to do. Also he's constantly taking a screenshot and comparing it externally (which is what you would have to do pretty much) and this slows mame to a crawl, making it unplayable, not to mention it means you have to use a custom build of mame.  

You can't validate anything with keypresses because you don't know if they pressed said keys in the character selection screen or not. (The only way to do so accurately would be to use the screenshot method, which as we've both pointed out probably isn't going to even work.)  You can't just set a delay, because different systems will have a slightly different delay between when one presses start and when one actually gets to the selection screen.  And since missing even one keypress would throw the whoel matrix off, I don't see it beign very acurate.  And of course the question of which keys also comes to mind.  The app would have to read mame's default cfg, and mame's cfg files, and mame's ini files and mame's ctrlr files and be compatable with all major versions of mame.  I have to do this sort of stuff for j5 and just parsing all the data is a full-time job.    

And remember, on top of all of that, many games allow player 2 to join in at any time, dumping you back to the selection screen again.  And there isn't any way to detect gameover, so if a player presses start to continue (In some games you aren't dumped back to the selection screen and just continue as the selected character.), the program thinks you are in select mode again and you get a randomly changing profile throughout the duration of the rest of your game. 

Technically it might be possible, but considering it would literally take weeks to figure out how to do a single game and there are several hundred fighters in mame... as I said, it is totally improbable to do so.  

You two guys seem to think it's a simple as counting the joystick presses and a few other trivial things, but unfortunately this isn't the case. 

I'm not sure where these "worms" you speak of are though.  Here's the thing, Youki isn't willing to do it, I'm not willing to do it, there might be 3 or 4 more people on the boards qualified to do it (that actually are willing to do software for this community) and none of them have volunteered, so even if youki argues to the contrary it seems pretty apparent to me that it is, indeed more trouble than it's worth. 

And I'm not being mean or negative, I'm just being practical. 

Sorry man. 
youki:

--- Quote ---if youki argues to the contrary it seems pretty apparent to me that it is, indeed more trouble than it's worth.
--- End quote ---

I agree with that, i just say It is doable.   And i don't say it easy , just doable for somebody really motivated!!!


--- Quote ---You can't validate anything with keypresses because you don't know if they pressed said keys in the character selection screen or not.
--- End quote ---

Yes, you can.  Because you work on Key sequences ,not on simple key press.   Insert Coin , following of a player start , following of joystick moves, folllowing of a player 1 button 1.   There is strong chance, for one given game, that you started the game, and select a player.   Of course there is surely tons of "exception" and special case to manage.... but it is just for fun, not a professionnal use, if you can make it works at 90% it could be enough.


Anyway as you said , i don't thing somebody will try that anyway.



Buddabing:
Most likely, each game has a memory address which stores the player. Maybe there's a 1 there for Sub-Zero, 2 for Scorpion, etc.

With the MAME debugger, you could step through the code and examine memory immediately before and after selecting a character. Or, in a game that saves states, you could take a state save before and after selecting a character and examine the state saves.

You should be able to find which memory addresses and values are relevant. Once that is done, you can either use a custom build of MAME to monitor the addresses, or you can figure out what memory offset of your program correspond with the address and monitor it externally.

To test Youki's theory, it should be easy to compile MAME to save a series of joystick moves and button presses to predict what character is selected, then log it.
Buddabing:
Testing Youki's theory:

I added two lines of code to the joystick handling routine to log joystick presses. The problem is not detecting when a joystick or button is pressed. The problem is when the player holds down the joystick. For some games, including Mortal Kombat, the joystick can be held down during the character selection screen and the joystick move will repeat after a certain period of time. This doesn't happen in all games. Sf2 does not have this behavior.

So, not only will joystick sequences have to be calculated, but the delay between moves generated by holding down the joystick will have to be considered.

You can calculate the exact amount of time between incremental joystick moves by using screenshots. If the joystick is pressed at frame X and the second joystick move happens at frame Y, then the delay is (Y-X)/framerate. This would require use of BuddaMAME's ability to generate screenshot each frame.

This is not a project I want to undertake.
youki:

--- Quote ---So, not only will joystick sequences have to be calculated, but the delay between moves generated by holding down the joystick will have to be considered.
--- End quote ---


It is why for this kind of game (where you can hold down the joystick) , you have to determine the charactere choosen using graphic recognition.  Just would have "just" to detect the characters selection validation.
At this time, you made a screenshot.

Then you compare the image generated with an imagine stored in your databank.  As Howard said, there is surely some problems with filter , resolution etc..Etc... but we could image a configuration tool that you will have to run once your mame is set up , that will generate image in your reference databank according to your current setting.

Or you use lot of more complex imagery algorithms.


So who starts?   ;)



Navigation
Message Index
Next page
Previous page

Go to full version