Drawing Maps in Xna and Scrolling

Started by G_G, March 08, 2010, 11:37:59 pm

Previous topic - Next topic

G_G

Okay well I ran into a little (more like big) problem. I'm going to make a small RPG engine in xna. Very basic, just for practice.

Okay so I have no idea how I'm going to create maps at all. How would one suggest doing it using a tileset? I was thinking having a few arrays. 3-5. Each array being its own layer. I was thinking having it setup like this.


int[] layer1 = new int[mapwidth * mapheight]

But I'm not sure how it would work after that.

I was also thinking about just having a map as an image and just having impassible objects on the impassible areas but then I couldn't have any depth without multiple images.

So any suggestions on this at all?

And another question I would have is scrolling. Perhaps someone could link me to an example of scrolling, it would be very helpful though I'll just most likely end up googling this part.

Fantasist

March 09, 2010, 12:17:46 am #1 Last Edit: March 09, 2010, 12:40:56 am by Mad Scientist Fantasist
I'm stuck with the same problem, though I'm not even sticking to a single engine right now ;_; Anyway, here are a few resources I came along that might be of great help:

Tile Based Games
Good tute on Tiling, but the code is in Flash. You can adapt the concepts, though.

Codeboje.de
This site is mainly python-related, but this particular page also has some generic tiling engines (like Tiled). Of course, to use one of those generic tilers, you would need a parser for your game to interpret them. But some of them are popular, so I hope you'll find something good which is already done.

GameDev.net's articles regarding tile-based games
There are a lot of good articles here discussing various aspects of tiling, from the basics to optimization.

For all it's worth, you can check out RMXP's tiling method and camera management (a.k.a scrolling). You can take a look at one of those Tileset class rewrites to get an idea about the internal implementation of RMXP's tiling system.

PS: If it's just for practice, nvm, but otherwise...
Spoiler: ShowHide

If you want to look at other RPG engines (freeware ones at that!), check out:

001 Action/RPG Maker

Sphere

ika (I don't really like it, though)

The problems with these engines are:
- Very tough learning curve when compared to RMXP.
- Not 100% stable (crashes sometimes).
- No readily available good resources (except maybe 001, which has an amazing system for graphics, but the graphics themselves are not as good as RMXP).
- On-map battle system, no readily available scene-based battle system.
- 001 doesn't have a scripting language (I'm not sure, but I hope that I'm wrong!)
- The mapping environment and controls are not as intuitive as RMXP.

The good things about them are:
- Amazing flexibility when compared to RMXP.
- Amazing power when compared to RMXP (all blend types are supported, but for example, accurate character shadows and lighting are default for some of them).
- Free! (But read the licenses, they do implement some restrictions!)
- 001 has visual eventing; much better than RMXP ;) (Check the screenshot in the 4th row and second column. These are old, the latest version makes those boxes look much better :3)

These are the engines I'm considering for now. Though, I love pyglet and I'm currently trying to make a tiling engine from scratch for it, that's how I came across all those resources.

PPS: In the end, RMXP is by far the easiest RPG making tool I've ever laid my hands on.

PPPS: Hey, if you know about anything that might help me, I'd appreciate it if you share it with me :)
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




winkio

1) 3 dimensional array, not a series of two dimensional arrays
2) that first link that fantasist gave is excellent (I used it a lot myself a few years back)
3) XNA has a platformer demo game, look into that.  It doesn't have scrolling, but it does have tile maps

G_G

Quote from: Arceus on March 09, 2010, 12:41:18 am
1) 3 dimensional array, not a series of two dimensional arrays
2) that first link that fantasist gave is excellent (I used it a lot myself a few years back)
3) XNA has a platformer demo game, look into that.  It doesn't have scrolling, but it does have tile maps


@1: Of course, seems simpler. xD
@2: I'll take a look at it then.
@3: I looked into it, and noticed all levels are in text files. I'm sure thats one of the only ways I can pull it off. But is there an easier way than this?

Quote from: Mad Scientist Fantasist on March 09, 2010, 12:17:46 am
I'm stuck with the same problem, though I'm not even sticking to a single engine right now ;_; Anyway, here are a few resources I came along that might be of great help:

Tile Based Games
Good tute on Tiling, but the code is in Flash. You can adapt the concepts, though.

Codeboje.de
This site is mainly python-related, but this particular page also has some generic tiling engines (like Tiled). Of course, to use one of those generic tilers, you would need a parser for your game to interpret them. But some of them are popular, so I hope you'll find something good which is already done.

GameDev.net's articles regarding tile-based games
There are a lot of good articles here discussing various aspects of tiling, from the basics to optimization.

For all it's worth, you can check out RMXP's tiling method and camera management (a.k.a scrolling). You can take a look at one of those Tileset class rewrites to get an idea about the internal implementation of RMXP's tiling system.

PS: If it's just for practice, nvm, but otherwise...
Spoiler: ShowHide

If you want to look at other RPG engines (freeware ones at that!), check out:

001 Action/RPG Maker

Sphere

ika (I don't really like it, though)

The problems with these engines are:
- Very tough learning curve when compared to RMXP.
- Not 100% stable (crashes sometimes).
- No readily available good resources (except maybe 001, which has an amazing system for graphics, but the graphics themselves are not as good as RMXP).
- On-map battle system, no readily available scene-based battle system.
- 001 doesn't have a scripting language (I'm not sure, but I hope that I'm wrong!)
- The mapping environment and controls are not as intuitive as RMXP.

The good things about them are:
- Amazing flexibility when compared to RMXP.
- Amazing power when compared to RMXP (all blend types are supported, but for example, accurate character shadows and lighting are default for some of them).
- Free! (But read the licenses, they do implement some restrictions!)
- 001 has visual eventing; much better than RMXP ;) (Check the screenshot in the 4th row and second column. These are old, the latest version makes those boxes look much better :3)

These are the engines I'm considering for now. Though, I love pyglet and I'm currently trying to make a tiling engine from scratch for it, that's how I came across all those resources.

PPS: In the end, RMXP is by far the easiest RPG making tool I've ever laid my hands on.

PPPS: Hey, if you know about anything that might help me, I'd appreciate it if you share it with me :)



Thanks for the links, I'll be sure to check them out.