Using A 3D Array To Store Maps

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

Using A 3D Array To Store Maps

Post by davidthefat »

Is this an efficient way to do it?

int Maps[Map ID][X][Y];

So the first bracket stores the map ID, then the X and the Y stores the tile ID
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: Using A 3D Array To Store Maps

Post by K-Bal »

This is so much out of context :lol:
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: Using A 3D Array To Store Maps

Post by GroundUpEngine »

dude... the KISS principle :lol:

Code: Select all

// Instead of Map ID's just use Map objects e.g.
class Map() {
  public:
    int** Data;
    Map(int _width, int _height);
    virtual ~Map();
    Render();
}
XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

Re: Using A 3D Array To Store Maps

Post by XianForce »

GroundUpEngine wrote:dude... the KISS principle :lol:
Gotta love that KISS =D
Post Reply