• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
  • entries
    41
  • comments
    35
  • views
    33673

About this blog

Developing a 2D puzzle game in DirectX.

Entries in this blog

puz

Graph Maze

It's been 15 months since I last posted. My new project is Graph Maze, which I have been designing in my head for many years. It is similar to Amorphous Maze in that the walls are at arbitrary angles, but different in that the locations are pre-set by a template created with a CAD program.

Day 1
To make a maze out of a mesh, must convert mesh to cells and walls. But finding islands from an interconnected graph may be very complicated. This has been the major reason for not wanting to start this project. Then I came to a realization that I can defer this task by manually drawing closed polygons in the CAD program. Things are starting to get exciting.

Day 2
Drew a test shape and wrote a DXF parser in Perl. My parser does not strictly follow the standard, but good enough for my purpose.

Day 3
Broke VS2010 by trying to add a feature. Installer would always leave out some needed include files. Spent hours removing and re-installing VS to no avail. Must be a MS bug. Gave up because the night was getting late. sad.png

Day 4
Searched the web for discussions on cases similar to mine. Found a solution on stackoverflow, which involved editing the registry.Did that, and the problem went away smile.png

Day 5
Will write code in MFC. Cut-and-pasted the parsed data into a pre-initialized array. Tried to draw it on screen in MM_ISOTROPIC map mode. Something is not right with how I use SetViewportOrg.

Day 6
Figured out SetViewportOrg. Output looks like this:
gmz01.png
While only a fraction is done, having something to look at keeps the motivation up.

Day 7
Decided to start writing Developer Journal.

puz

Hexadecagon Maze Day 10

[font=arial]Day 10[/font]



In the past few days I added the ability to print. I tested with only one printer so it would be nice if you (a GameDev member) can tell me if it worked with your printer. I will leave a copy of a beta version here for a few weeks:

http://members.gamedev.net/puz/88maze101.zip (75KB)

If you have Windows 7 or 8.1, program should just run. If you have XP, you may need MFC100.DLL and MSVCR100.DLL.

I welcome any type of suggestions for improvement. Thank you.
puz

Hexadecagon Maze Day 9

[font=arial]Day 9[/font]



In the past 3 days, I added the ability to save the maze image to a bitmap file. Previously I used 96 DPI, which seems to be Windows' default, but this time I realized I can specify any DPI I want to in a bitmap file, so I picked 150 DPI because I thought it was a good compromise between resolution and file size. Then I decided to make the printable area of a letter size paper 8"x10", which results in 1200x1500 pixels -- a nice round number. I generated 10 mazes and saved them into a single PDF file.

You can get it here: http://www.puz.biz/sw/88maze/88m_10free.htm

Going back to Day 8, I tried out slayemin's suggestion by manually filling the centers with colors (Figure (16)). Does it look better? Note that this feature is not in the code yet; I wanted to first get people's opinions.

Figure (16)
cap88m11x14_1c2.png
puz

Hexadecagon Maze Day 8

[font=arial]Day 8[/font]



I have not reported for about a week. I was spending all of my time refactoring, breaking, and fixing the code. That's why there were no visible progresses to report. But after that, I added the ability to find the solution. Figure 16 is a sample without the solution.

Figure (16)
cap88m11x14_1.png

If you have time, please try solving. Note that this is a 2-D maze, so no crossing over or under is allowed, although some places may look like bridges.

If you need to see the solution, please click here.

P.S.
Since I see a lot of number "88" in the maze, I might rename "Hexadecagon Maze" to "88 Maze". What do you think?
puz

Hexadecagon Maze Day 7

Day 7



Today I mixed GDI+ with MFC so that I can antialias my lines. Here are the before and after pictures:

no_antialias02.pngantialias02.png

I see an improvement in quality. I probably should revisit my old mazes and add antialiasing. Like this one.
puz

Hexadecagon Maze Day 5

Day 5



I decided to make the center of the hexadecagons prohibited regions. The result is Figure (13).

maze_04.png


The maze looks a little like another maze I wrote last year called Beads Maze but at least, it looks a little better than what I got yesterday in Figure (12).
puz

Hexadecagon Maze Day 4

Day 4



Today I spent most of my time refactoring. But I also wrote new code at the last minute. Figure (12) is my initial attempt at maze generation.

maze_03.pnghdmcap02.png

Admittedly, Figure (12) doesn't look as good as when all the walls were in, like Figure (7). I need to think of a way of improving this. If anybody has a good idea, please let me know.

Meanwhile, here's a decent looking maze I wrote last year.
puz

Hexadecagon Maze Day 3

Day 3



Today I wrote code to remove walls. The buttons 3, 2, 1, 0 you see on the toolbar move the blue dot in one of 4 directions, and is used for testing. When the blue dot, which denotes the current position, moves from one cell to another, the wall that separates those two adjacent cells is removed.

remove_walls_03.png

Tomorrow, I will write the maze constructor proper. For the algorithm, I intend to reuse the code I wrote during Amorphous Maze project.
puz

Hexadecagon Maze Day 2

Day 2



Today I will establish a link between cells. To recap, although in Hexadecagon Maze the cell shapes are different, moving from left to right, at some point the pattern starts to repeat. Same holds for moving from bottom to top. The smallest collection of cells that repeat, I call it a "macro tile". In Hexadecagon Maze, the number happens to be 20 (figure (8)). This macro tile can be horizontally and vertically arrayed without gaps (figure (9)).
macro09.png
A cell is a triangle or a quadrilateral, so a cell has either 3 or 4 neighbors. The directions are assigned the numbers {0, 1, 2} or {0, 1, 2, 3}. For example, in figure (8), cell #12 has directions {0, 1, 2, 3}, which link to neighbors {16, 15, 8, 9} respectively. I call these movements "micro movements" because they stay within the macro tile. But some movements cross tile boundaries. For example, if we are currently inside of cell #19, then moving in the 0 direction puts us in cell #0 of the neighbor tile in the Northeast direction. Figure (9) defines the 9 possible directions we can travel between tiles. This I call "macro movements".
all_links_01.png

I hard-coded the micro and macro directions into the array that holds the coordinates of all line segments. To verify that I correctly entered them, I wrote a test program that displays all links as light blue lines (figure (10)).
puz

Hexadecagon Maze

Yesterday I had an idea for a new maze. So I decided to code it. And share my experience in a Journal.

Day 1



At first, I wasn't sure what kind of maze it is going to be. I just had a vague concept that the cells will consist of a mixture of hexagons, squares, and triangles. So I took out a pen and a notebook and did a sketch (1).
sketches_02.jpg
After looking at (1), it seemed implementable, but too ordinary, so I did another sketch (2). This also looked implementable, but rather too simple, so I did a third sketch (3). This looked sufficiently complex, but didn't seem implementable. Specifically, the outer-most triangles encircling the left ring didn't seem repeatable in the right ring. Doable or not, this was becoming too complicated to continue by hand. So I started up a CAD program and started drawing (3). After making several adjustments to (3), I came up with (4).
cad03.png
This looks implementable. But I didn't like the fact that (4) contains right triangles in some of its cells. So I went back to design # (2) and drew it as (5) in CAD. After taking a good look at (5), it seemed to me that (5) is more aesthetically pleasing than (4) and less work to implement. So I decided to proceed with design # (2). As the next step, I found "the basic unit of repetition" (macro tile) and assigned ID numbers from 0 to 19 to every cell. This is shown in CAD drawing (6).
hdmcap02.png
The next step was to print out (6) on paper and write down the vertex coordinates I obtained from the CAD program. Then I started up Visual Studio and wrote a quick and dirty program that plots on the screen the content of an array of line segments stored as a pair of coordinates (x1,y1)-(x2,y2). This was useful for visually checking for entry errors. Diagram (7) is a screen capture of a couple of tiles drawn by the C++ program. The lines show where the walls of the maze are going to be placed. So far so good.

But I need a name. The rings look like 16-sided polygons. Looked up Internet. They call it Hexadecagon. Try "Hexadecagon Maze" Not taken. Good. It's mine tongue.png Next task: Construct the maze.
puz

Eight Way Maze

I decided to write a maze drawing program where the paths extend in eight directions. So I first designed the appearance with a free CAD program, as I did with Beads Maze, a program I wrote about 2 weeks ago.
ewm_cad01.png
Next I wrote the low level display routine, which draws the paths according to the internal connectivity. At first I was planning to round the center bends, but I decided to leave the corners pointy for simplicity. I also wrote a test page in PHP that increments a counter each time I click on a button. Since there are 256 patterns to test, this really came in handy while debugging my code. At one point it showed me that a trim intersection function I wrote was fundamentally flawed. I spent a whole day rewriting it.
ewm_cell02.png
The final step was to cut and paste a maze generating code I wrote before and tailor it to this one. This step wasn't too difficult except for a perplexing bug -- it was not until I broke up a long conditional expression into many small steps that I realized that in PHP, == has a higher precedence than &. I wonder if I'm the only person who finds it counterintuitive that a bitwise AND operation is performed after equality comparison.
ewm_final.png
Above image is the final result. All in all, there were places in the code that felt heavy and laborious but chipping away on it every day eventually got me to the finish. Here is the link to the Eight Way Maze program. Thank you for reading.
puz

Beads Maze

[font='times new roman'][color=rgb(0,0,0)]I decided to write a maze drawing program with cells shaped like donuts. So I first designed the appearance with a free CAD program. I like to start my projects with a very solid visual design because (1) appearance is important, especially in games, (2) I will have a point of reference while coding, and (3) a detailed picture may even suggest a new way to play the game.[/color][/font]


cad.png

[color=rgb(0,0,0)][font='Times New Roman']Next I wrote the so-called OnDraw routine for an empty maze in PHP. When it comes to developing games, I like the bottom-up approach. I like to jump right into coding, get instant feedback, and design as I code. And I run IIS locally so that I don't have to upload my code to a remote server each time I make a code change. I also rely heavily on error_reporting(E_ALL); and error_log("x=$x\n",3,"output.txt"); for debugging.[/font][/color]


blankrings.png

[color=rgb(0,0,0)][font='Times New Roman']Next I retrofitted an old maze drawing program for a square maze I wrote quite some time ago over the donut rings. This step took much longer than I anticipated for many reasons, one of which was that I could not comprehend it because almost all variables were single letter alphabets. My bad.[/font][/color]


overlay.png

[color=rgb(0,0,0)][font='Times New Roman']Then I constructed the walls inside the donuts based on the square maze. I was also trying to pick a good color for the walls. While visualizing what it would look like if every donut had a different color, I got the idea that I should call it beads maze. [/font][/color]


numbers.png

[color=rgb(0,0,0)][font='Times New Roman']While staring at the numbers I printed inside the small circles for debugging purpose, a great idea hit me -- why not show alphabets instead of numbers? When a player solves the maze properly, the letters he or she has visited will spell out a word or a sentence containing a secret message. What serendipity![/font][/color]


final.png

[color=rgb(0,0,0)][font='Times New Roman']Above is what the final program looks like. Please visit [/font][/color]http://www.puz.com/sw/phpmaze/index.php[color=rgb(0,0,0)][font='Times New Roman'] and try it out![/font][/color]

puz

Final task status

I'm half way done with the final task of implementing a "show answer" mode in my first Android game. I'm right on schedule for the October 26 deadline.

Done:
- reading solutions from resource into array
- comparing user movements with a solution
- finding the set of solutions that match the user's sequence so far
- finding the intersection of all matching solutions

Not done:
- building the connection array from the intersection
- adding one more step to connection array beyond the last intersection
- displaying lines according to connection array
- button to enable the answer mode
puz

Plan to add solution

I have been slacking off coding in the last few days, but I am going to restart my engine and wrap up this project. I have written down 164 solutions, which can be distilled to 22 unique solutions due to symmetry. I plan to add an option to guide the user through these answers. Because there are several ideas swirling in my head on how to do this, there is a danger that I will get carried away with the aesthetics and usability aspects. Therefore, I'm going to give myself only one week to implement the last feature. Whatever state the project is in on October 26 is what I'm going to release.
puz

Added Hint

In "20 Hops" version 1.04 I added hints and the option to enable it. With this, most players should be able to finish the puzzle. I think the amount of hint strikes a good balance between being too difficult and giving away the answer. But I could be wrong. I hope somebody gives me feedback. :wink:

cap04.png

20 Hops for Android Download location: thops104.apk

20 Hops status report: members.gamedev.net/puz

My external web site: puz.com
puz

My idea was not original

:( I made a sad discovery that what I thought was my original idea in the "20 Hops" game has been done before. In fact, as far as 7 years ago (or 11 years ago?), TANSTAAFL developed "Kight's Challenge" and put it on Game Development Showcase. His game comes with nice graphics, animation, sound effects, and a bigger board. So, moving forward, I need to put more effort on product differentiation, such as trying to come up with a friendly hint system.

I implemented undo. Download Version 1.02.
puz

My first .apk

In the spirit of release early, release often, I created my first .apk (Android Application Package) and uploaded to


  • members.gamedev.net/puz/


    I'm still don't understand the purpose of self-signing (as opposed to signing by a certificate authority) but I'm not complaining as long as it works. The program I uploaded is a beta that is quite rough around the edges but nevertheless playable. One thing I do want to fix soon is the warning message "Do you want to install this application? Phone calls read phone state and identity." which appears and scares potential users away, because there is no need for my app to make phone calls or know the identity of users.

    Everybody with an Android phone is welcome to download and try out my very first app. Thanks. :)

    phone01.jpg