Archived

This topic is now archived and is closed to further replies.

airickjay

static map generation

Recommended Posts

Hi all, I have a concept for an online campaign manager for my local tabletop wargame group which is a non-animated, turn-based (Yes, there are some of us left who play those! )system capable of being run through a browser. The data for the map, contents, and player positions are going to be stored in a database and the idea I have is to pull the data from the DB and use it along with a library of pregenerated maps and icons to regenerate the map with up to date information and send it back to the browser. Is this a good idea? and if so, what is the easiest way of doing it, I know a little C++ and program in PHP. Thanks all! Eric J.

Share this post


Link to post
Share on other sites
If it''s going to be web-based, you may want to use Java or Perl (or maybe even Lingo?), and not write a client app in C++.

Basically, I think the database should simply contain per-player information, the hight and width of the map, and then a list of tiles, with the tile type, the units on it, etc. The list can be linear, because, given the height and width of the map, you can determine which item in a list is appropriate. So you could even store it in a simple text file, especially if you wanted to write a server and client software.

What I mean by getting data from a 1d list given 2d coordinates is this:

Take a 2d map:

01-02-03-04
05-06-07-08
09-10-11-12

And transform it into a list like so:

01-02-03-04-05-06-07-08-09-10-11-12

If z is the index of a 1d array you want to find, then, given 2d coordinates x and y:

z = y * width + x

OR

z = (y * width - 1) + x
//if the array starts at 0.

That would be a simple system.

Share this post


Link to post
Share on other sites