Skip to content

Commit

Permalink
Release 1.0
Browse files Browse the repository at this point in the history
* Structure and README update.

* README update.

* Docs WIP.

* Docs WIP.

* Textures docs.

* Fields docs.

* Farmlands doc.

* Step by step.

* Step by step.

* Convert image to obj.

* README update.
  • Loading branch information
iwatkot authored Dec 11, 2024
1 parent 08cfe85 commit 4c1610a
Show file tree
Hide file tree
Showing 14 changed files with 650 additions and 28 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
<p align="center">
<a href="#Quick-Start">Quick Start</a> •
<a href="#Overview">Overview</a> •
<a href="#How-To-Run">How-To-Run</a> •
<a href="#Step-by-step">Create a map in 10 steps</a> •
<a href="#How-To-Run">How-To-Run</a><br>
<a href="docs/FAQ.md">FAQ</a> •
<a href="docs/map_structure.md">Map Structure</a> •
<a href="#Modder-Toolbox">Modder Toolbox</a><br>
<a href="#Supported-objects">Supported objects</a> •
<a href="#Generation-info">Generation info</a> •
Expand Down Expand Up @@ -104,6 +106,9 @@ Parameters:
- coordinates: 45.15, 19.71
- size: 16 x 16 km

## Step by step
Don't know where to start? Don't worry, just follow this [step-by-step guide](docs/step_by_step.md) to create your first map in 10 simple steps.<br>

## How-To-Run

You'll find detailed instructions on how to run the project below. But if you prefer video tutorials, here's one for you:
Expand Down Expand Up @@ -180,12 +185,15 @@ The map will be saved in the `map_directory` directory.
## Modder Toolbox
The tool now has a Modder Toolbox, which is a set of tools to help you with various tasks. You can open the toolbox by switching to the `🧰 Modder Toolbox` tab in the StreamLit app.<br>

![Modder Toolbox](https://github.com/user-attachments/assets/18f169e9-1a5b-474c-b488-6becfffadcea)
![Modder Toolbox](https://github.com/user-attachments/assets/dffb252f-f5c0-4021-9d45-31e5bccc0d9b)

### Tool categories
Tools are divided into categories, which are listed below.
#### Textures and DEM
- **GeoTIFF windowing** - allows you to upload your GeoTIFF file and select the region of interest to extract it from the image.
- **GeoTIFF windowing** - allows you to upload your GeoTIFF file and select the region of interest to extract it from the image. It's useful when you have high-resolution DEM data and want to create the height map using it.

#### Background terrain
- **Convert image to obj model** - allows you to convert the image to the obj model. You can use this tool to create the background terrain for your map. It can be extremely useful if you have access to the sources of high-resolution DEM data and want to create the background terrain using it.

## Supported objects
The project is based on the [OpenStreetMap](https://www.openstreetmap.org/) data. So, refer to [this page](https://wiki.openstreetmap.org/wiki/Map_Features) to understand the list below.
Expand Down Expand Up @@ -354,7 +362,7 @@ Let's have a closer look at the fields:

## Background terrain
The tool now supports the generation of the background terrain. If you don't know what it is, here's a brief explanation. The background terrain is the world around the map. It's important to create it, because if you don't, the map will look like it's floating in the void. The background terrain is a simple plane which can (and should) be texture to look fine.<br>
So, the tool generates the background terrain in the form of the 8 tiles, which surround the map. The tiles are named as the cardinal points, e.g. "N", "NE", "E" and so on. All those tiles will be saved in the `objects/tiles` directory with corresponding names: `N.obj`, `NE.obj`, `E.obj` and so on.<br>
So, the tool generates the background terrain in the form of the 8 tiles, which surround the map. The tiles are named as the cardinal points, e.g. "N", "NE", "E" and so on. All those tiles will be saved in the `background` directory with corresponding names: `N.obj`, `NE.obj`, `E.obj` and so on.<br>
If you don't want to work with separate tiles, the tool also generates the `FULL.obj` file, which includes everything around the map and the map itself. It may be a convinient approach to work with one file, one texture and then just cut the map from it.<br>

![Complete background terrain in Blender](https://github.com/user-attachments/assets/7266b8f1-bfa2-4c14-a740-1c84b1030a66)
Expand Down
26 changes: 26 additions & 0 deletions docs/farmlands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Farmlands

It's a pretty simple component of the map, but it's also one of the most important. If you do not define the farmlands InfoLayer in Giants Editor, you will not be able to buy any land in the game. But, lucky for us, it's simple and straightforward to set up.

### Setting up the Farmlands InfoLayer

In the Giants Editor enable the `Terrain Info Layer Paint Mode` tool [1], then select the **farmlands** in the **Info Layer** selector [2]. Now you can choose the actual farmland number [3] and paint it on the map.
Remember, that if you did not paint some region by any farmland, it will not be possible to buy it in game. You can left those for regions that are not supposed to be bought by the player (city, forest, etc.).

![Drawing farmlands in the Giants Editor](https://github.com/user-attachments/assets/f16f172d-6a6c-4026-97a1-a1f59149a62c)

After painting the farmlands and saving the file, you need to edit the `config/farmlands.xml` file to match the farmlands you painted in the editor.

### Editing the farmlands.xml
You'll find the `farmlands.xml` file in the `config` directory of your map. Open it in a text editor and add the farmlands you painted in the editor. The file should look like this:

```xml
<farmlands infoLayer="farmlands" pricePerHa="60000">
<farmland id="1" priceScale="1" npcName="FORESTER" />
<farmland id="2" priceScale="1" npcName="GRANDPA" />
</farmlands>
```

So, the keys here are kinda obvious, if you want to change the global price for the lands, you can do it in the `pricePerHa` attribute. The `farmland` tag contains the information about the lands. The `id` attribute is the ID of the land, the `priceScale` is the multiplier for the price of the land, and the `npcName` is the name of the NPC who owns the land.

After drawing the farmlands in the Giants Editor and editing the `farmlands.xml` file, you should be able to buy the lands in the game.
16 changes: 16 additions & 0 deletions docs/fields.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Fields

I guess you know what a field is. It's where we actually grow and harvest our crops. Important note: it's not mandatory to add fields in Giants Editor, since it's possible for player to create a field in game. But it would be much more convenient to create fields while working in your mod.
And the coolest thing: the generator already created everything for you! Just one click and all the fields will be shown on the map.

### Where the fields come from?

Before we dive into details, let's talk about the source of the fields. The data for adding everything to your map (including fields) comes from the [OpenStreetMap](https://www.openstreetmap.org/). So, it may happen that something is missing or incorrect. In this case, it's recommended to go to OSM by yourself and fix the issue. It's very simple, and you can do it without any special knowledge. You'll find more information about it in the [FAQ](https://github.com/iwatkot/maps4fs/blob/main/docs/FAQ.md) section of the docs.

### How to add fields to the map?
The generator will automatically create all the required nodes in the `map.i3d` file, so you need only to open the map in Giants Editor, go to **Scripts** -> **Shared scripts** -> **Map** -> **Farmland fields** -> **Field toolkit** and click on the **Repaint all fields** button.
After it all the fields should appear on the map. Note: due to different geometries in OSM data, some fields may not appear if they were defined as multipolygons. In this case, you need to create them manually.

![PolygonPoints](https://github.com/user-attachments/assets/ae49761d-aee5-4879-9531-b4522ac55cc2)

To add a new field click on the **Create field** button in the toolkit. A new field will appear at the center of **fields** TransformGroup. Now all you need to do is place the **PolygonPoints** on the correct positions on the map, and after it click on the **Repaint selected field** button.
Loading

0 comments on commit 4c1610a

Please sign in to comment.