Given: As a PHP Class:
Given: As follows are the rules governing 3D Map Generatiom for the game Sparked:
Given: All randomized rolls should use the Mulberry32 PRNG with an integer or text-based Seed.
1.
Given: Maps are made of cubes with axis: y, x, z for Height, Width, Depth as selected at random.
Given: Maps are initially solid Cast: "Barrier", Sprite: "Big/Mine Wall", Water: false.
Given: Rooms and Corridors are created using subtractive carving.
2.
Given: Map Boundary Buffer is the set of cubes touching the edges of the map.
Given: Room Boundary Buffer is the set of cubes touching the edges of the room.
Given: Maximum amount of room attemtps is 500.
Given: Room Min/Max Area per Dimension Permutation.
Given: Room Min/Max Volume.
Given: Room Min/Max Position/Span Enclosed by Map Boundary Buffer per Dimension as selected at random.
3.
Given: If the current generated room overlaps any pre-existing room, skip and undergo the next attempt.
Given: If the current generated room is not adjacent to any pre-existing room, skip and undergo the next attempt.
Given: Carve the volume of the current room as Cast: "Passage", Sprite: "Big/Mine Passage".
Given: Cross-sections should be placed anywhere enclosed by Room Boundary Buffer, one per room, per any random selection of dimensional combination.
Given: If a carved 1D cross-section is vertical, use Cast: "Ladder", Sprite: "Big/Mine Ladder".
Given: If a carved 1D cross-section is lateral, use Cast: "Passage", Sprite: "Big/Mine Wall Base".
Given: If a carved 2D cross-section is at all vertical, use Cast: "Ladder", Sprite: "Big/Mine Ladder".
Given: If a carved 2D cross-section is purely lateral, use Cast: "Passage", Sprite: "Big/Mine Wall Base".
Given: Carve a singe-cube-thick 1D cross-section of the current room as selected at random.
Given: Carve a singe-cube-thick 2D cross-section of the current room as selected at random.
Given: Carve a singe-cube-thick 1D corridor joining any nearby other room to the current room as Cast: "Passage", Sprite: "Big/Mine Passage" as selected at random.
Given: Carve a singe-cube-thick 2D corridor joining any nearby other room to the current room as Cast: "Passage", Sprite: "Big/Mine Passage" as selected at random.
4.
Given: Powerups are as follows: "Big/Energy Powerup", "Big/Bomb Powerup", "Big/Shield Powerup", "Big/Jetfuel".
Given: Boobytraps are as follows: "Big/Sea Mine", "Big/Crate (Dim)".
Given: Anywhere between 1 and 3 Powerups should be sprinkled at random per Room.
Given: Anywhere between 0 and 2 Boobytraps should be sprinkled at random per Room.
5.
Given: For any Room that has a lateral basin of which its entire lower volume does not touch any other Passage, set Water: true.
6.
Given: Now return the resulting map as a json file.