Skip to content

Commit 9dc6e22

Browse files
Docs: New Guide for adding art/sprites to Stonesense (#5207)
guide for adding art to Stonesense
1 parent 68dd288 commit 9dc6e22

8 files changed

+90
-0
lines changed

docs/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Template for new versions:
6767
- `spectate`: player-set configuration is now stored globally instead of per-fort
6868

6969
## Documentation
70+
- `stonesense-art-guide`: new guide for making sprite art for Stonesense
7071

7172
## API
7273

docs/guides/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ These pages are detailed guides covering DFHack tools.
1010
/docs/guides/modding-guide
1111
/docs/guides/quickfort-library-guide
1212
/docs/guides/quickfort-user-guide
13+
/docs/guides/stonesense-art-guide

docs/guides/stonesense-art-guide.rst

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
.. _stonesense-art-guide:
2+
3+
Stonesense art creation guide
4+
=============================
5+
6+
Understanding isometric perspective
7+
-----------------------------------
8+
9+
Stonesense uses an isometric perspective, a form of pseudo-3D projection where objects are displayed at an
10+
angle, typically with a 2:1 pixel ratio for diagonal lines. This perspective allows for a detailed and visually
11+
appealing representation of a 3D world using 2D sprites. Unlike traditional top-down views, isometric projection
12+
simulates depth while maintaining a consistent scale without vanishing points.
13+
14+
Understanding sprites
15+
---------------------
16+
17+
Understanding how Stonesense deals with sprites is central to anyone who wishes to modify the content. The
18+
scheme is not very complicated, and this guide will give a short introduction to how they work. With the
19+
exception of floors, which we will discuss later, all sprites are 32x32 pixels and come in groups known
20+
as sprite sheets. All sprites are loaded and rendered in 32-bit full-color PNGs. The image files should have
21+
a transparent background but pure magenta (RGB: 255,0,255) is also treated as transparent.
22+
23+
24+
.. image:: ../images/stonesense-sprite-sample.png
25+
:align: left
26+
27+
Here's an example of a typical Stonesense sprite.
28+
29+
When working with Stonesense sprites, it is important to understand how they fit into the isometric grid.
30+
Each sprite is designed to align with the isometric perspective and must fit within a specific bounding area.
31+
To illustrate this, here is a template for the area that should be used by Stonesense sprites:
32+
33+
.. image:: ../images/stonesense-sprite-template.png
34+
:align: left
35+
36+
The solid area is the floor space taken up by a sprite, while the dotted box indicates the volume above this
37+
area corresponding to one z-level.
38+
39+
The way sprites are loaded is fairly generalized: the name of the sprite sheet, and the index of a sprite within that sheet.
40+
41+
Sprite sheets
42+
-------------
43+
There can be an arbitrary number of sprite sheets for Stonesense, though there are 3 sheets that are
44+
always present as they contain default sprites (see further down). Configuring the XML to use new sheets is
45+
outside the scope of this guide but there may be a guide for such added in the future.
46+
47+
Sprite index
48+
------------
49+
The sprite index, or sheet index, is the zero-indexed offset of a sprite on its sprite sheet.
50+
The index starts with the upper left sprite which has index zero. It then increments to the right. Stonesense
51+
is hardcoded to 20 sprite-wide sheets, this means that anything past 20 "sprite slots" is ignored, though less
52+
than 20 slots is fine. The first sprite on the second row always has index 20 (even if there are fewer sprites per row in the sheet), the next row is 40, and so on. This
53+
boundary is hardcoded and changing the size of the sheet will not affect it.
54+
55+
This image shows how sprites are indexed. Grid added for readability.
56+
57+
.. figure:: ../images/stonesense-indexed-sprites.png
58+
:align: left
59+
60+
61+
Important sprite sheets
62+
-----------------------
63+
`objects.png <https://github.com/DFHack/stonesense/blob/master/resources/objects.png>`_ is the default sheet
64+
for buildings and vegetation. Also used for all hard-coded content, like default plants, the cursor, default
65+
walls and liquid.
66+
67+
`creatures.png <https://github.com/DFHack/stonesense/blob/master/resources/creatures.png>`_ is the default
68+
sprite sheet for creatures. If no file is specified in a creature node, this is the sheet it will use.
69+
70+
`floors.png <https://github.com/DFHack/stonesense/blob/master/resources/floors.png>`_ holds all the Stonesense
71+
floors. Unlike the other sprite sheet, this sheet is hard-coded with sprite dimensions of 32x20 pixels.
10 KB
Loading
694 Bytes
Loading
515 Bytes
Loading
174 KB
Loading

docs/plugins/stonesense.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,27 @@ line containing that folder, or :dffd:`use these smaller sprites <6096>`.
7878
Stonesense requires working graphics acceleration, and we recommend
7979
at least a dual core CPU to avoid slowing down your game of DF.
8080

81+
Yellow cubes and missing sprites
82+
--------------------------------
83+
If you are seeing yellow cubes in Stonesense, then there is something on the map that
84+
Stonesense does not have a sprite for.
85+
86+
.. figure:: ../images/stonesense-yellowcubes.png
87+
:align: center
88+
89+
An example of the yellow cubes.
90+
91+
If you would like to help us in fixing this, there are two things you can do:
92+
93+
* Make an issue on `GitHub <https://github.com/DFHack/stonesense/issues>`_ with what
94+
item is missing and pictures of what it looks like in DF.
95+
* Create the art yourself. For help with this, please see the `stonesense-art-guide`.
96+
8197
Useful links
8298
------------
8399
- Report issues on `Github <https://github.com/DFHack/stonesense/issues>`_
84100
- `support`
101+
- `Stonesense Subreddit <https://www.reddit.com/r/stonesense/>`_
85102
- :forums:`Official Stonesense thread <106497>`
86103
- :forums:`Screenshots thread <48172>`
87104
- :wiki:`Main wiki page <Utility:Stonesense>`

0 commit comments

Comments
 (0)