Skip to content

Using P5.JS to visulise a game room. given a compressed version of the room.

Notifications You must be signed in to change notification settings

OQ2000/Visulisation-Of-Large-Data

Repository files navigation

Compression Algorithm / Visulisation Of Large Data

Example image

Project Overview:

The Game Idea: the player would navigate through a level that would consist of 2 or more rooms, each room would be a sqaure and therefore have a possibility of 4 different pathways from each room.

Example of 5 x 5 Level:

Example of 5 by 5

The level would have a start and finish where the player would then complete that level. The levels should be randomly generated and always have a start and finish that are connected by atleast 1 route.

Example of 5 by 5 With Route

Visulisation:

My Visualisation Script:
P5.JS Sketch
Level Codes

The need to visulise these levels arose when creating these strings, as they were hard to visulise from looking at the directions given in the strings.

Compression:

Basics of an Uncompressed level string:

Path Directions Width Height
SE,SE,SE,E,NE,SE,E,W,S,NE,SE,E,W,W,NW S,NS,E,W,NW,W,N,S,W,NW ,05 ,05

Basics of an Compressed level string:

Width Path Directions Height
5 EEECGECDBGECDDHBICDHDABDH 5

Uncompressed code = SE,SE,SE,E,NE,SE,E,W,S,NE,SE,E,W,W,NW S,NS,E,W,NW,W,N,S,W,NW,05,05

Compressed code = 5EEECGECDBGECDDHBICDHDABDH5

Compressing Reduction %:

Basics of our compression algorithm 1 room can have 4 possible paths connected, this gives a possibility of 256 connections that 1 room can have.

The program that was responsible for generating the level codes was adapted to generate a number of levels and giving feedback on the percentage of how often any given possibility shows up.

possible outcomes

From this data we were able to identify the most common combinations of paths and from these, assign these combinations to letters ranging from A-O For example: a level code contains a room with NW meaning that this room has a path on the North and West face, this combination would be reduced to just H.

Example : Uncompressed code = SE,SE,SE,E,NE,SE,E,W,S,NE,SE,E,W,W,NW S,NS,E,W,NW,W,N,S,W,NW,05,05

Compressed code = 5EEECGECDBGECDDHBICDHDABDH5

"A" - "N"
"B" - "S"
"C" - "E"
"D" - "W"
"E" - "SE"
"F" - "SW"
"G" - "NE"
"H" - "NW"
"I" - "NS"
"J" - "EW"
"K" - "SEW"
"L" - "NEW"
"M" - "NSW"
"N" - "NSE"
"O" - "NSEW"

Reduction

For a 5 x 5 level 11.5 Characters were reduced or 29.3% Reducing the "," --- 34 Characters were reduced or 55.7% For a 10 x 10 level 30 Characters were reduced or 22.1% Reducing the "," --- 140 Characters were reduced or 57.3% For a 50 x 50 level 817 Characters were reduced or 24.5% Reducing the "," --- 3322 Characters were reduced or 57.0%

About

Using P5.JS to visulise a game room. given a compressed version of the room.

Resources

Stars

Watchers

Forks