Jump to content

Recommended Posts

  • 1 month later...
Posted

I'm not sure if this will work with whatever scripting language you finally decide to use but if I want to quickly and simply program a map/board into a game without having to resort to geometry I usually create a regional indice matrix that partitions off the map into hundreds or thousands of tiles of a uniform demention in pixels, depending on how large the map is and how accurately I want the program to interpret it.

  • 2 weeks later...
Posted

oh poo,

sorry

anyway if you want to see more boardgame pics have a look at

www.dunefilmbook.com

look in games section, i particularly like the custom wood table.

rgds

OrLoK

  • 10 months later...
Posted

I was asked in Private Message to elaborate on my suggestion of how to program maps to have odd-shaped regions without having to resort to geometry.  Since someone else some day down the road might also be curious, I've decided to respond here publicly.

The gist of it is that you create a variable array to associate portions of the map to specified regions.  I generally use multidimentional arrays (i.e. matrices); however, a single dimention array is just fine and a little more memory friendly.  When you receive the X and Y coordiantes of the mouseclick, that data is used to identify a single variable of the array and that variable contains region index, preset by you.

Let's say your screen/map is 640x480 pixels in resolution.  Having a variable dedicated for each pixel could be memory consuming so we'll scale our array to a 64x48 matrix, essentially dividing the map into a grid.  Each variable in our map array will now accound for a 10x10 pixel square on our map, 100 pixels alotgether.

When the user clicks on the map we receive the X and Y coordinate of that click, let's say they clicked on coordinate 281,407.  Scaling that down we end up with coordiantes 28,41.  Now we use these scaled coordiantes to locate the correct varaable in our array.  With a matrix, we'd just plug in the numbers directly so we'd look up variable(28,41).  With a single dimention array we'd look up variable(28*48+41), that is the sum of X coordinate multiplied by the Y dimention and the Y coordinate.

The array contains the data of which region each portion of the map represents.  Since you can associate the same region to more than one part of the map, this allows you to create odd shaped regions.

I hope that helps some.

--Bashar

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.