Skip to content

Latest commit

 

History

History
55 lines (36 loc) · 3.55 KB

RogueCloudHowToAddRoomsToTheMap.md

File metadata and controls

55 lines (36 loc) · 3.55 KB

How to add new rooms to the map

As noted in the room file format doc (see link below), a "room" in the context of Rogue Cloud does not necessarily need to be a room (it is a bit of a misnomer) but rather, it corresponds to a cookie cutter structure (a grid of tiles) that can be stamped onto the map at any map coordinate.

How the Rogue Cloud game map is created:

  1. Rooms are defined in rooms.txt
  2. Rooms are mapped to specific RGB colours in the rooms mapping file, map-new-mappings.txt.
  3. Where to place those rooms is defined in the map-new.png file, with the RGB colours from step 2 indicating where to place rooms on the map.
  4. A CLI tool converts the map-new.png file, and the room mappings file, into a fully rendered map map-new.txt, which is what the game server reads on startup.

The Rogue Cloud map is defined in (path to git repository root)/RogueCloudServer/WebContent/universe/map-new.txt. This file is automatically generated by the map generation tools included with Rogue Cloud. This file should not be edited directly; instead you should follow the process below to modify and generate it.

Follow these steps:

1) Git clone the repository and run the following commands

git clone https://github.com/codewind-resources/rogue-cloud
cd rogue-cloud
mvn clean package

2) Create a new room in rooms.txt

  • The rooms.txt file can be found in (path to git repository root)/RogueCloudServer/WebContent/universe/rooms.txt

The format of the rooms.txt is described here: https://github.com/codewind-resources/rogue-cloud/blob/master/docs/RogueCloudRoomsFileFormat.md

3) Once you have created a room, add it to the room mappings file.

Open the map-new-mappings.txt file in the same directory as above. Each line in this file assigns a room to letter and a colour.

Here is an example of a mapping:

  • g a0a0a0 Graveyard
  • eg: (letter) (colour in hex) (room name)

The room name should match the room name that you specified in the rooms.txt file. The colour and letter should be unique, and can be anything, as long as no other lines use those same values.

4) Now you need to place that room at various coordinates on the world map.

The position that each room is displayed on the map, is determined by the map-new.png file.

Each colour on the map (corresponding to colours listed in the map-new-mappings.txt file) indicates the specific coordinate to display the room with that colour. So for example, if there is a rectangle whose top left corner is at position (100, 200) in the .png file, and the colour of the rectangle is a0a0a0 (24-bit hex colour), then a Graveyard will be drawn to the map txt file at that coordinate.

Recommendation: While not technically necessary, I highly suggest that when you are adding rooms to the map, that you make the coloured rectangle correspond to the size of the room.

  • For example, if your room is 10x5 (WxH), then create an empty rectangle (ie non-filled rectangle) that is 10x5 at your desired location in the PNG

5) Render your changes to see how they look:

  • Run StandaloneWorldRender to see the result
    • cd (path to your git install)/RogueCloudUtilitiesCLI/target
    • java -jar RogueCloudUtilitiesCLI-0.0.1-SNAPSHOT.jar (path to git repository root)/RogueCloudServer/WebContent/universe "x coord" "y coord" "width" "height"
    • Example: java -jar RogueCloudUtilitiesCLI-0.0.1-SNAPSHOT.jar C:\Rogue-Cloud\Git\RogueCloudServer\WebContent\universe\ 0 0 100 100
    • See the generated image file: (path to git repository root)/RogueCloudServer/WebContent/universe/preview.png