<!-- MHonArc v2.4.4 --> <!--X-Subject: [MUD-Dev] Re: Hex-grid mapping --> <!--X-From-R13: Xba Zrbaneq <wyrbaneqNqvipbz.fyvzl.pbz> --> <!--X-Date: Tue, 1 Dec 1998 00:16:27 -0800 --> <!--X-Message-Id: 19981201001354.A2204#divcom,slimy.com --> <!--X-Content-Type: text/plain --> <!--X-Reference: 199812010742.CAA07348#crystal,palace.net --> <!--X-Head-End--> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>MUD-Dev message, [MUD-Dev] Re: Hex-grid mapping</title> <!-- meta name="robots" content="noindex,nofollow" --> <link rev="made" href="mailto:jleonard#divcom,slimy.com"> </head> <body background="/backgrounds/paperback.gif" bgcolor="#ffffff" text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000"> <font size="+4" color="#804040"> <strong><em>MUD-Dev<br>mailing list archive</em></strong> </font> <br> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] <br clear=all><hr> <!--X-Body-Begin--> <!--X-User-Header--> <!--X-User-Header-End--> <!--X-TopPNI--> Date: [ <a href="msg00878.html">Previous</a> | <a href="msg00880.html">Next</a> ] Thread: [ <a href="msg00878.html">Previous</a> | <a href="msg00882.html">Next</a> ] Index: [ <A HREF="author.html#00879">Author</A> | <A HREF="#00879">Date</A> | <A HREF="thread.html#00879">Thread</A> ] <!--X-TopPNI-End--> <!--X-MsgBody--> <!--X-Subject-Header-Begin--> <H1>[MUD-Dev] Re: Hex-grid mapping</H1> <HR> <!--X-Subject-Header-End--> <!--X-Head-of-Message--> <UL> <LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI> <LI><em>Subject</em>: [MUD-Dev] Re: Hex-grid mapping</LI> <LI><em>From</em>: Jon Leonard <<A HREF="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</A>></LI> <LI><em>Date</em>: Tue, 1 Dec 1998 00:13:54 -0800</LI> <LI><em>Cc</em>: Jon Leonard <<A HREF="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</A>></LI> <LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI> </UL> <!--X-Head-of-Message-End--> <!--X-Head-Body-Sep-Begin--> <HR> <!--X-Head-Body-Sep-End--> <!--X-Body-of-Message--> <PRE> On Tue, Dec 01, 1998 at 02:42:18AM -0500, Matthew R. Sheahan wrote: > i'm in the design phase for a project where i want to use hex-grid > mapping, and this has led me to realize that i don't know any decent > methodology at all for tracking coordinates on a hex-grid. ideally > i'd like something not very different from Cartesian coordinates, and > which permits easy determination of what locations are adjacent to > a given coordinate. this seems like the kind of thing which has > probably been solved to death, so i thought i'd ask around instead of > reinventing the wheel. does anyone have any suggestions, or resources > to point me to? Treat it just like cartesian coordinates, except that instead of using sqrt(x*x + y*y) for distance, use sqrt(x*x - x*y + y*y). That gives a coordinate grid that looks like this: / \ / \ / \ / \ / \ / \ | 0,5 | 1,5 | 2,5 | 3,5 | 4,5 | 5,5 | / \ / \ / \ / \ / \ / \ / | 0,4 | 1,4 | 2,4 | 3,4 | 4,4 | 5,4 | / \ / \ / \ / \ / \ / \ / | 0,3 | 1,3 | 2,3 | 3,3 | 4,3 | 5,3 | / \ / \ / \ / \ / \ / \ / | 0,2 | 1,2 | 2,2 | 3,2 | 4,2 | 5,2 | / \ / \ / \ / \ / \ / \ / | 0,1 | 1,1 | 2,1 | 3,1 | 4,1 | 5,1 | / \ / \ / \ / \ / \ / \ / | 0,0 | 1,0 | 2,0 | 3,0 | 4,0 | 5,0 | \ / \ / \ / \ / \ / \ / Adjacent hexes have a distance of 1, and are located at deltas of: (-1,+0) (-1,+1) (+0,-1) (+0,+1) (+1,-1) (+1,+0) Using +x*y instead of -x*y in the distance formula yields a hex grid skewed the other way. I have some code that I can clean up if an example would be helpful. Jon Leonard </PRE> <!--X-Body-of-Message-End--> <!--X-MsgBody-End--> <!--X-Follow-Ups--> <HR> <ul compact><li><strong>Follow-Ups</strong>: <ul> <li><strong><A NAME="00882" HREF="msg00882.html">[MUD-Dev] Re: Hex-grid mapping</A></strong> <ul compact><li><em>From:</em> James Wilson <jwilson#rochester,rr.com></li></ul> </UL></LI></UL> <!--X-Follow-Ups-End--> <!--X-References--> <UL><LI><STRONG>References</STRONG>: <UL> <LI><STRONG><A NAME="00878" HREF="msg00878.html">[MUD-Dev] Hex-grid mapping</A></STRONG> <UL><LI><EM>From:</EM> "Matthew R. Sheahan" <chaos#crystal,palace.net></LI></UL></LI> </UL></LI></UL> <!--X-References-End--> <!--X-BotPNI--> <UL> <LI>Prev by Date: <STRONG><A HREF="msg00878.html">[MUD-Dev] Hex-grid mapping</A></STRONG> </LI> <LI>Next by Date: <STRONG><A HREF="msg00880.html">[MUD-Dev] Re: Hex-grid mapping</A></STRONG> </LI> <LI>Prev by thread: <STRONG><A HREF="msg00878.html">[MUD-Dev] Hex-grid mapping</A></STRONG> </LI> <LI>Next by thread: <STRONG><A HREF="msg00882.html">[MUD-Dev] Re: Hex-grid mapping</A></STRONG> </LI> <LI>Index(es): <UL> <LI><A HREF="index.html#00879"><STRONG>Date</STRONG></A></LI> <LI><A HREF="thread.html#00879"><STRONG>Thread</STRONG></A></LI> </UL> </LI> </UL> <!--X-BotPNI-End--> <!--X-User-Footer--> <!--X-User-Footer-End--> <ul><li>Thread context: <BLOCKQUOTE><UL> <LI><STRONG>[MUD-Dev] Re: Hex-grid mapping (example from PSL empire)</STRONG>, <EM>(continued)</EM> <ul compact> <LI><strong><A NAME="00894" HREF="msg00894.html">[MUD-Dev] Re: Hex-grid mapping (example from PSL empire)</A></strong>, Pericolo DiMorte <a href="mailto:choke#sirius,com">choke#sirius,com</a>, Wed 02 Dec 1998, 22:31 GMT <UL> <LI><strong><A NAME="00895" HREF="msg00895.html">[MUD-Dev] Re: Hex-grid mapping (example from PSL empire)</A></strong>, James Wilson <a href="mailto:jwilson#rochester,rr.com">jwilson#rochester,rr.com</a>, Thu 03 Dec 1998, 00:06 GMT </LI> </UL> </LI> </ul> </LI> <LI><strong><A NAME="00886" HREF="msg00886.html">[MUD-Dev] Re: Hex-grid mapping</A></strong>, quzah [sotfhome] <a href="mailto:quzah#softhome,net">quzah#softhome,net</a>, Wed 02 Dec 1998, 06:47 GMT <LI><strong><A NAME="00878" HREF="msg00878.html">[MUD-Dev] Hex-grid mapping</A></strong>, Matthew R. Sheahan <a href="mailto:chaos#crystal,palace.net">chaos#crystal,palace.net</a>, Tue 01 Dec 1998, 07:43 GMT <UL> <LI><strong><A NAME="00879" HREF="msg00879.html">[MUD-Dev] Re: Hex-grid mapping</A></strong>, Jon Leonard <a href="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</a>, Tue 01 Dec 1998, 08:16 GMT <UL> <LI><strong><A NAME="00882" HREF="msg00882.html">[MUD-Dev] Re: Hex-grid mapping</A></strong>, James Wilson <a href="mailto:jwilson#rochester,rr.com">jwilson#rochester,rr.com</a>, Wed 02 Dec 1998, 01:08 GMT <UL> <LI><strong><A NAME="00883" HREF="msg00883.html">[MUD-Dev] Re: Hex-grid mapping</A></strong>, Jon Leonard <a href="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</a>, Wed 02 Dec 1998, 01:53 GMT <UL> <LI><strong><A NAME="00884" HREF="msg00884.html">[MUD-Dev] Re: Hex-grid mapping</A></strong>, James Wilson <a href="mailto:jwilson#rochester,rr.com">jwilson#rochester,rr.com</a>, Wed 02 Dec 1998, 04:07 GMT <UL> <LI><strong><A NAME="00887" HREF="msg00887.html">[MUD-Dev] Re: Hex-grid mapping</A></strong>, Par Winzell <a href="mailto:zell#alyx,com">zell#alyx,com</a>, Wed 02 Dec 1998, 06:48 GMT </LI> </UL> </LI> </UL> </LI> </UL> </LI> </UL> </LI> </UL> </LI> </UL></BLOCKQUOTE> </ul> <hr> <center> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] </center> <hr> </body> </html>