View previous topic - View next topic |
Author |
Message |
Terry Spectral Form
Joined: 16 Jun 2002 Posts: 798 Location: Dublin, Ireland
|
Posted: Thu Aug 25, 2005 7:45 pm Post subject: |
[quote] |
|
ow, yes, something silly like that. Thanks. It's working now.
I'll post more questions when I enevitably have them... _________________ http://www.distractionware.com
|
|
Back to top |
|
|
Ren Wandering Minstrel
Joined: 07 Aug 2004 Posts: 130 Location: turn around...
|
Posted: Fri Sep 02, 2005 11:30 pm Post subject: |
[quote] |
|
Well, i'd love to give tiled another go again. I'm having a couple of teething problems though, sorry to clog up the thread:
ElvenProgrammer wrote: | For example if you export your map as a .wlk file (the server map format used by themanaworld), you'll get a file containing the width and height of the map and then for each tile a 0 if it's walkable and 1 if not. |
It sounds fantastic, but I can't seem to see it. I've tried a couple of methods of picking up the data in freebasic, but the file doesn't seem to hold anything really. I'm not sure if I just don't understand it, or if there's been a write error. Any ideas would be great, cheers. _________________ Previous nicks: MidnightDreamer, The_Anarchist, Shroomasta.
ren-tek.net : BGC games and more!
|
|
Back to top |
|
|
Bjorn Demon Hunter
Joined: 29 May 2002 Posts: 1425 Location: Germany
|
Posted: Tue Sep 06, 2005 11:31 pm Post subject: |
[quote] |
|
Ren wrote: | It sounds fantastic, but I can't seem to see it. I've tried a couple of methods of picking up the data in freebasic, but the file doesn't seem to hold anything really. I'm not sure if I just don't understand it, or if there's been a write error. Any ideas would be great, cheers. |
The .wlk file is in binary format. Here's how it is saved:
Code: | (java.io.OutputStream out)
int width = layer.getWidth();
int height = layer.getHeight();
// Write width and height
out.write((width ) & 0x000000FF);
out.write((width >> 8) & 0x000000FF);
out.write((height ) & 0x000000FF);
out.write((height >> 8) & 0x000000FF);
for (int y = 0; y < height; y++) {
for (int x= 0; x < width; x++) {
Tile tile = ((TileLayer)layer).getTileAt(x, y);
if (tile != null && tile.getId() > 0) {
out.write(1);
} else {
out.write(0);
}
}
} |
Each call to write is writing a byte to the output file. You should be able to figure out how to read this file from this code. Expect first width and height, stored with 2 bytes each, and then a 0 non-colliding tile and a 1 for a colliding tile.
I'm not sure why you are trying to read this collision format with FreeBASIC though, it's specifically meant for eAthena which as a server only needs to care about collision data and nothing else.
|
|
Back to top |
|
|
Ren Wandering Minstrel
Joined: 07 Aug 2004 Posts: 130 Location: turn around...
|
Posted: Wed Sep 07, 2005 12:27 am Post subject: |
[quote] |
|
Bjørn wrote: | I'm not sure why you are trying to read this collision format with FreeBASIC though, it's specifically meant for eAthena which as a server only needs to care about collision data and nothing else. |
And here I was wondering why i'm getting a row of 0's. I think I misunderstood the original post in that I assumed the .wlk file had a simple collision system on top of actual map data. Obviously, the collision data on it's own is pretty useless to me really. Cheers anyway, sorry to waste your time like that. I guess it's back to the drawing board. _________________ Previous nicks: MidnightDreamer, The_Anarchist, Shroomasta.
ren-tek.net : BGC games and more!
|
|
Back to top |
|
|
|
Page 3 of 3 |
All times are GMT Goto page Previous 1, 2, 3
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|