Code Monkey home page Code Monkey logo

blockspuzzlegame's Introduction

Blocks Puzzle Game

Unity Version: 2020.3.15f2

Target Platform: Android

Levels Format: JSON

In this game, all the levels are created by the Procuderal Level Creation Algorithm that we give their inputs.

AlgorithmVisually.mov

My Procedural Level Generating Algorithm

The purpose of this algorithm is create Playable Block puzzle game levels with take only three inputs.

Inputs
● Block Count
● Grid size
● Toggle for whether to add Triangle or not.

Step 1
In the first step, I choose random cell on the grid as much as the number of blocks. Then I place the first parts of our blocks in those cells. While doing this, I check and pay attention to whether we have selected the same cell.

Step 2
In the second step, I try to find as many neighbors as the random value I get for each block type between 0 and (Grid size x Grid Size / Block Count). I add new block parts of that block type to the cells I can find.

Step 3
In the third step, I check if there is any empty cell on the grid after the second step. If there is a empty cell, I repeat the second step.

Step 4
In the fourth step, if triangle pieces are to be added to the puzzle, I identify the positions where these triangles will be added and then adding the triangles. When adding triangles, I first choose a random cell. If the block in that cell is suitable for our conditions, I make that cell a triangle.

Our Conditions;

● All blocks on up, down, right and left are cant be same type with selected cell
● If the right and left of the selected block part are of the same type, the direction of the triangle can be up or down.
● If the up and down of the selected block part are the same type, the direction of the triangle can be to the right or to the left.
● The block in the opposite direction of the triangle should be of the same type as the block part we will make it triangle.

If all conditions are met, I make that block an Outward triangle. I add another block part for the cell we will make a triangle to the other type of block in the direction of the triangle and make this part an Inward triangle.

The algorithm is at “LevelCreatorObjects.cs” and it is calling from editor script “LevelCreatorEditor.cs”.

Editor Tool Usage Video

LevelEditorUsage.mp4

Gameplay Video

BlocksPuzzleGameplayVideo.mp4

blockspuzzlegame's People

Contributors

batuhanh avatar

Stargazers

 avatar  avatar Batt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.