Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Export / Import

A topic by mallatius created Apr 01, 2024 Views: 1,653 Replies: 16
Viewing posts 1 to 12
(1 edit)

Hi,

Fantastic job. Plural : Jobs. I love MFCG, but also the other generators.

I am creating a scenario generator for GameMasters, and I am looking for mapping tools to include in the GM scenarios.

I think that my questions have already been asked, ... but :

- i am interested by getting the 2D map of cities, or caves, or ... but mainly, I am looking for JSON exports, to recreate a 3D view, with my 3D objects (houses, castles, ...). Is it possible to get JSON files on other generators than MFCG ?

- i am interested to "inject" parameters to generators, for instance, houses density, or numbers, or forest density, ... ?

Thanks in advance for your replies.

I say it again : very very great jobs.

PS : I add a third question : I thought I can re-use the URL generated, and change some parameters (walls=0/1, ...), and add export=svg ou export=json to the URL (keeping the seed value). This did'nt work (Error 500). So, I think I have not very well understood the URL syntax/call ? How is it callable directly ?

Mallatius

Developer

Hi!

  • Four of my generators support JSON export: MFCG, VG, NG and 1PDG. MFCG, VG and NG use the same type of JSON (with buildings, roads, tree etc.), but only MFCG accepts the export url parameter. 1PDG uses a different type of JSON and it also recognizes the export  parameter.
  • All of the Arcana generators can be parameterized via url variables, usually by requesting specific tags. For example this should give you an isolated densely built village of the default size.
  • Could you send me a link that gives you that error? Adding export=... should work.
(+1)

Hi Watabou !

Thanks for your replies.

I am not sure to very well use MCFG URL and its parameters. In my browser, I call https://watabou.itch.io/medieval-fantasy-city-generator, it displays a generated city. If I add "?export=png" or "?export=json", I works, but I get a new city each time.

Same thing if I add "&wall=0" or "wall=1", I got a city with or without walls around the city, but city is regenerated. How can I stay on same city and test some variations by url ?

BTW, is there a list of URL options (wall,castle,...) in MFCG ?

I try the same thing on VG, but except export, which does not have any effect, I am able to get the same village (I suppose as long as I keep the same value in "seed" ?).

But the last point ("error"), I am not able to reproduce it today. My memory was I got a "500 internal error" on MFCG, when adding a "?export=XXX".

(All my tests have been done with Chrome, and most of the time confirm with Firefox).

Developer

There are two slightly different versions (itch.io version and Arcana version) of each of the following generators: Perilous Shores, MFCG, NG, Procgen Mansion, VG, 1PDG. For example, for MFCG the web address of its itch.io version is https://watabou.itch.io/medieval-fantasy-city-generator and the web address of its Arcana version is https://watabou.github.io/city-generator/. Only the Arcana versions of the generators can access the address bar of your browser and pull parameters from there. You can't parameterize the itch.io version of a generator via a url, because on itch.io applications are run isolated (in an iframe). 

Here is the same city with and without a castle (note the castle parameter in the urls):

(+1)

Hi,

Thanks for your explanations !

(+1)

Hi,

I continue to discover and use CG and VG, and I am very happy with them.

I have a couple of questions or suggestions on them :

- in CG : i got sometimes some "triangular" houses. Is it possible to avoid that ? To have houses with at least 4 corners ?


- in CG, you can set the size of City and population with a "size" parameter. In VG, there is not such tag/parameter, it is more with width/height values. Is it possible to have a "size" parameter, and keep width/height for terrain size ? Or is it complicated ?

- Il see in earlier posts, that you thought about making "walls" in VG. I am interested in such feature. Still on you ToDoList ?


Mallatius

Developer (1 edit)
  • I don't feel like there are too many triangular buildings. They were a scourge of early versions of the generator, but now most of the buildings are more or less rectangular. Weird shapes still happen in difficult locations (e.g. around towers) and some of them get filtered out. I'm afraid more "aggressive" filtering will lead to noticeable holes in the pattern of buildings. You can try choosing Display mode: Complex to turn most triangular shapes into smaller "polyominoes".
  • I think that introducing an additional size parameter will make it more confusing. Also, it might cause a situation when a requested "village size" is too large for a requested "map size" (I guess the opposite is not a big problem). In addition to the map size, there are also population density tags sparse and dense which affect the number of buildings in the village (but not its area/radius).
  • Yes, palisades are still on my list. Actually, they will be the next big feature I'm going to try implementing in the village generator.
(+1)

Hi,

Thanks a lot for your replies. I'll test your suggestions for both CG and VG !

(1 edit)

Hi,

I have continued on CG and VG tests. I publish my questions here, but it concerns VG, (and CG too), but my tests are currently on VG.

My goal is to add some items on a village map, and to transform the 2D map into a 3D map, like your "City Viewer", but with 3D assets from Unity.

So, I exported PNG and JSON files from one VG seed. And I check the position of roads, buildings, trees. But I have some differences.

I have made "suppositions"/"interpretations" with the JSON file. I know that your JSON file is intended to be used only in CV, but I am interested by it.

So, I write a program which superposes PNG with polygons from JSON. I generated a 500x500 "dead end" village. The JSON gives me a 417x417 "earth" size (-208.6 to +208.6).

When I superpose a 417x417 resized PNG , with JSON, I got that :


(blue=road, red=buildings,green=trees).

After several trials, I got the ideal size, which is 350 (70% of declared size ??) :


I have no idea if I made some geometric errors or miscalulations, or if there is something I forgot to include.

Do you have any idea ?

Mallatius

On CG, I have no idea to find the right sizes. VG is square, CG is rectangular.


Developer

I have a question: why do you need a PNG? How are you going to use it? Why do you need to superpose PNG and JSON?

In VG, when a user requests a map of a specific size, the generator builds a map a bit larger. In JSON the whole generated map is exported, in PNG - only its visible (requested) part. The point with coordinates (0, 0) in the JSON file will be at the centre of the PNG image.

In MFCG, it's more complicated because the generator exports a map (in PNG and SVG) in such a way that the content (buildings) fills the whole image more or less.

(+1)

Thanks for your reply.


To answer your question :

My project is a RPG 3D project, build with Unity. I have a library of 3D buildings, houses, fences, towers, ... I want to use the PNG to present a 2D village or a 2D city to the Dungeon Master. He selects one, and I build a 3D village or city with my Unity assets. And I build that with the JSON file, quite like your City Viewer. And RPG players can play in my 3D village or city after 3D generation.

The first check for me was/is to superpose PNG and JSON, to assure a minimal consistency for the DM. If the DM adds some assets to his village (a tavern, a casern, ...) or remove one, I need superposition between PNG and JSON.

Developer

Well, as I said, there is no easy way to superpose PNG and JSON, especially in the case of cities. Maybe it would be more straightforward with SVG, but I can't guarantee it without checking the code - this is implemented differently in my different generators. I have no idea how trivial it is to load/manipulate/render SVG in Unity though.

Feel free to ignore the following if you think I'm too slow: To be honest, I still don't understand why it's needed, I might be missing something. This is how I see it: the DM selects a map by browsing PNGs and after that a corresponding JSON is loaded. The JSON data (and only JSON data!) is used to build a 3D scene and that scene is used both for presenting it to players in all its 3D glory AND for as a workspace for DM for adding/editing/removing stuff. In this scenario PNGs are only used as previews and no superposing is needed. Isn't it?

(+1)

Hi,

My goal was to "permanently synchronize" 2D (PNG) and 3D (JSON) for the DM, during his map design. But, I agree with you : I can still use PNG for thumbnail , during map selection, and work only with JSON when DM adds assets.

is there a way to import a generated JSON file into the city generator to go back to editing it?

Developer

No.

(+1)

darn. I have a really great city I'm working with for my campaign,