ezian / hex-chronicle Goto Github PK
View Code? Open in Web Editor NEWAn hex-map generator for exploration sand-box RPG
License: MIT License
An hex-map generator for exploration sand-box RPG
License: MIT License
shapely.Polygon.svg() allow to draw polygon in SVG.
Instead of using template, we should rely on this method, because it will fix issue with zone with hole.
svg()
methodsvg()
method<path fill-rule="evenodd" fill="#66cc99" stroke="#555555" stroke-width="2.0" opacity="0.6"
d="M 90.0,259.8076211353316 L 120.0,207.84609690826528 L 100.0,173.20508075688775 L 50.0,259.8076211353316 L 90.0,259.8076211353316 z" />
If I click on an hex in the gird, and if this hex has been generated from a .md file, open a link.
By default, open the file itself.
Possibility to add a link somewhere to make it compatible with Hugo or any static site generator.
When the mouse hover over an hex, open a tooltip which contains some information:
Package the code in a docker container to be more easily used.
Icons are retrieved from svg_templates/icons. Icon file are selected through metadata in the hex file (the metadata value has to match with at least one icon file).
Allow to pass in command line others directory of icons, which will be fetched to get other icon.
These directories will be fetched before "default" existing directory to retrieve icons. If there is no match, we will still check the default icons.
Users will be allowed to use alternative icon set (by using the same names of existing one), are have new icons (by adding icons with different names)
Optimization of the way the terrain is draw:
These optimization may be complicated, but will reduce the size of the SVG AND allow beautiful effect in CSS... Or at least remove ugly artifacts.
I reviewed usages of self.grid in Hexagon. These are the usages of self.grid:
We have 3 values used by Hexagon from HexagonGrid :
For me :
Originally posted by @pchesneau in #12 (comment)
The main goal of this issue is to optimize the grid and reduce the size of the SVG file.
Current lead to this goal:
<def>
then duplicate through xlink + transform (see [http://thenewcode.com/1102/Cloning-SVG-Elements-Using-use])a revoir lorsque shapely/shapely#110 sera résolu (pas tout de suite :D)
Originally posted by @pchesneau in #22 (comment)
Allow icon from terrain.
The default icon set for terrain is already on the repository, in svg_templates/icons/terrain.
IF a field icon
is set in the hex metada with the value <value_icon>
AND an icon file named <value_icon>.svg
exists in svg_templates/icons/building
THEN the svg icon in the file is drawed at the top of the hex
IF a field icon
is set in the hex metada with the value <value_icon>
AND an icon file named <value_icon>.svg
exists in svg_templates/icons/building
THEN the svg icon in the file <value_icon>.svg
is drawed at the top of the hex
**ELSE IF ** a field terrain.type
is set in the hex metada with the value <value_terrain_type>
AND an icon file named <value_terrain_type>.svg
exists in [svg_templates/icons/terrain]
THEN the svg icon in the file <value_terrain_type>.svg
is drawed at the top of the hex
(In english: the terrain icon is drawed if it exists and if there is no building icon that are already required to draw)
Allow to have hexes files with the pattern -XX-YY-somthing.md
.
Allowing this pattern is trivial, but the actual compute of the grid contains a bug which botches with negative row or column.
Only the polygons defined through a specific XXYY-something.md
file will be rendered. It can be painful to define large map with almost nothing.
Allow user to passe several yaml files which contains description of tiles without MD parts.
Each yaml files can contains several parts splitted as yaml specification (--- characters) and contains a map of values indexed by a string on the "XXYY" format.
Since Yaml can be inlined, it could be easy to quickly define simple hexagons, with full support of all feature, even future one.
Example:
# Careful: 0XXX in YAML spec is an octal number. To avoid confusion, we need to put XXYY coordinates between quotes.
"0705": {"terrain": {"type": "grassland", "mixed":[{"type": "sea", "sides":["NO","SO","NE"}], "roads": ["c SE"], "icon": "fortin", "alt":"Fortin"}
"0806": {"terrain": {"type": "grassland", "mixed":[{"type": "sea", "sides":["N","NE","SE"}], "roads": ["NO NE", "NO S"], "rivers": ["N S", "N SO", "N SE"]}
Above yaml will be equivalent to:
# File 0705-something.md
---
terrain:
type: grassland
mixed:
- type: sea
sides:
- NO
- SO
- NE
roads:
- c SE
icon: fortin
alt: Fortin
---
# File 0806-something.md
---
terrain:
type: grassland
mixed:
- type: sea
sides:
- N
- NE
- SE
- type: plains:
sides:
- S
roads:
- NO NE
- NO S
rivers:
- N S
- N SO
- N SE
---
---
terrain:
type: grassland
mixed:
- type: lake
sides:
- NO
---
In this case, script will fails and the map won't be generated
Retained solution is to use english cardinal direction (West instead of Ouest). NO
will be no more an issue.
But in order to don't require a major update (it's kind of early to update the major version), we shouldn't introduce breaking changes. So Old way to write cardinal should be accepted, but deprecated (generate an error message, but handle it).
In Oltréé !, the RPG that has inspired this tools, it is possible to "secure" some hex.
In order to be the most generic, we want to have the concept of "zone" embedded in this tools.
A zone is a group of hexagon that are bound together.
A zone is drawed at the top of the grid, and contains full hexes.
If two hexes are contiguous and in the same zone, the zone is drawed around them, like in the image below:
A zone is defined as a new field in the file metadata:
zone: secured
It should also have a definition as a class in CSS. In the scope of this issue, we will only define one zone: secured
(above css is more for example, I am not a css pro, and I don't have a really good taste in terms of UI design ^^)
.secured {
stroke: green;
stroke-dasharray: 8
fill: greenyellow;
fill-opacity: 30%;
}
User will be able to add more zone by using custom CSS feature.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.