Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for mapping caves #273

Open
antevens opened this issue Jul 15, 2022 · 2 comments
Open

Documentation for mapping caves #273

antevens opened this issue Jul 15, 2022 · 2 comments

Comments

@antevens
Copy link

antevens commented Jul 15, 2022

I've been trying to add underground layers and have them rendered but despite my best efforts I'm unable to get underground layers to render.

I'm propably missing something basic but so far it's eluded me.
My current config includes the following sections and I've cleared all tiles and the mapserver.sqlite DB on multiple occations.

Any thoughts on why nothing would be rendereed?

"layers": [
	{
		"id": 0,
		"name": "Ground",
		"from": -1,
		"to": 10
	},
	{
		"id": 1,
		"name": "Sky",
		"from": 11,
		"to": 24
	},
	{
		"id": 2,
		"name": "BaseCave",
		"from": -2400,
		"to": -2300
	},
	{
		"id": 3,
		"name": "Caves",
		"from": -2335,
		"to": -2350
	}
],
@BuckarooBanzay
Copy link
Member

Yeah, i think i know why:

This: "from": -2400, (and the "to" field) are in mapblocks, not nodes and your coordinate would result somewhere around -38'000, far outside the world borders :/

I documented this here: https://github.com/minetest-mapserver/mapserver/blob/master/doc/config.md#layers but i think i have to place it somewhere more visible in the future.

In your case, this config should work:

"layers": [
	{
		"id": 0,
		"name": "Ground",
		"from": -1,
		"to": 10
	},
	{
		"id": 1,
		"name": "Sky",
		"from": 11,
		"to": 24
	},
	{
		"id": 2,
		"name": "BaseCave",
		"from": -150,
		"to": -144
	},
	{
		"id": 3,
		"name": "Caves",
		"from": -145,
		"to": -147
	}
],

Just divide the node-coordinates by 16 and you have the mapblock coordinates

@antevens
Copy link
Author

Thanks!

That works perfectly and the documentation is clear, it's the user that's the problem :)

Perhaps inline comments or bounds checking with a warning might be the best way to go?
The lower example also has the from/to reversed in which case nothing is shown so if a check were to be added that might be another good thing to add to the check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants