A Mobile Logic Puzzle Application
Andreas Sepp
Introduction
I will be developing an Android game during this semester. The game is a sort of a logic puzzle and will integrate advertising and in-app purchases.
The puzzle
Binario is a binary logic puzzle where the goal is to fill a rectangular grid with binary values. The puzzle is also known as Tic-Tac-Toe Logic (at least that's what I'm calling it) and for ease of understanding, the binary values used in the puzzles will be Xs and Os just like in a regular Tic-Tac-Toe game. At the start of the game, the user is presented with a grid, where every tile is either empty or has an X or O and the user will have to fill all the empty tiles with Xs and Os using the following rules:
- Every row and column can have a maximum of 2 Xs and Os in a row.
- The number of Xs and Os must be equal in every row and column.
The puzzles are generated using a generator, that ensures that each puzzle is incrementally solvable by only doing logical steps without any guessing. The puzzle can be checked out online in a very basic form: http://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/unruly.html
What already exists
- A self-written puzzle generator that is capable of generating such puzzles
- A base application that I've previously written to speed up starting new projects
- A basic implementation of the puzzle in an another project
What will be used
The application will be written in Java with LibGDX. LibGDX is built on OpenGL and can compile to Android and iOS (using RoboVM) amongst other things. So there's a possibility that there'll also be an iOS release by the end of the course. The project is hosted privately on Bitbucket.
What is planned
1) The generator will be improved to generate experimental puzzles with combinations of new rules. The planned rules are (all probably won't be implemented, let's see which are more fun):
- diagonals - no more than 3 of X or O are allowed to be consequently in a diagonal.
- wrapped - the puzzle rules also carry over the edges. E.g. if there's XX at the end of a row, the row can't start with a X, because it would be counted as 3 X in a row.
- custom shapes - the puzzles are not completely rectangular. E.g. possible shapes that could be generated are T, L, [] etc.
- unique rows and columns - every column and row is unique adding another thing that players must look for.
2) An art style will be chosen
3) In-game support for the new rules
4) UX will be made smoother and faster
5) Better asset management (asynchronous loading and texture atlases)
6) In-app purchases
7) In-app advertisements
8) An experience system or something similar to give a sense of progression
9) Twitter integration
10) Hint system
Note that that is a big list of things and all probably won't fit in the scope of this course.
Milestone 1 (01.03)
Goals:
- The basic puzzle (also called traditional from here on out) will be implemented in a new application in such a form that it is playable. This will include some UI rework.
Work done:
- In the background: I originally planned on forking the old project and working based on that, but I opted to start fresh and only copying some of the old elements since I wanted to improve many different components. I started by improving asset loading (on slower devices the old application could load the next screen for up to 1500ms, which was really noticeable). This is still a work in progress. Currently all the assets are just loaded at launch while still blocking the main thread. A splash screen will later be added which will load the assets in the background. Currently sprites are still used as separate images, spritesheets with texture atlases are planned for the next milestones.
- Visual changes: I made a very basic UI that lets you choose your gamemode, the campaign and then the level. You can also then play the puzzle using the old assets currently. It's possible to save your state and continue later and once you win you can either move on to the next puzzle or return to the menu. Here are some pictures of the current UI:
Currently only traditional gamemode campaigns are implemented, all 3 campaigns have the same puzzles. Here's a runnable jar if you want to try it out: TTL0.1.jar (8MB)
Milestone 2 (15.03)
Goals:
For milestone 2, at least 5 out of 7 following things will be implemented:
1. Textures will be packed into a spritesheet and accessed with a textureatlas to improve performance
2. Basic experience system (when completing a puzzle, the user receives some experience, some puzzles are locked behind a requirement, user can view their experience and level)
3. Undoing moves on the puzzle
4. New puzzle screen assets
5. Scaling options for the puzzle screen
6. UI improvements showing total progress (per campaign how much of it is complete etc)
7. Experimental puzzle generation for at least one new type (thinking wrapped right now)
Work done:
1. Textures are now packed into a single spritesheet.
2. When completing a puzzle, you get (width*height)/4 xp for it. You can see your level and progress to the next level at the main menu in a crude form. More images below!
3. There's a button to undo moves all the way to the beginning of the puzzle.
4. Experimented a bit with a cyan and magenta color scheme.
5. Did not do for this milestone.
6. Each campaign shows a percentage how much of it is complete.
7. Wrapped puzzle generation seems to work in most cases but it runs into a deadlock every 20 generated puzzles or so. Debugging is still ongoing.
Pictures (along with some stuff that was done ahead for milestone 3):
Milestone 3 (29.03)
Goals:
For milestone 3, at least 5 of the 7 following things will be implemented:
1. In every campaign, only a few puzzles are available. Every completed puzzle will unlock one more.
2. Wrapping puzzles working ingame.
3. Animate some UI elements (slides in and such) so the game seems more responsive.
4. Add support for daily puzzles. 3 random puzzles will be available every day, which reset at midnight.
5. Try to integrate the 2 main colors to every screen.
6. Pick a better font & write better font management.
7. Add puzzle timing support.
Work done:
Only 3 uncompleted puzzles are available at a time in each campaign.
Wrapping and traditional daily puzzles are working.
Currently trying out a new font. Might have to manually modify the font because numbers look weird.
Each puzzle is timed and the best time is shown on the level select screen.
Doing some experimenting with a third color, it's in a very WIP stage right now.
Started work on animating the win screen.
Milestone 4 (12.04)
Goals:
For milestone 4, at least 5 of the 8 following things will be implemented:
1. More color and UX work
2. A reset button
3. Puzzle rescaling and zooming
4. A subtle background animation
5. Work on animating the win actor
6. Improve the leveling system
7. Start working on IAP support
8. Develop another experimental generator with some other rule
Work done:
Puzzles can be reset in case something goes wrong solving it.
Puzzles can be rescaled to your liking. If the puzzle doesn't fit the screen, it can be scrolled.
A background actor was added that shoots Xs and Os out of bottom left and right corners. The speed and the amount of them can be dynamically changed.
Decided to add a single ingame currency - gems. The player is awarded 2-15 gems per puzzle solved and gems can be used for hints and unlocking new packs and gamemodes. They will also be available for purchasing. I also spent some time discussing how gems and leveling will work along with looking into different in-app currency monetization strategies.
Started working on a new experimental generator with the diagonals rule. The diagonals rule means that there can't be more than 3 of the same in any diagonal. While doing this, some problems with the code started to show up: there are 2 different difficulty levels for general puzzle generation and currently 2 custom rules (wrapping, diagonals) and each variation of these 3 parameters requires a bit different handling of generation. Another problem that has been bugging me is that the generator integrates a puzzle solver but it's not really integratable into the app in the current form, but for the app to support hints, it also needs a solver (along with the ability to return based on which tiles a move was made). As such, I decided to start refactoring the generator + solver so it can be more generalized and used for both generation and the hint system.
Milestone 5 (26.04)
Goals:
For milestone 5, at least 5 of the 8 following things will be implemented:
1. Support for unlocking packs via gems.
2. The background actor with the cannons will be responsive. E.g. there will probably be a mild slow animation for the menus, no animation for the puzzle because it would be distracting other than being near win/winning. Perhaps when there're only like 2-3 tiles left to place, the actor could already start with 10-20 objects and once the puzzle is fully complete, another 100-200 objects are added.
3. Refactor the puzzle generation + solver algorithm as described above.
4. Add more packs and figure out a good way to set the pack prices (in gems) so that the users can't unlock all of the puzzles too easily to drive them towards buying more gems.
5. Refactor puzzle and UI code to be more decoupled in the application. Currently there are some remnants of the old puzzle application which supported multiple puzzles which are no longer necessary.
6. User interface improvements (flow and functionality mainly). E.g. scrollable campaign menu, ninepatch scaling.
7. Currently puzzle scaling is saved per campaign, meaning that if you change the preferred size for a puzzle, it applies to the whole campaign. This should be applied per-width instead of per-campaign basis since I decided that some campaigns will have puzzles with varying sizes and it would make the user have to rescale a lot.
8. Add a new screen to mock possible IAPs.
Work done:
I finished items 1, 2, 5, 6 and 7 and did partial work on 3 and 4.
1. Campaigns/packs can now be unlocked using gems. They can also have a level requirement.
2. The background actor now has a slow mild animation for menus and no animation for the actual puzzle solving except for finishing, which launches 100 high speed particles. I decided not to start the animation prematurely when there are just a few tiles left because there's currently no easy way to guarantee that if the last tiles are filled the solution is actually legit, meaning it could possibly cause premature celebration for invalid solutions.
3. I worked about 2 hours on refactoring the puzzle and the solver but there's still plenty of things to do there and I decided I wanted to work with the UI instead for the rest of the milestone.
4. I decided to refactor the leveling formula and the gem gaining rates. This will hopefully be done by the next milestone.
5 and 6. Next, I reworked almost all puzzle and UI code to decouple them better. Now a puzzle can be drawn and handled anywhere. This will be very useful for implementing an interactive tutorial without having to clutter any of the normal gameplay code with tutorial conditions. Next, I reworked the campaign select, level select and ingame screens to be more coherent. I also decided on how I am going to be using the colors. There are 3 colors and their functions are the following: gold/yellow - important information/things that are not the primary aim for interaction on the user interface, e.g. gem count, user level, where you're in the menus and completed levels and packs (they're still interactable, but just not the main goal of the user anymore); cyan - active UI elements that are interactable and useful (e.g. not completed levels, not completed packs, UI buttons on puzzle screen); magenta - elements that are not interactable and locked - locked packs, levels. These rules do not apply to the actual puzzle grid, there we'll still just use the magenta and cyan combo.
7. This was a relatively easy fix and improved the overall quality of the user experience.
Pictures:
Milestone 6 (10.05)
Goals:
This time I decided to divide the tasks into 2 categories - big and small.
The big tasks are:
1. A working hint system ingame.
2. More traditional packs with better quality puzzles. This requires careful balancing of the pack gem prices and level requirements along with the xp and gems gained from completing the packs.
3. Ingame store.
4. Rework the main menu.
5. Animate all the XP gaining and leveling up in a fancy way.
6. Do thorough performance testing on android.
7. Instead of having a button for rescaling puzzles, make it work with finger pinching and snapping to the puzzle window when the zoom is roughly the size of the puzzle.
8. A working tutorial for the traditional part of the game.
The small tasks are:
1. Add a confirmation modal when resetting a puzzle to prevent accidental resets.
2. Add an informational modal when clicking on a pack that the user doesn't have a high enough level/enough gems for.
3. Show more info for each campaign - e.g. length, total time, description, difficulty.
I will try to finish all the small tasks and at least 4 big tasks along with other possible things that will come up when trying to create an initial finalized version by the end of this course.
Work done:
Sadly not much, since I got sick and missed the milestone :(
Project presentation
Slides: https://docs.google.com/presentation/d/1FaZmnz5A0HFqV3YFj3LL9PGvIsyEe9oW05edl3lBSbA/edit#slide=id.p