Idea to remove the limits of the current terrain system

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
Post Reply
SkeletonCrew
Inactive Developer
Posts: 787
Joined: March 31st, 2006, 6:55 am

Idea to remove the limits of the current terrain system

Post by SkeletonCrew »

Hi,

I’ve been lurking around here for a while and have seen many threads
about changing the terrain system, because the number of available
letters/signs is running out. Just a few hours ago something popped into
my mind. I gave it some more thinking and here is the idea.
It tries to solve the following problems
- Being backwards compatible
- Having unlimited possible terrains
- Don’t change the system of 1 letter for a terrain in a map

Note: I don’t have the time to develop this, but it’s an idea how it can
be done since that seems to be a problem at the moment.

All terrains are now a letter, first this would change to a number internally.
The numbers for the current terrains could be their ascii value in order to
keep it simple. Alternative would be to use ranges for the terrain type eg
10000 - 19999 = villages
20000 – 29999 = hills

Then there would be a new WML tag called map_translation which
translates a letter in the map_data to a number. Note if this tag is not
used the default mapping will be used, und thus be backwards compatible.

Here’s a little example ( ascii char 65 = A ascii char 70 = F ):

<map_translation>
v=65
f=70
</map_translation>

mapdata=“fvf�

With the current systems this would be
forest, village, forest

With the translation this will be
human (snow) hill village, forest (snow), human (snow) hill village

This way map developers can use the easier to remember letters for
everything and use the map_translation to change it, eg. use v and V
for villages (most maps have one 1 or 2 types of villages).

Also if an artist for example makes a new tile of a forest, which fits
better in a swamp area, it would take a small change in the translation
table to change all forests into this new terrain.


Mark
sparr
Posts: 209
Joined: March 6th, 2006, 5:02 am

Post by sparr »

Wesnoth is an amazingly advanced game. The idea of one-terrain-type hexes has to go away at some point. Many ideas have been proposed, including a lot of basetype+modifier systems. I am not going to rehash all those discussions here, but I will say that while I like the idea of map character translation, and think it would be a neat feature to have in the current system, I think that overall this is a bad idea for a new terrain system. IMHO, when a new system is implemented, it should completely replace the old system. The new maps should be in a completely different format (binary, markup of some sort, whatever) and contain a magic number at the top just like any other sane file format. Backwards compatibility is maintained by simply reading the magic number and using a special loader to load the old maps.
SkeletonCrew
Inactive Developer
Posts: 787
Joined: March 31st, 2006, 6:55 am

Post by SkeletonCrew »

The new maps should be in a completely different format (binary, markup of some sort, whatever) and contain a magic number at the top just like any other sane file format.
I agree a total new system could carry a version number for the parsing engine and use another format. But the threads I've seen so far all wanted to keep the system with a single letter for a terrain.

Mark
SkeletonCrew
Inactive Developer
Posts: 787
Joined: March 31st, 2006, 6:55 am

Post by SkeletonCrew »

When I started this thread Darth Fool was busy with the terrain system, but he abandoned. I still think this idea is good and I’m willing to try to code it. Darth Fool warned it could be harder than expected, but I want to try nevertheless.

Before I start to code I’d like to have some feedback...

PS I now know the WML tags are [ and ].
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

I don't see any kind of a problem with keeping the format such that one letter represents one hex. I've asked a few times earlier whether there are any problems with that, and haven't gotten a response that would claim there are. Just use something like...UTF-8 for maps? Should be plenty enough letters there.
Dragon Master
Posts: 1012
Joined: February 11th, 2006, 1:04 am
Location: Somewhere

Post by Dragon Master »

I think what's best would be for new terrain, make the hex be represented by X1 (X can be any letter). Let's all the old terrain letters be the same but gives you another alphabet to work with. Run out of X1's and move on to X2's. What do you think?
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Post by Yogibear »

SkeletonCrew wrote:Before I start to code I’d like to have some feedback...
I find this idea fascinating :D . It is simple to understand and looks elegant to me. Neither does it make map processing more difficult than it is now, nor is it actually changed in its basics. It just adds a translation to it.

Unfortunately, my experience taught me, that most anything i touch in wesnoth is more complicated than i thought at first :P . But it didn't stop me from doing big changes and it shouldn't stop you as well.

I suggest, that you make a new branch if you start going on this. That way, you can save your work often and don't interfere with other activities.
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
SkeletonCrew
Inactive Developer
Posts: 787
Joined: March 31st, 2006, 6:55 am

Post by SkeletonCrew »

Dragon Master wrote:I think what's best would be for new terrain, make the hex be represented by X1 (X can be any letter). Let's all the old terrain letters be the same but gives you another alphabet to work with. Run out of X1's and move on to X2's. What do you think?
That could be doable but will make matters complicate. I could use the letter O for this system but after a while it will also run out of letters so I either need another prefix or a double prefix.
Also the decoder needs to eat either one or two characters which complicates the matter (also with error checking).
What I remembered of the old threads about the topic is that people love the 1 letter system.
Yogi Bear wrote:Unfortunately, my experience taught me, that most anything i touch in wesnoth is more complicated than i thought at first :P . But it didn't stop me from doing big changes and it shouldn't stop you as well.
Yes Darth Fool said the same to me about changing the terrain system :cry: But I'll see how it goes...
Yogi Bear wrote:I suggest, that you make a new branch if you start going on this. That way, you can save your work often and don't interfere with other activities.
Yes I didn't plan to do it the trunk, it's to invasive.
SkeletonCrew
Inactive Developer
Posts: 787
Joined: March 31st, 2006, 6:55 am

Post by SkeletonCrew »

I've been working on this idea and it seems to work, most of Wesnoth is running with a changed internal terrain type. It didn't give much trouble but I think that is because the new internal number is compatible with the old type. So my next step is to switch to the new numbers and see how quickly Wesnoth crashes :D . As stated in my first post I want to make a translation table.

The characters " till ` can't be used in the new system and aren't used in the current system either.
O and j can be used but don't have a default translations
K and ~ and space are special and can't be remapped
1 - 9 (starting positions are mapped to the numbers 1-9 so it might be possible to add more starting positions in a later version of Wesnoth. These also can't be remapped)
Numbers below the 1000 are special and can't be mapped to.
Every number above 60000 is reserved for UMC.

I'm going to implant these numbers soon so if somebody has a better suggestion for number ranges please let me know. If there are questions please ask. Here's a list with proposed new numbers. (attached the list in a html file.)
EDIT: forgot the attachment and html is not allowed so it's a tar.gz.

Letter Number Group Description
A 1000 Village human (snow) hill village
a 1001 Village human hill village
B 1002 Village desert village (adobe)
b 1003 Village human mountain village
C 2000 Castle castle
c 3000 Water shallow water, "coast"
D 1004 Village underground village (cave, village), "dungeon village"
d 4000 Plains sand, (old desert)
E 5000 Road desert road
e 1005 Village elven (snow) village
F 6000 Forrest forest (snow)
f 6001 Forrest forest
G 4001 Plains savanna (grass)
g 4002 Plains grass
H 7000 Hills hills (snow)
h 7001 Hills hills
I 4003 Plains desert
i 4004 Plains ice (tundra)
J 7002 Hills desert hills
j - - -nothing- (will be snowy mountains)
K 900 Special keep (castle)
k 4005 Plains river ford (grass, shallow water)
L 1006 Village tropical forest village (savanna, village)
l 8000 Lava lava (canyon)
M 9000 Mountains desert mountains
m 10000 Mountains mountain
N 2001 Castle ruined castle
n 2002 Castle encampment (castle)
O - - -nothing- ( will probably be an Orc Castle one day )
o 2003 Castle dwarven castle (castle)
P 3001 Water desert oasis
p 1007 Village dwarven village
Q 2004 Castle sunken ruin
q 2005 Castle ruin (swamp)
R 4006 Plains road (grass)
r 4007 Plains dirt (grass)
S 4008 Plains tundra
s 3002 Water deep water
T 6002 Forrest forest (tropical)
t 1008 Village village
U 1009 Village desert village (tent)
u 11000 Cave cave
V 1010 Village snow village (tundra, village)
v 1011 Village human village (village)
W 12000 Impassable cavewall
w 3003 Water swamp
X 12001 Impassable canyon (replaced by chasm in trunk)
x 60000 UMC reserved for UMCs
Y 1012 Village swamp village (swamp, village)
y 60001 UMC reserved for UMCs
Z 1013 Village mermen village (shallow water)
z 60002 UMC reserved for UMCs
/ 13000 Bridge bridge (grass, shallow water)
| 13001 Bridge bridge (grass, shallow water)
\ 13002 Bridge bridge (grass, shallow water)
~ 901 Special fog
<space> 902 Special void/shroud (it uses the "space" character)
* 60003 UMC reserved for UMCs
^ 60004 UMC reserved for UMCs
% 60005 UMC reserved for UMCs
@ 60006 UMC reserved for UMCs
[ 11001 Cave rockbound cave
] 11002 Cave mushroom grove
' 11003 Cave illuminated cave
? 6003 Forrest great Elven tree
& 12002 Impassable impassable moutains
" - -
$ - -
. - -
; - -
: - -
< - -
> - -
_ - -
` - -
1 - 9 1 -9 Start points[/list]
Attachments
terrain_translation.html.tar.gz
(2.24 KiB) Downloaded 418 times
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

SkeletonCrew wrote: I'm going to implant these numbers soon so if somebody has a better suggestion for number ranges please let me know. If there are questions please ask. Here's a list with proposed new numbers. (attached the list in a html file.)
EDIT: forgot the attachment and html is not allowed so it's a tar.gz.
Hmmm... It sounds almost like you are hardcoding the numbers, although I suspect that is just the way you said it, since clearly the right way to do this is to have the numbers be part of the wml terrain definitions and have the default mapping from char to int be wml configurable as well. Anyways, I look forward to seeing your patch.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Could someone who knows still answer my question? Wouldn't it work? Would there be problems (WML as a whole could be made UTF-8-only IMHO if that would solve something)?

Having hexes represented with a single letter is very useful and should not be broken unless necessary (switching to a multi-letter system would be unnecessary if one can expand the single-letter system).
SkeletonCrew
Inactive Developer
Posts: 787
Joined: March 31st, 2006, 6:55 am

Post by SkeletonCrew »

Darth Fool wrote:
SkeletonCrew wrote: I'm going to implant these numbers soon so if somebody has a better suggestion for number ranges please let me know. If there are questions please ask. Here's a list with proposed new numbers. (attached the list in a html file.)
EDIT: forgot the attachment and html is not allowed so it's a tar.gz.
Hmmm... It sounds almost like you are hardcoding the numbers, although I suspect that is just the way you said it, since clearly the right way to do this is to have the numbers be part of the wml terrain definitions and have the default mapping from char to int be wml configurable as well. Anyways, I look forward to seeing your patch.
The numbers will be hardcoded in terrain.cfg. The letters there will be obsolete and no longer used. This way it's possible to increase the number of terrains. The letters in WML map_data will stay and will be translated to the new numbers. Also the data in terrain-graphics.cfg should either be the "old" letters or the new numbers and converted accordingly. At least that was the plan.

Before I send the patch I want to sync with SVN but the last updates are big (mostely png's but I want to check the commits before I sync.) I hope to send it on Saturday.
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Post by Noyga »

How would terrain masks be handled ?
Rhuvaen
Inactive Developer
Posts: 1272
Joined: August 27th, 2004, 8:05 am
Location: Berlin, Germany

Post by Rhuvaen »

Noyga wrote:How would terrain masks be handled ?
Use the same map translations as the map data, I'd guess.
SkeletonCrew
Inactive Developer
Posts: 787
Joined: March 31st, 2006, 6:55 am

Post by SkeletonCrew »

zookeeper wrote:Could someone who knows still answer my question? Wouldn't it work? Would there be problems (WML as a whole could be made UTF-8-only IMHO if that would solve something)?

Having hexes represented with a single letter is very useful and should not be broken unless necessary (switching to a multi-letter system would be unnecessary if one can expand the single-letter system).
Sorry I didn't see you earlier post in this thread :oops:

I'm not familiar with working with UTF-8, but it's also a multibyte value and needs to change the engine. My idea is still a single letter system but with a translation.
Let me try to explain again:
Imagine we really ran out of letters
Imagine somebody makes a nice swamp forest, since we're out of letters this terrain gets number 6004, the next in line.
You don't want to use the tropical forrest T in this map.
You make your map the usual way and use the letter T where you want to have the swamp forest.
Then you add this code snippet to your file (note this snippet format can change but the idea remains.)
[map_translation]
T=6004
[/map_translation]

When Wesnoth loads your map it translates the letter T to your new swamp forrest. This way the limit of IIRC 61 terrains is changed to 61 terrains per map.
Rhuvaen wrote:
Noyga wrote:How would terrain masks be handled ?
Use the same map translations as the map data, I'd guess.
Yes that would be the idea, also for changing the terrain in WML with the
[terrain][/terrain] code. As far as WML is concerned there are only the usual letters, their meaning is changed but WML doesn't know.
Post Reply