Skip to content
Ben Smithers edited this page May 26, 2020 · 14 revisions

Welcome to the MultiHex wiki!

MultiHex Logo. A mountain on a hexagon surrounded by trees rises up into the sky.

The wiki, like the code, is still in its infancy and needs a lot of work. Current progress has been made towards documenting the code in the Core pages. Eventually there will be pages to help ease the process of contributing to the code base and creating your own map types.

Table of Contents

a. Components

  1. Backend
  2. Generator
  3. Guis
  4. Artwork

b. Contributing

Components

Backend

The main components of MultiHex are defined three py files. Core defines the basic datatypes and methods that will be shared by all maps: including the Hexmap datatype itself. It also defines other features that make up the map and landscape itself. The objects python script defines the things placed on a map; it establishes parent classes for things like settlements and creatures on the map. The tools file is a bit more meta. Its classes serve as an intermediary between the datatypes themselves and the guis. The tools are used for making the map and its features, adding objects to the map, and actually drawing the qt5 objects the viewer sees.

Generator

The generator is still pretty early on. It serves to procedurally generate a world so an user can start with a non-empty slate and get right to doing cool things. The procedure follows five steps:

  1. First, create a series of high-points in altitude.

  2. Spread the land down from these high points and then fill in the oceans.

  3. Run the toy weather model to establish rainfall and temperature patterns

  4. Draw rivers from high-points in altitude

  5. Using the combined rainfall, altitude, and temperature change the hex colors and establish Biomes.

See the main Generator page for more details

Guis

The guis folder is for the most part the output from guis designed in Qt Designer (with some modifications). These only establish what's there; they do not establish any connections between the guis and the maps.

Some dialog boxes are established here too.

Artwork

The artwork folder is divided into four categories: buttons, cursors, map icons, and wiki images. MultiHex automatically discovers pngs and svgs that are put in these folders (minus the wiki folder).

Resources and Map Types

Each py file in the map types folder defines a new map type. These files each contain specific versions of the classes defined in Core, Objects, and Tools. Meanwhile, the resources folder contains various... resources... used by the name generator, (soon) the map types' tilesets, and 'texture' files generated by the noise injectors. The texture files are just saved numpy arrays of the gradients used in perlin noise.

Contributing

If you want to start joining the development of MultiHex, feel free to fork the repository and work on one of the features you see in the issues list (or really just any feature you want to see implemented). If you're one of the contributors in this repository, work in a separate branch from master following the naming convention $LastName/$Feature. Once you've implemented the feature, and your branch/fork is stable enough, make a merge request back to master.

Style Guide:

  • Always put as a docstring (with triple quotes) as the beginning of classes and functions.
    This docstring should explain the purpose of the function/class, the arguments it or its constructor require, and any returns it has. As an added bonus, it should mention when the function gets called.
  • Functions should have type-checking and raise exceptions when they encounter unexpected instances (use the isinstance builtin function). Alternatively, you can use some of the functionality implemented in PEP 3107.
  • Generality triumphs! The idea is to be able to generalize the code to support multiple map types and tilesets.
  • Avoid reusing code. Embrace inheritance.
  • Since this is Python3, we use four spaces for an indent. No tab characters.
  • Don't put profanity in committed code; it's unprofessional (this is just a good rule of thumb). If you're having trouble checking, use something like this.
Clone this wiki locally