Creating a bot to test my own game

HI everybody,

I always like to start by saying that I am an amateur and create games for fun and share them with my friends for fun and their feedback, so if my questions are very stupid, I apologize in advance. What I am wondering is how I would get a bot to synthesize button presses and screen touches. I don’t know anything about bots, but it is essentially another kind of AI to use, and I would like to learn more about them. For my use, I would LOVE to be able to watch a bot try to play through my games as I watch and use it as a method of testing my games. I’m mostly curious how the bot can discover, and differentiate, one button from another.

I really appreciate any sample code or suggested tutorials that you might think would be helpful.
Thank you so much!

What you are asking about is basic AI in a game system. It’s relatively easy.
You are looking at programming a million miles away, and need to understand the structure a little better about programming.
First you need to think low level, you are thinking about something that could be handled by a simple “Button Presser” and this can be handled in 3 lines of code.

private bool button; //Create a true or false bool 

if(!button) //if button is false
{
  button = !button; //Switch button to opposite.
}

This is the lowest level of AI you can have, if a statement is either true or false and changes to the opposite of what it is, now you could apply that to anything you wanted.

so you can’t just say “I want it to play my game” There is no “Play my game” function, you would have to make it play your game through code.
So you have to make the AI have a goal

if(!button) 
{
  WalkToObject(oabjectToWalkTo);
}

WalkToObject(GameObject object)
{
  bot.transform.position = object.transform.position;
}

you have to create the system from the ground up, or you can get a asset from the unity store that can controll AI, I think there are some that are free. But my suggestion keep learning.

If these are browser-based games, I’d recommend you look into Selenium -http://docs.seleniumhq.org - which makes it easy to record and playback mouse and keystrokes in a browser.

A few years ago I did some development on Palm OS. The emulator that I used had a nifty feature called “gremlins”. Basically you could have 1000’s of random input events testing your program. I don’t think they had any AI, which is a good thing because given enough time they could catch very obscure bugs. Besides, you can’t make many assumptions regarding who’s gonna play your game )

If I was going to write test automation software, that’s where I would start.