Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Control game by java instructions.
02-22-2017, 06:23 PM
Post: #1
Control game by java instructions.
Can you guys help me.
I'm trying to write a java program that will open ppsspp and a game then control the game how a player would. I also need to be able to collect data that gets presented on screen. Basically i want to make a AI that will beat a game level. I have a feeling this question has been ask before. Do you guys know how to issue commands while the game is playing from a java program?
Find all posts by this user
Quote this message in a reply
02-22-2017, 06:48 PM (This post was last modified: 02-22-2017 06:51 PM by Asferot.)
Post: #2
RE: Control game by java instructions.
It depends on what you want to do.
The most simple way would be just making the java program issue controller commands.
So it is like a huge timed script that simply presses buttons at correct times.

But from what I understand, the level of interaction you want is impossible. Unless you are a very good programmer. It has been done before, but not with PPSSPP I think.

Everything is Hitsuzen!
Find all posts by this user
Quote this message in a reply
02-22-2017, 07:02 PM
Post: #3
RE: Control game by java instructions.
(02-22-2017 06:48 PM)Asferot Wrote:  It depends on what you want to do.
The most simple way would be just making the java program issue controller commands.
So it is like a huge timed script that simply presses buttons at correct times.

But from what I understand, the level of interaction you want is impossible. Unless you are a very good programmer. It has been done before, but not with PPSSPP I think.


I thought the game would return some sort of signal which shows that something has changed on the screen. I don't think this would be impossible since people have made AI's that play other kinds of games. Right now just need to figure out how to press X when the load player data message appears.
Find all posts by this user
Quote this message in a reply
02-22-2017, 07:31 PM (This post was last modified: 02-22-2017 07:31 PM by Asferot.)
Post: #4
RE: Control game by java instructions.
(02-22-2017 07:02 PM)ggpposs Wrote:  
(02-22-2017 06:48 PM)Asferot Wrote:  It depends on what you want to do.
The most simple way would be just making the java program issue controller commands.
So it is like a huge timed script that simply presses buttons at correct times.

But from what I understand, the level of interaction you want is impossible. Unless you are a very good programmer. It has been done before, but not with PPSSPP I think.


I thought the game would return some sort of signal which shows that something has changed on the screen. I don't think this would be impossible since people have made AI's that play other kinds of games. Right now just need to figure out how to press X when the load player data message appears.

Myea, the stuff you want is not possible, you would need a API layer that interacts with said game. AKA you need to make emulator yourself, that sees what game is doing. Unless PPSSPP has that, but I never have heard of that.

Everything is Hitsuzen!
Find all posts by this user
Quote this message in a reply
02-23-2017, 04:53 PM
Post: #5
RE: Control game by java instructions.
When making bots you have 2 choices:
- simulate human by some form of shape recognition for reading(you can replace textures in-game to simple colors to make it easier) and send key presses,
- read and inject stuff from/to game memory which might not be faster to do and it will be more per-game approach, but should give more control.

You can also mix the two together.

When it comes to emulators with all their tricks and translation of console code to native to the device running it on are not the most friendly thing to mess with their memory by external tools, especially PPSSPP isn't with all it's mirrors and JIT. So you should rather learn things like that with simpler native games/apps before you try to mix in an additional complication in terms of emulation.

The simplest way to write a basic bot for PPSSPP at least imo would be to write a bunch of scripts in mips and inject it into the game itself via built-in CWCheat implementation. All it would have to do is attach to code which triggers stuff we want the bot to react on, then write some basic data to our own place in memory, then attach another script right after game checks for key presses, make it read previously generated data and react with correct key press.

A bit simpler, but similar in the concept are right analog patches, but those write data based on player analog input and react on that data with triggers so it's the opposite of what bot should be doing.

The simplest games you can write the most basic bots are all of those rhytm games since all the player does in them is pressing keys at correct time, so all the bot would have to do is to press the key when condition for rhytm was accomplished, in such case you can also just cheat simplifying it even more and just take the right branch that tells the game the key was pressed at perfect timing, instead of sending any key data;p, all of those auto-play cheats do pretty much that and it still is a basic form of bot / automatization, games "AI" aren't really true AI either, it's all about appearance and cheating here and there is great for performance.

Java or whatever else, doesn't really matter, everyone is biased towards something, I would pick mips because I can handle it better than high level languages and it also gives me more control, in the end what matters is, if you can use the language you choose, enough to write all the code you need without needing step by step guides and tutorials, because such thing might not exist.
And again interacting with emulator like PPSSPP externally might not be the easiest thing to do, if you really have to do it with PSP game and java, maybe use jpcsp, it's using java as well so you might find it easier to interact with.

http://forums.ppsspp.org/showthread.php?tid=6594 - Custom PPSSPP Shaders!
http://forums.ppsspp.org/showthread.php?tid=3590&pid=117172#pid117172 - simple CE scripts to help creating CWCheats,
https://github.com/LunaMoo/PPSSPP_workarounds - CWCheat workarounds.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: