Showing posts with label Project Topians Maze. Show all posts
Showing posts with label Project Topians Maze. Show all posts

Small Update

Since the last time I wrote there have been several changes made, The main thing you might notice are the colors and size of the game. but if you look closely there are small details that add a lot to the game experience overall.

First off, there is the Sound indicator at the bottom. here you can toggle the music on/off. If there is one thing I hate is having a game making noise when I don't want it to. so this button will help solve that issue.

Secondly you notice the ball looks weird and there is a small blue circle. The blue circle is the cursor, and its main functionality is to tell you if you are able to shoot or not. when you aim at an angle that is not permitted this cursor turns red. The reason why the ball looks stretched is because now you get this little preview of the direction the ball is going to take, this really helps the aiming. There might be a possibility of me adding the gravity effect to the preview, that way it is even more helpful.

Third is a small detail that might not seem different, and that is the record. When I took this screenshot I had just ran the program, but this score was there, the reason it was there is because I have added the functionality for the game to store values in a Shared Object. this means that the record will always appear there every time I play. This feature is going to take this game to the next level. now I can add unlocks, and keep track of any data I want.

The last thing is the menu song. Now you won't be greeted by a boring silent menu.

There is a small business trip coming ahead, so there might be a one or two day delay on the next update.

Not quite attractive yet

The main game functionality is working, and that is the most important part of a game, but I feel that visually the game is not too attractive, the cluttered menus and HUD make it a bit uncomfortable to play.

At the same time there are some small details that I feel could make the game easier to play and understand, for example adding a feature that lets the player know where he can jump, many times when stuck to the edge you might feel that you can jump up, but do to the fact that you are on a side wall, you can't jump straight up, but that is something that seems more like a bug than a mechanic, so by adding a way for the player to know what angles he can jump to I feel that it would greatly add to the game. Also the ball itself needs to look cooler, right now it is extremely weird how it just stops and lays there with out really grabbing.

Below is a list of other things I want to fix:
-Add sounds to the buttons (make a noise when you hover over them).
-Add a clickable link to the blog, this way people can see all the process of making the game.
-Add music to the main menu
-Reorganize the menus to fit a larger screen
-Add mute button
-Let people use buttons from the game to restart a level or play a different one.
-Make HUD more interesting
-Add a cookie so that record scores can be kept
-Record more data like All time points gained and blocks hit.
-Add Performance Awards (ex: over 70 blocks hit in one level, under 15 seconds to complete, 17000 or more points in a level, 1,000,000 career points).


Well, it seems like a long list, but I'm sure all these little details are the difference between a fun game and an addicting game.

Milestone Complete

It has now been 46 hours since I got the task, and here is the working version of this fun game, I was lucky to find a great song for the game using freeplaymusic.com it is a great site to get high quality songs.

Overall I am really happy, I am still thinking about things that could be added to make it better, but I feel that perhaps the best thing is to let the people tell me what they think. I will Upload the game on newgrounds.com and check the opinions people have. I really like posting games on Newgrounds because you get a lot of feedback on every single detail.

Also I will be posting up the Source code for the game just in case anyone is interested in seeing how it was made.

Below you can play the game, I hope you enjoy it!



Menus

I just finished adding the menus, they are not the most exiting menus ever, but in this game it is not really important, the game is fun and that is all that matters. below you can see the screenshot of what it looks like now:

Next Steps



Now that the game is fun and re playable, I think it is time to work on the visual side, I want to create a small menu screen to welcome the user and also add some sounds in the game.

As for the name of the game I am still not sure, I might just go with Topians: Maze Trouble, or maybe reuse the name of Topians: Castle Trouble. The reason is because I already have an intro image for it so it might save me time.

this is the Castle Trouble logo:

Level Select and results

Game is looking good, I have just added the Level Select, and a results screen.



You might be wondering how can you select levels if the levels are created randomly. To explain this I must first talk about how random numbers are generated.

In order to create the illusion of a random number, imagine a super long list of numbers in no particular order, for the game you just follow that long list of numbers, this might sound really bad, but the truth is that it is very hard to predict in what part of this long list you are currently on.

So in order for the game to be different every time, flash starts at a different position on this long list.

I know this random dilema sounds really bad, but in this case it is great for me, because if all the numbers are the same, then that means if I start at the same place I will get the same results. so that is why there is a level code, this code is basically the item you want to start the random on.

unfortunately flash doesn't let you set the starting number (called the Seed), so in order to do this I got this wonderful code from this page: http://www.actionscript.org/forums/showthread.php3?t=210807

and I was able to create the level select.

Is it just me, or is this game pretty fun to play?

I don't know if it is the long hours of work or the fact that I made the game, but to be honest with you, right now the game seems pretty fun, I added time and points into it and it is definitely fun to try and beat my own record.

below you can see a current screenshot of the game:

You can notice several things, first the time, It took me 19 seconds. my fastest time yet is 15 seconds, and you may also notice all the orange lines, this feature I think adds a lot to the experience, those orange lines are the lines I landed on during the game, so basically they tell you the path I took. Hitting a line will give you extra points, but only the first time you hit it.

Now my next task is to add reset functionality, it shouldn't be a lot of trouble but it still has to be done. Also I will be adding a screen after winning that shows your current score and then your highest score, that way you can keep track of your performance easily. After that Sounds and menus.

Controls

The next element I need to think about is controls, so what do I choose for them, do I combine keyboard with mouse, or just keyboard, just the Mouse?

To help me deal with this issue I decided to try them out. Using the keyboard and the mouse was ok but it seemed like too much for a simple game, then I thought that I could make it work just with the mouse, you basically point to where you want to jump and the character makes a jump in that direction.

Below you can see a working version of it, also I had to make several extra checks because I was having some times when the ball used to go through the walls, that should be fixed now.


checking collision with the walls

The first thing I need to do for this walking on walls game is to make sure that I can check collision with the walls.

Right before I started programming it, I noticed that it would be very inefficient to check collision with all the walls in the level every frame, that would make collision checking very slow, but how do I know what walls to check against?

It's simple, thanks to the way I set up the walls in arrays, All I need to do is check what cell I am on and then that would give me an ID that I can use to check collision against only 4 walls.

And that is what I did, the only problem was that all the top cells don't have a roof, and all the left cells don't have a left wall, so in order to deal with this problem all I did was create a long left wall that all left cells will check against and a roof that all top cells will check against.

So simply by getting the current cell I was on I could do collision check, but when coding that part I thought that it would be very inefficient to check collision against every cell in order to know which one I am on. thankfully in this project the square set up helps me a lot, simply by using the position of the player I can determine what cell he is on, here is the code for that, just in case you were wondering:
var horizontalPos = Math.round((obj.x - xOffset)/cellWidth);
var verticalPos = Math.round(((obj.y - yOffset)/cellHeight))*cellsPerRow;

var finalNumber = horizontalPos+verticalPos;

now here is the swf, you can move the mouse around and look at the text box in the bottom, it tells you what wall it is colliding with.



you can move the mouse around the same way I explained in a previous post, think of moving this player along the walls and jumping from one to an other until you reach the top.

This sounds like it could work

After careful thinking I believe that I have a good idea on how to make this simple maze look like a lot of fun.

I'm going to try and make you visualize this. take a look at a current maze, but try and take all your previous knowledge of mazes out. Look at this maze like if it was a side view of a building.....

Now I need your imagination .... with your finger start at one of the bottom corners, think of your finger as a small character, now imagine running across the bottom of the maze and then when you get to the first wall jumping up and landing on the second level. from there you have a choice to either jump to the next level or go down to the first level again, from the bottom left corner now you have a tall wall, now think of mario, were you can wall jump. imaging moving up that wall very quickly and then jumping across to land on the ledge of the 5th level, from there you can keep jumping up until reaching the end word.

Think of the endless gameplay, every time you play you will get a never before seen level, and if you add time and points into the equation, this might be a pretty fun game.

Just in case you haven't seen what the game is about, I will be working on a small prototype to have the character jump on walls.

Where is the Fun?

Okay, I have developed a Random Maze generator, but to be honest it doesn't look too much fun, no matter how many times I generate mazes, all of them look like mazes that can be completed in a matter of seconds. Off course I could make the maze 100 by 100 cells, but then it would be tedious to complete and it wouldn't look good on the screen. So here is were my game development skills get tested.

How can I make a simple thing like this maze more interesting?
The first thing that comes to mind is that I need to try and take all previous knowledge of how mazes are played and look at this from a completely new perspective. Could I make this a 3D maze? Have the player only see a couple of cells so that he can't see the whole maze? Put time constrains and bonuses. then it would make sense for it to be simple mazes, it would then become a battle against seconds, and see how many level the user can pass.

I'll check back later with the results of my brain storming, there has to be something I can come up with.

Creating more paths

As you might have noticed from the previous post, there is a very big flaw, there is only one correct path, so anyone playing will be forced to take the path to the exit, this is off course a very big problem. In order to fix that I need to open up a bit more paths, so I am now randomly accessing the cells inside of the path and opening up a wall next to them. There is a 50% chance of that happening for every cell.

The results immediately look more interesting:

Quick and Simple

Thanks to the modularity of the code I just had to create a for loop and call a couple of functions and I got this current step working:

Removable Walls

Following the simple instructions mentioned before it was really easy to make this next step, here you can see the way it looks at the moment:


You can notice that there are no longer those big blocks, instead there is a clear path now.

now the important step is making sure to remove random walls around the map in order to make it look a bit more challenging.

Adding Walls

The next step is to have walls on the maze, in order to do this there will be several wall segments dividing all cells. and they will be stored in separate arrays in order to help with determining the index of the wall that needs to be removed.
This first image shows the different types of walls, there are the Vertical walls(RED) and the Horizontal Walls (BLUE) there will be an array in order to store each of these. below you can see the indecies of these walls:

Looking at the picture above shows the reasoning for having these separate arrays, lets say I am on cell number 5 and want to open a path to cell number 16 then there are only two steps to determine what to do:

1) Determine that the cell you are traveling to is underneath the current cell (this means that you will be removing a horizontal wall)

2) use the same index value of the current cell to access the horizontal walls array and make sure to make it disappear.

First Generated Path

Surely enough the computer generates a path that goes from the end point to a start point simply by following the three steps mentioned before.

Here is a screenshot of three randomly generated paths

The first thing you might notice is that sometimes there are big blocks of four or six, the reason for this is that this first step only generates a path, the walls are not being removed yet, that will be the next step.

AI Rules for Building the Maze

After creating a maze by hand on the previous example, here is the breakdown of the rules for creating the maze:

1) Select the current cell (start with the end cell)
2) Randomly select a cell to travel to, exclude cells that have been traveled to before. Choose either left. right or bottom.
3) Continue loop unless there are no connections possible.

Those rules should take care of the creation of the main path, lets try that out first and see if it works.

Also it is very important to define the variables the cells will need in order for this process:

Boolean determining if the cell is part of the final path
number determining the type of cell (there are 9 types: TopRight, Top, TopLeft, Left, middle, right, bottom right, bottom and bottom left). this variable will help speed up the process of looking at neighbor cells.
Cell ID: this ID will help speed up the process of accessing walls.

Creating the maze

I have decided to go with a regular maze, one that you would see on cereal boxes or Denny's menus.

Now the question is how to create this type of maze with code. My first idea was to create one by hand.

When creating the maze I saw that the best way to create it is by doing the same thing you would do to solve it (start from the end). But in order to start from the end I need a maze that is completely covered by walls, then I can start from the end and erase these walls.

This is what that grid would look like:

Now the first step like I said was to start from the end(E) and start erasing walls until getting to the Start(S).
This is what it would look like:
Obviously that track is not acceptable as a challenge, it does create a path but for someone playing it would be an immediate solution, therefore in order to create a diversion from the main path I randomly deleted a line from each square. But there was one rule I had when deleting a line, I would not delete a line that would open a way to the path, this way I make sure that this random deleting of walls doesn't create a straight path to the goal, also squares that are part of the path were not part of this random deletion.

Finally this is what it would look like

These simple rules seem to produce a good looking maze, unfortunately this seems like a maze that can be solved in about 5 seconds, even though the challenge doesn't say anything about the maze being hard, as a game developer I always want to challenge the player, so I have come up with a gameplay mechanic that could help turn this simple maze into an interesting challenge.

New Problem

Today I was presented with a challenge. The goal is to create a Flash Random maze generator/solver in under 48 hours.

Instantly there are a lot of thoughts running through my brain:

1)Probably use A* for path-finding.
2)How to create mazes, not even randomly but simply if I was to create a maze how would I do it. If I'm able to create one by hand then it is very likely that I can make the computer follow the set of rules I created.
3)There are many types of mazes, what type should I create?
4)Making it fun. As a game developer my goal is to entertain, and creating simple mazes might not be creative enough for someone to enjoy, so what gameplay mechanics can I add?

well, I'm going to start thinking about mazes now, I'll check back later with any new thoughts