Is there an utility to have a full rendering of a map?

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Post Reply
Aramel
Posts: 4
Joined: January 20th, 2013, 3:01 pm

Is there an utility to have a full rendering of a map?

Post by Aramel »

Hi,

I'm currently thinking about writing a PHP-based map generator.
However, the first step before starting anything is to have some program that can render a wesnoth map and output it in a file (whatever the format: png, jpeg, bmp... it will be post-processed).

The idea is to offer a better tool than the built-in map generator. I have already written a good map generator in WML, but there is a lot of limitation.

Basicly, the map on the website will be stored in another format, that only store village, castle, forest, hill, mountain, river and sea. Then, you can render it for all the 4 seasons (and save it in wesnoth map format).

Any idea? Any pointer?
I'm a bit lost in the C++ source code, it looks a bit hard to isolate the map rendering process...
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Is there an utility to have a full rendering of a map?

Post by 8680 »

You seem to be confusing the generation of maps with their rendering (processing terrain graphics to display the map). You may be looking for something like this (“a better tool than the built-in map generator”, “render it for all the 4 seasons (and save it in wesnoth map format)”), something like this (“map on the website”), or something like Wesnoth’s built-in whole-map screenshot feature (“render a wesnoth map and output it in a file”).
Aramel
Posts: 4
Joined: January 20th, 2013, 3:01 pm

Re: Is there an utility to have a full rendering of a map?

Post by Aramel »

Hi,

Despite the fact I'm not speaking english very well, I'm not confusing map generator with map rendering :lol2:
While the renderer is not mandatory for a map generator, it is not very usefull if the user can't see the result immediately (so he can regen a random map again, until it looks fine).
I can easily handle the generator process, the map import and export, but I definitively cannot handle the rendering process (with terrain transition).

Thanks for the links!
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Is there an utility to have a full rendering of a map?

Post by 8680 »

Apologies for my misunderstanding. Perhaps the terrain rendering part of Wesnoth could (with difficulty, as you mention) be kludged into a standalone program, or a PHP library? (I freely admit having only the barest knowledge of the Wesnoth codebase, and none whatsoever of the part in question, and a similarly low knowledge of PHP.) Or perhaps you could integrate your generator into Ancestral’s Wesnoth Canvas renderer?

Edit: Or use the below-mentioned screenshot mode, which I searched for and quite overlooked.
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: Is there an utility to have a full rendering of a map?

Post by AI »

The wesnoth executable has a screenshot mode (where it renders the map onto an offscreen surface and saves an image of it), but it seems to be broken in 1.11.
Aramel
Posts: 4
Joined: January 20th, 2013, 3:01 pm

Re: Is there an utility to have a full rendering of a map?

Post by Aramel »

Hi,

@8680:
I can't use Wesnoth Canvas, since I'm planning to do the rendering server-side (PHP, and eventually some exe). The browser will only have to display a plain image.
I was not aware of Pyrophorus's project, but it looks very close to the way I imagined to generate map.

@AI:
You mean you can invoke wesnoth with some command-line options and it output the screenshot? It's exactly what I was looking for! How does it work?

EDIT:
Okey, wesnoth --screenshot <mymap> <output> , thanks a lot!
I hope it will work again in 1.11 ;)
User avatar
pyrophorus
Posts: 533
Joined: December 1st, 2010, 12:54 pm

Re: Is there an utility to have a full rendering of a map?

Post by pyrophorus »

Hello !
Aramel wrote:Hi,

I was not aware of Pyrophorus's project, but it looks very close to the way I imagined to generate map.
Can I ask you in which way ? Available options or algorithms ?

Friendly,
Aramel
Posts: 4
Joined: January 20th, 2013, 3:01 pm

Re: Is there an utility to have a full rendering of a map?

Post by Aramel »

Hi!

I don't know for yours algorithms, but some ideas are similar, for example the variation of the same map with snow or desert.

Basicly, my generator use a lot of layer, they are computed (for instance) in this order:
- highmap
- river (the source start at a random hill or mountain hex, then it flows toward lower hexes and try to find a way to the sea or the border of the map)
- temperature map
- humidity map
- forest map (or vegetable)
- castle map
- village map
- roads map

ATM, it is still not as good as wesnoth's built-in generator, there are a lot a stuff to do to refine it.
My holidays are ending soon, so I don't know when I will finish it.

Also the generator + invoking Wesnoth on command line with the screenshot options use a lot of CPU, I don't know if this will be possible to use it as a SaaS.
User avatar
pyrophorus
Posts: 533
Joined: December 1st, 2010, 12:54 pm

Re: Is there an utility to have a full rendering of a map?

Post by pyrophorus »

Hello !
AFAICS, there will be a lot of differences with mine, but anyway, I will always interested in discussing the topic in this thread or in mine.

Friendly,
Post Reply