Maximum Bash.

Maximum Bash is a Bullet Hell project with a SciFi theme. It's a game in which you face ever stronger opponents destroyed, collect points and look for the exit to the next level. The map is created by a random generator, which, however errors arise in the map.
This prompted me to write a script (see right) which gave artists the ability to admit these erroneous patterns identify and automatically replace with a desired pattern.



Artist and designer had the opportunity to draw through these patterns to create and save.
(no programming knowledge required, is saved in a CSV).

I got the idea of ​​how this script should work after watching a video that explained how a blur effect works for photos.

My tasks:

-Gameplay Programmierer: Enemy K.I., door system.

-System Designer: A way designed to give Artists a way to perform certain Find patterns in the map and exchange them with others and eliminate errors, database queries Opponent strength for higher levels.

-System: An online database created and a way to program it too queried becomes.

Download Link: Maximum Bash

Direkt auf dieser Website spielen: Maximum Bash

using NaughtyAttributes;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu]
public class Kernel : ScriptableObject
{				
	int[,] map;
	int[,] replacementPattern;
	int[,] pattern;
	Dictionary patterns = new Dictionary();
	Dictionary replacmentPatterns = new Dictionary();

	[ShowNonSerializedField]
	int row, column;

	string patternName;

	[BoxGroup("File Input")]
	[SerializeField] protected TextAsset cSV;

	/// 
	/// Function to Restructure map arrays the function returns the map array after it checked every grid
	/// 
	///  array from the generator
	/// returns the map array
	public int[,] RestructureMap(int[,] map)
	{
		this.map = map;
		CSVReader();
		foreach (string key in patterns.Keys)
		{
			pattern = patterns[key];
			replacementPattern = replacmentPatterns[key];
			row = pattern.GetLength(0);
			column = pattern.GetLength(1);
			ReNumberMap();
		}
		return this.map;
	}

	/// 
	/// The map array will be checked with a grid if the numbers equals the grid numbers. 
	/// When they are the same the numbers in the map array will be changed to the numbers in the partmap array
	/// 
	void ReNumberMap()
	{
		for (int y = 0; y < map.GetLength(1); y++)
		{
			for (int x = 0; x < map.GetLength(0); x++)
			{
				bool IsEqual = false;
				for (int checkY = 0; checkY < column; checkY++)
				{
					for (int checkX = 0; checkX < row; checkX++)
					{
						if (map.GetLength(0) > x + checkX && map.GetLength(1) > y + checkY)
						{
							if (map[x + checkX, y + checkY] == pattern[checkX, checkY])
							{
								IsEqual = true;
							}
							else
							{
								IsEqual = false;
								break;
							}
						}
						else
						{
							IsEqual = false;
							break;
						}
					}
					if (!IsEqual)
					{
						break;
					}
					else if (IsEqual && column == checkY + 1)
					{
						for (int replaceY = 0; replaceY < column; replaceY++)
						{
							for (int replaceX = 0; replaceX < row; replaceX++)
							{
								if (map[x + replaceX, y + replaceY] != replacementPattern[replaceX, replaceY])
								{
									map[x + replaceX, y + replaceY] = replacementPattern[replaceX, replaceY];
								}
							}
						}
					}
				}
			}
		}
	}

	/// 
	/// Read the CSV Data and get the rules for the partcheck and partmap arrays
	/// 
	void CSVReader()
	{
		//Save all the lines in a array
		string[] lines = cSV.text.Split("\n"[0]);
		//We check in which level we are and adding the new stats to the enemy
		int index = 0;
		for (int i = 0; i < lines.Length; i++)
		{
			if (index == 0)
			{
				string[] parts = lines[i].Split(","[0]);
				patternName = parts[0];
				index++;
			}
			else if (index == 1)
			{
				string[] parts = lines[i].Split(","[0]);
				row = int.Parse(parts[0]);
				column = int.Parse(parts[1]);
				replacementPattern = new int[row, column];
				pattern = new int[row, column];
				index++;
			}
			else if (index > 1 && index <= row + 1)
			{
				string[] parts = lines[i].Split(","[0]);

				for (int j = 0; j < column; j++)
				{
					pattern[index - 2, j] = int.Parse(parts[j]);
				}
				index++;
			}
			else if (index > row + 1 && index <= (row + row + 1))
			{
				string[] parts = lines[i].Split(","[0]);

				for (int j = 0; j < column; j++)
				{
					replacementPattern[index - row - 2, j] = int.Parse(parts[j]);
				}
				index++;
			}
			else if (index > (row + row + 1))
			{
				index = 0;
				if (!patterns.ContainsKey(patternName))
				{
					patterns.Add(patternName, pattern);
				}
				if (!replacmentPatterns.ContainsKey(patternName))
				{
					replacmentPatterns.Add(patternName, replacementPattern);
				}
			}
		}
	}
}