Sign in to follow this  
PsychotomusSimmm

having troubles saving map into sections

Recommended Posts

I have a tile map t hat is about over 500x500 tiles in width and height. i need to save each screen of the map into its own file such as 1-1 1-2 1-3ect. 2-1 2-2 ect. till the map is finished saving as it will be distributed via server for a mmorpg game as they aproach each section of the map. the startx and starty start as 0. i'm saving every the first 25 tiles width and 20 tiles height in 1-1 then trying to save the next 26-50 tiles in width and 20 tiles in height as 1-2, but with same co-ords of the tiles as if it was the first section of the map. all tiles are the same size, but my Objects are not. theres another loop like that one but for objects, if I can get the tile saving to save sorrectly then the object saving will work the same way hence the reason I didnt post that part. Code: Private Type Objects_ x As Single y As Single XCenterPixel As Single YCenterPixel As Single layer As Single trigger As String TextureRefNum As Long Texture As String Rotate As Single TileRefNum As Long color As Long Dropable As Boolean Render As Boolean XSector As Long YSector As Long RenderOrder As Long AniMillSec As Integer AniNextTileRef As Integer End Type Private Type TileStorage x As Single x2 As Single x3 As Single x4 As Single y As Single y2 As Single y3 As Single y4 As Single XCenterPixel As Single YCenterPixel As Single trigger As String Objects() As Objects_ Char As CharEquip TileRefNum As Long layer As Integer TextureRefNum As Long Texture As String Walk As Boolean Used As Boolean color As Long XSector As Long YSector As Long AniMillSec As Integer AniNextTileRef As Integer End Type Dim Map(0 To 500, 0 To 500) As TileStorage TheCounter = 0 SectoredX = 0 SectoredY = 0 Do DoEvents SectoredX = SectoredX + 1 SectoredY = 0 Do DoEvents SectoredY = SectoredY + 1 Open App.path & "\world_map1\" & SectoredX & "-" & SectoredY & ".NWM" For Output As #1 For x = StartX To StartX + 25 For y = StartY To StartY + 20 If Map(x, y).Used = True Then TextureName = Replace(TheTextures(Map(x, y).TextureRefNum), App.path & "\tiles\", "") Print #1, TextureName Print #1, (Map(x, y).x Mod 768) Print #1, (Map(x, y).y Mod 608) Print #1, Map(x, y).trigger Print #1, Map(x, y).color Print #1, Map(x, y).layer End If Next y Next x Close #1 StartX = StartX + 25 Loop Until StartX >= MaxXMatrixPos StartX = 0 StartY = StartY + 20 Loop Until StartY >= MaxYMatrixPos

Share this post


Link to post
Share on other sites
I fail to see the problem in the question above... but if I understood you correctly something similar would do... (pseudo code).


for (Y < map.height/tilesPerScreen.y)
for (X < map.width/tilesPerScreen.x)
{
for (y < tilesPerScreen.y)
for (x < tilesPerScreen.x)
{
map[X*tilesPerScreen.x][Y*tilesPerScreen.y].coord = x,y;
saveToFile <- map[X*tilesPerScreen.x][Y*tilesPerScreen.y]
}
}



Cheerios!

/Robert

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this