Let’s talk Markov Chains

Hello everybody!

It’s been awhile since I’ve posted here and that’s mostly because I’ve been busy or didn’t think about it. Sorry.

Anyway, lately I’ve been thinking about trying to make a sapient Reddit bot. Why? Boredom. The only thing left to decide is how.

Language

So the language I’ve decided to go with will be Python. Python is a pretty light weight language that’s easy to script in, assuming you can get around lack of semi-colons and parentheses. I also have Python installed on my server already and it still runs a Python script I made quite a while back, so I know I can reliably run it if I do decide to make an actual bot.

Intelligence

Now, how do I make the bot intelligent? Well, that’s a good question. I was thinking about making a giant Markov chain by feeding the bot top level high-rated comments for a while, then getting the bot to post (eventually) using my new Markov chain. The only problem with this is storage. Clearly that would take a lot of storage space, according to how most people make Markov chains.

Most Markov chain examples I found are like 2D arrays that contain the same data multiple times and randomly pick from one of those elements. I didn’t want to do that. I actually wanted to try to keep as much of my Markov chain in the database as possible so I didn’t have to worry about re-training my bot every time the script started…but how am I going to do this?

Well…

Database

My database is going to be set up in a referential manner where words point to each other using IDs. Words will also have counters that indicate how many times they’ve been hit. I’ll pull this data into Python and run this bit of code I made for this reason:

Error when loading gists from https://gist.github.com/.

That script loops through the sets that I just retrieved from the database, linking a word to how many times it’s been hit. This data is basically the percentage chance the word will be used next. Then it randomly picks the word and sends it back and the bot continues to build the sentence until whenever it decides it’s done, I guess.

Anyway, that’s about as much as I’ve got figured out right now. If you wanna know more, just ask in the comments. Sorry that you have to register to comment, by the way. Tons of spam bots hit my site now…

Thanks for reading!

Yours,
Shane

Posted in Scripts | Tagged , , | Leave a comment

It’s procedural maze generation time!

Hello everybody!

Recently I’ve been working on a procedural maze generator in Unity 3D. It’s been coming along excellently and it’s even in a playable demo right now.

Screenshot from the playable demo

Screenshot from the playable demo

Anyway, I’m writing this post to release the package! There’s not much to it, and I don’t have a YouTube video explaining yet (coming soon, probably), but the package can be located here. It’s pretty close to ready to run out of the box, simply create an empty and attach the MazeGenerator script to it. It comes with a couple prefabs that you can place on the inspector for the script (Outer Walls/Walls/Ceiling/Floors). Then, after that’s all set up all you’ll have to do is hit run and it’ll generate the maze starting wherever starting coords is.

You can also hook into the script to get a list of the rooms using something like:

_mazeScript = (MazeGenerator) GameObject.Find("MazeGenerationObject").GetComponent(typeof (MazeGenerator));
var rooms = _mazeScript.Rooms;

After that, then you have a C# List<int[]> of Rooms. The integer array is always 5 length (I know this is a terrible way to do this, I’m sorry) and those are indexed as follows:

0: Starting X
1: Starting Z
2: Y index
3: Length of room (Length = X)
4: Width of room (Width = Z)

So, for example, the code I use for placing a player in a random room is as follows:

var randomRoom = Random.Range(0, _mazeScript.Rooms.Count);
var floatArray = _mazeScript.Rooms[randomRoom];
if (floatArray != null)
{
var minX = floatArray[0];
var minZ = floatArray[1];
var y = floatArray[2];
var maxX = minX + floatArray[3];
var maxZ = minY + floatArray[4];
Instantiate(Player, new Vector3((minX + maxX)/2, y+1, (minZ + maxZ)/2), new Quaternion(0,0,0,0));
}

(I need a better code formatter for WordPress…)
Anyway, you should get the point by now. If you have any questions/comments/concerns, leave a message and I’ll try to address it ASAP. I’ll try to make the YouTube video go into depth and try to show you some of the stuff I’m doing.

Thanks for reading!

Yours,
Shane

Posted in Scripts | Tagged , , , , , , | Leave a comment

2D Tile Management Tool

Hello everybody!

 

Recently I created a 2D Tile Management tool for Unity3D. It’s not much, but it should allow developers to more quickly map some tile-based 2D areas.

Tile Manager Icon

I posted a YouTube video about it and I have Unity3D package you can import for it. I’m also trying to upload it to the asset store for free, but that could take up to a week.

Anyway, if you have any suggestions for it, please let me know. I’d like to expand upon it as much as possible.

Yours,
Shane

Posted in Scripts | Tagged , , | Leave a comment

Welcome to Epic Fail Inc.

Greetings!

Epic Fail Inc. was created as an attempt at creating an indie “game company”. We originally conceived the idea during the GitHub Game-off that occurred from November to December 2012.

Boom game preview

Title screen of “Boom”

Our first game, “Boom”, was our submission to the Github Game-Off.

Since the Github Game-off, we have decided to try OneGameAMonth, where during the next 12 months (all of next year) we will try to produce one entire game a month.

So, stick around and watch us progress as we try to push out one game a month. We’ll probably be taking game ideas from this video game name generator, but if you have ideas feel free to post them.

Yours,
Shane

Posted in Uncategorized | Tagged , , , | Leave a comment