Steve Jackson Games - Site Navigation
Home General Info Follow Us Search Illuminator Store Forums What's New Other Games Ogre GURPS Munchkin Our Games: Home

Go Back   Steve Jackson Games Forums > Roleplaying > The Fantasy Trip

Reply
 
Thread Tools Display Modes
Old 03-11-2019, 12:54 AM   #141
HeatDeath
 
Join Date: May 2012
Default Re: TFT Map Maker

Quote:
Originally Posted by DouglasCole View Post
You've seen New Orleans, right? :-)
Pfft! New Orleans is totally unrealistic! https://twitter.com/jameslsutter/sta...ntasy-world%2F
HeatDeath is offline   Reply With Quote
Old 03-11-2019, 07:24 AM   #142
Shadekeep
 
Shadekeep's Avatar
 
Join Date: Aug 2018
Location: Aerlith
Default Re: TFT Map Maker

Quote:
Originally Posted by kmo View Post
Shadekeep, Shamat is a really impressive tool! Thank you for all of the thoughtful work that has gone into it.

I am working on a project which makes use of maps generated by Shamat, and I wonder if you would clarify one aspect of the SKMR format. How do I interpret the three values in the MHEX directive?

Thank you!
Neat, I'd like to hear more about your project when you get a chance!

The three values are essentially the three axes along which the megahexes can be positioned. The first value is the X value, or column; the second value is the Y value, or row; and the third value is the shift value, or offset. The overlayMegahexes() function in the code uses these three values to determine where to begin drawing the first megahex, with all other megahexes positioned organically after that one.
Shadekeep is offline   Reply With Quote
Old 03-11-2019, 07:40 AM   #143
heruca
 
heruca's Avatar
 
Join Date: Nov 2005
Location: Buenos Aires, Argentina
Default Re: TFT Map Maker

Quote:
Originally Posted by Shadekeep View Post
The three values are essentially the three axes along which the megahexes can be positioned. The first value is the X value, or column; the second value is the Y value, or row; and the third value is the shift value, or offset. The overlayMegahexes() function in the code uses these three values to determine where to begin drawing the first megahex, with all other megahexes positioned organically after that one.
Nice! I'm currently trying to solve this very problem, so that my mapping app can have megahex support. Got any pseudo-code you could share?
__________________
MapForge battlemap creation software for RPGs

Battlegrounds: RPG Edition is virtual tabletop software that allows you to play any RPG online or offline. It's very easy to use and feature-rich.
heruca is offline   Reply With Quote
Old 03-11-2019, 09:19 AM   #144
Shadekeep
 
Shadekeep's Avatar
 
Join Date: Aug 2018
Location: Aerlith
Default Re: TFT Map Maker

Quote:
Originally Posted by heruca View Post
Nice! I'm currently trying to solve this very problem, so that my mapping app can have megahex support. Got any pseudo-code you could share?
Certainly. I hope the below is clear, let me know if you have any questions. The pseudocode presumes a method for drawing a single megahex at a given X/Y position, and each X/Y coordinate represents a single hex on the map.

There are two functions, one of which draws a contiguous "row" of megahexes, and the other which fills the map with such rows. I realise now that I should probably also include the ability to change the "grain" of those rows. Currently each subsequent megahex is placed to the upper-right of the previous megahex, but an equally valid grain is the next megahex to the lower-right. This should be fairly trivial to add in the next release.

Code:
drawMegahexes(initX, initY, initOffset) {
	x = initX;
	y = initY;
	offset  = initOffset;
	while(y < mapheight + 6) {
		drawMegahexRow(x, y, offset);
		if(x == -1) {
			x = 1;
			y += 2;
			offset = 0;
		}
		else if(x == 1) {
			x = 0;
			y += 3;
			offset = 1;
		}
		else if(x == 0) {
			x = -1;
			y += 2;
			offset = 0;
		}
	}
}

drawMegahexRow(x, y, offset) {
	step = 0;
	stepBias = offset;
	loopRise = 0;
	shiftv = 0;
	while(x < mapwidth + 2) {
		drawMegahex(x, y - (step + stepBias >= 6 ? 3 : (step + stepBias >= 4 ? 2 : (step + stepBias >= 2 ? 1 : 0))) + loopRise, shiftv);
		drawMegahex(x, y - (step + stepBias >= 6 ? 3 : (step + stepBias >= 4 ? 2 : (step + stepBias >= 2 ? 1 : 0))) + loopRise, shiftv);
		x += 3;
		step++;
		if(step > 5) { step = 0; x--; stepBias = Math.abs(stepBias - 1); shiftv = -stepBias; if(stepBias == 0) { loopRise--; } }
		else { shiftv = Math.abs(shiftv) - 1; }
	}
}
There's probably a more elegant way to write all that conditional logic that determines where the next row offsets, but it works for now.
Shadekeep is offline   Reply With Quote
Old 03-11-2019, 09:23 AM   #145
heruca
 
heruca's Avatar
 
Join Date: Nov 2005
Location: Buenos Aires, Argentina
Default Re: TFT Map Maker

Thanks a lot, Shadekeep! I'll let you know how it works out.
__________________
MapForge battlemap creation software for RPGs

Battlegrounds: RPG Edition is virtual tabletop software that allows you to play any RPG online or offline. It's very easy to use and feature-rich.
heruca is offline   Reply With Quote
Old 03-11-2019, 09:25 AM   #146
Shadekeep
 
Shadekeep's Avatar
 
Join Date: Aug 2018
Location: Aerlith
Default Re: TFT Map Maker

Ha, and just looking at the code I posted, I already see one simplification. This chained ternary:

(step + stepBias >= 6 ? 3 : (step + stepBias >= 4 ? 2 : (step + stepBias >= 2 ? 1 : 0))

Could be rewritten:

Math.floor((step + stepBias) / 2)

As long as (step + stepBias) never goes above 6 or goes negative, that logic should be sound. And I'm pretty sure both cases are true. I'll test it out.
Shadekeep is offline   Reply With Quote
Old 03-11-2019, 09:29 AM   #147
Shadekeep
 
Shadekeep's Avatar
 
Join Date: Aug 2018
Location: Aerlith
Default Re: TFT Map Maker

Yep, I can confirm that the Math.floor() version works fine. Also, for some reason the drawMegahex function appears twice in the pseudocode. It should only be there once. Here's the updated and corrected drawMegahexRow code:

Code:
drawMegahexRow(x, y, offset) {
	step = 0;
	stepBias = offset;
	loopRise = 0;
	shiftv = 0;
	while(x < mapwidth + 2) {
		drawMegahex(x, y - Math.floor((step + stepBias) / 2) + loopRise, shiftv);
		x += 3;
		step++;
		if(step > 5) { step = 0; x--; stepBias = Math.abs(stepBias - 1); shiftv = -stepBias; if(stepBias == 0) { loopRise--; } }
		else { shiftv = Math.abs(shiftv) - 1; }
	}
}
Shadekeep is offline   Reply With Quote
Old 03-19-2019, 06:17 PM   #148
Tolenkar
 
Tolenkar's Avatar
 
Join Date: Jun 2018
Location: Cidri
Default Re: TFT Map Maker

Thank you. Thank you. Thank you!
__________________
Yes, I know Tollenkar is misspelled. I did it on purpose. Apparently, I purposefully misspell words all the time...
Tolenkar is offline   Reply With Quote
Old 03-26-2019, 08:42 AM   #149
Shadekeep
 
Shadekeep's Avatar
 
Join Date: Aug 2018
Location: Aerlith
Default Re: TFT Map Maker

Finally got the Shadekeep site ready for its debut. You can get the latest version of Shamat from there, as well as download the standalone version. Here's a direct link to the home page for Shamat:

http://shadekeep.com/shamat.html

I'll be working on the usage documentation next, but most of you here are already familiar enough with the program's operation.

Thanks for all the feedback so far!
Shadekeep is offline   Reply With Quote
Old 03-26-2019, 08:59 AM   #150
heruca
 
heruca's Avatar
 
Join Date: Nov 2005
Location: Buenos Aires, Argentina
Default Re: TFT Map Maker

Excellent, congrats on the site and the release!
__________________
MapForge battlemap creation software for RPGs

Battlegrounds: RPG Edition is virtual tabletop software that allows you to play any RPG online or offline. It's very easy to use and feature-rich.
heruca is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Fnords are Off
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 08:02 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.