Repository
https://github.com/ajayyy/CunctansSquare
What is this?
Cunctan's Square is a turn based puzzle game where you must move your player to the end without being hit by the enemies.
However, the world closes in on itself each time you move. This gives you less space to move and eliminates certain paths to the exit.
Technology Stack
This game is written in Java with Lib-GDX. Lib-GDX is a an open source library that uses LWJGL and allows you to make a game in Java that supports Windows, Mac, Linux, HTML5, Android, and even iOS. The post processing effects are created using libgdx-contribs.
Features
Path generation
Each turn the player takes, one block is removed from the field. If this block was completely random, then the player would just get blocked from being able to access the finish.
To solve this, the program calculates a path from the player's current position, and makes sure to exclude those from the tiles that get destroyed.
Edges
Having pieces disappear from the middle of the area felt really weird, and did not have the same sense of claustrophobia as destroying blocks from the outside in.
To solve this, only edge blocks are destroyed.
public ArrayList<Block> findEdgeBlocks(ArrayList<Block> blocks){
ArrayList<Block> edgeBlocks = new ArrayList<Block>();
for(Block block : new ArrayList<Block>(blocks)) {
ArrayList<Block> surroundingBlocks = new ArrayList<Block>();
surroundingBlocks.add(getBlock(block.x + 1, block.y));
surroundingBlocks.add(getBlock(block.x - 1, block.y));
surroundingBlocks.add(getBlock(block.x, block.y + 1));
surroundingBlocks.add(getBlock(block.x, block.y - 1));
boolean edgeBlock = true;
//if true, this cannot be an edge piece
boolean noNull = true;
for (Block surroundingBlock : surroundingBlocks) {
if(surroundingBlock == null) {
noNull = false;
}
}
if (!noNull) {
ArrayList<Block> otherBlocks = new ArrayList<Block>(this.blocks);
otherBlocks.remove(block);
for (Block surroundingBlock : surroundingBlocks) {
if (surroundingBlock != null) {
ArrayList<Vector2> path = allPaths.get(surroundingBlock);
if ((path != null && vectorListContainsAny(path, lastDestroyedBlocks)) || !allPaths.containsKey(surroundingBlock)) {
path = findPath(surroundingBlock.x, surroundingBlock.y, levelConfig.endX, levelConfig.endY, otherBlocks);
allPaths.put(surroundingBlock, path);
}
if(path == null) {
edgeBlock = false;
break;
}
}
}
if(edgeBlock) {
edgeBlocks.add(block);
}
}
}
return edgeBlocks;
}
A block is considered an edge block if, when removed, it does not block the path of the surrounding blocks to the target. Also, if there all the surrounding blocks are actual blocks, it cannot be an edge piece, no matter what.
Optimizations
Threading
These calculations are very costly and can make a turn take up to 5 seconds to complete. To solve this, the calculations are done before hand in a separate thread to prepare for when the user is ready to move.
HTML5
Javascript does not support threading, so other solutions have to be used to fix the load times as well
Do not repeat calculations
To prevent repeating calculations, you can check if the path included one of the previously destroyed blocks, because otherwise nothing has changed,
if (vectorListContainsAny(path, lastDestroyedBlocks))) {
//redo calculations
}
Commits
https://github.com/ajayyy/CunctansSquare/commits/master
https://github.com/ajayyy/CunctansSquare/commits/html5-no-threading
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Yes.
The third party libraries are not included in the repository. They are imported using eclipse.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you for your review, @helo!
So far this week you've reviewed 2 contributions. Keep up the good work!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Very cool @ajayyy! I've always been very interested in game development, but never got around to actually creating something... seeing stuff like this makes me want to get off my arse and actually do it for once. I also love Ludum Dare - watched quite a few postmortem videos of developers and also like to watch quill18 live stream it whenever I have the opportunity. It really seems like something unique that I would like to participate in. How was it for you and was it your first time?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I really enjoy Ludum Dare. This was not my first Ludum Dare, I've actually been doing every one since August 2014.
Ludum Dare was probably one of the most influential things for me as it forced me to create something at least 3 times a year and has always made me be able to brute-force fun game ideas (after "testing" it during Ludum Dare, I can see if I am have fun working with that idea).
This Ludum Dare was very different for me because I was at a camp with little internet access the first day of the event, and in a car for 4 hours coming back. I luckily was able to get myself to continue working while at the camp. Because of that, in this Ludum Dare, I only focused on making the actual game, and not extra stuff like sound effects or music.
I feel that setting a distinct time limit is super useful for motivating you to keep working, because you know when you get to take a break. I later discovered the same thing happened when working on programming projects for school. The time limit really helps me.
I have tried to take this info into my other projects as well now, and with Utopian. I now try to set a goal of features I need to complete in the next 1.5 weeks, and this has really helped me.
What's the most important thing about Ludum Dare though, is the playing and rating time. When you rate and give feedback on one game, your "coolness" score goes up. This score is then used when sorting the front page (minus the ratings you have received). This makes you get around a 1:1 ratio of ratings and feedback back from what you give out.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
This game looks interesting. I will try it out.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey @ajayyy
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Really interesting
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hmmm good
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit