Advertisement
Civilization Fanatics' Center  

Welcome to Civilization Fanatics' Center.

You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support.

Go Back   Civilization Fanatics' Forums > CIVILIZATION V > Civ5 - Creation & Customization > Civ5 - Modding Tutorials & Reference

Notices

Reply
 
Thread Tools
Old Jul 30, 2011, 03:24 PM   #1
Thalassicus
Bytes and Nibblers
 
Thalassicus's Avatar
 
Join Date: Nov 2005
Location: Texas
Posts: 10,263
Plus Coordinates

There's two coordinate systems used by the game, rectangular (also called cartesian or grid) and hex. Different parts of the lua code use different systems, so it's important to identify which one the function you're working with uses. Most things like plot:GetX() use the rectangular system. It's the one we're used to in most things in life. The hex form is tilted to line up along tile boundaries. I suspect it's used by the game core since adjacency is probably easier to calculate.

You can use these functions to convert between the two:

rectX rectY = ToGridFromHex(hexX, hexY)
hexX hexY = ToHexFromGrid(rectX, rectY)

Y values are vertical, and X values horizontal. They start at the bottom left of the map and progress in these positive directions:



Rectangular




Hex
__________________

We are the Modders. CiV will be assimilated.
We will enhance its biological and technological distinctiveness with our own.
Resistance is futile.


Communitas Expansion Pack
Wiki - Discussion - News


Forum Icons ~ Starting Civ5 Mods ~ Forum Tables

Last edited by Thalassicus; Jul 30, 2011 at 03:41 PM.
Thalassicus is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION V > Civ5 - Creation & Customization > Civ5 - Modding Tutorials & Reference > Coordinates

Thread Tools

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
Smilies are On
[IMG] code is On
HTML code is Off



Advertisement

All times are GMT -6. The time now is 12:21 PM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR