Mirage Source http://web.miragesource.net/forums/ |
|
MS4 Seamless Maps http://web.miragesource.net/forums/viewtopic.php?f=201&t=4199 |
Page 1 of 2 |
Author: | Jacob [ Mon Aug 25, 2008 2:36 pm ] |
Post subject: | MS4 Seamless Maps |
Ok, so i started to program in seamless maps for MS4. Maybe some others can help finish it up and make it better. Code: ' Seamless maps Public Const MAXX As Byte = (MAX_MAPX * 3) + 3 Public Const MAXY As Byte = (MAX_MAPY * 3) + 3 Code: ' Used for seamless maps Public Enum Compass NorthWest = 0 North = 1 NorthEast = 2 West = 3 Center = 4 East = 5 SouthWest = 6 South = 7 SouthEast = 8 End Enum Code: Public SMaps(Compass.NorthWest To Compass.SouthEast) As MapRec Public Tiles(0 To MAXX, 0 To MAXY) As TileRec Code: Sub iLoadMap(MapNum As Long, ByVal Size As Byte) Dim FileName As String Dim f As Long FileName = App.Path & MAP_PATH & "map" & MapNum & MAP_EXT If FileExist(FileName, True) Then f = FreeFile Open FileName For Binary As #f Get #f, , SMaps(Size) Close #f End If End Sub Sub LoadSurroundingMaps() Dim MapNum As Long Dim BlankMap As MapRec Dim i As Byte ' [0] [1] [2] ' [3] [4] [5] ' [6] [7] [8] ' NorthWest = 0 ' North = 1 ' NorthEast = 2 ' West = 3 ' Center = 4 ' East = 5 ' SouthWest = 6 ' South = 7 ' SouthEast = 8 SMaps(Compass.Center) = Map ' North MapNum = Map.Up If MapNum > 0 Then Call iLoadMap(MapNum, Compass.North) Else SMaps(Compass.North) = BlankMap End If ' East MapNum = Map.Right If MapNum > 0 Then Call iLoadMap(MapNum, Compass.East) Else SMaps(Compass.East) = BlankMap End If ' South MapNum = Map.Down If MapNum > 0 Then Call iLoadMap(MapNum, Compass.South) Else SMaps(Compass.South) = BlankMap End If ' West MapNum = Map.Left If MapNum > 0 Then Call iLoadMap(MapNum, Compass.West) Else SMaps(Compass.West) = BlankMap End If ' NorthEast MapNum = SMaps(Compass.North).Right If MapNum = 0 And SMaps(Compass.East).Up > 0 Then MapNum = SMaps(Compass.East).Up If MapNum > 0 Then Call iLoadMap(MapNum, Compass.NorthEast) Else SMaps(Compass.NorthEast) = BlankMap End If ' SouthEast MapNum = SMaps(Compass.East).Down If MapNum = 0 And SMaps(Compass.South).Right > 0 Then MapNum = SMaps(Compass.South).Right If MapNum > 0 Then Call iLoadMap(MapNum, Compass.SouthEast) Else SMaps(Compass.SouthEast) = BlankMap End If ' SouthWest MapNum = SMaps(Compass.South).Left If MapNum = 0 And SMaps(Compass.West).Down > 0 Then MapNum = SMaps(Compass.West).Down If MapNum > 0 Then Call iLoadMap(MapNum, Compass.SouthWest) Else SMaps(Compass.SouthWest) = BlankMap End If ' NorthWest MapNum = SMaps(Compass.West).Up If MapNum = 0 And SMaps(Compass.North).Left > 0 Then MapNum = SMaps(Compass.North).Left If MapNum > 0 Then Call iLoadMap(MapNum, Compass.NorthWest) Else SMaps(Compass.NorthWest) = BlankMap End If CreateTileView End Sub Code: Sub CreateTileView() Dim X As Long, Y As Long, i As Long Dim MapX As Long, MapY As Long Dim EmptyTiles As TileRec For i = Compass.NorthWest To Compass.SouthEast For X = 0 To MAX_MAPX For Y = 0 To MAX_MAPY MapX = (MAX_MAPX * (i Mod 3)) + X MapY = (MAX_MAPY * (i \ 3)) + Y Tiles(MapX, MapY) = SMaps(i).Tile(X, Y) Next Next Next End Sub Code: Public DDSD_LowerBuffer As DDSURFACEDESC2 Code: With DDSD_LowerBuffer .lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH .ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN .lWidth = (MAXX) * PIC_X .lHeight = (MAXY) * PIC_Y End With Code: Set DD_LowerBuffer = DD.CreateSurface(DDSD_LowerBuffer) Changes to BltMap Code: With rec .Top = 0 .Bottom = DDSD_LowerBuffer.lHeight .Left = 0 .Right = DDSD_LowerBuffer.lWidth End With ' clear buffers Call DD_LowerBuffer.BltColorFill(rec, MASK_COLOR) Call DD_UpperBuffer.BltColorFill(rec, MASK_COLOR) For X = 0 To MAXX For Y = 0 To MAXY With Tiles(X, Y) GameLoop Code: MapXOffset = Int(MAX_MAPX / 2) + GetPlayerX(MyIndex) MapYOffset = Int(MAX_MAPY / 2) + GetPlayerY(MyIndex) With Camera .Top = MapYOffset * PIC_Y .Bottom = .Top + (MAX_MAPY + 1) * PIC_Y .Left = MapXOffset * PIC_X .Right = .Left + (MAX_MAPX + 1) * PIC_X End With 'Now that all the drawing routines are done, draw everything to the backbuffer. Call DD_BackBuffer.BltFast(0, 0, DD_LowerBuffer, Camera, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) I think that was everything i had started. Some parts come from the old seamless maps tutorial, some of it my own. |
Author: | Asrrin29 [ Mon Aug 25, 2008 9:07 pm ] |
Post subject: | Re: MS4 Seamless Maps |
and you couldn't ask me for help why?! |
Author: | Jacob [ Tue Aug 26, 2008 12:07 pm ] |
Post subject: | Re: MS4 Seamless Maps |
This is for MS4, I have the code for the other seamless maps. |
Author: | Asrrin29 [ Tue Aug 26, 2008 12:40 pm ] |
Post subject: | Re: MS4 Seamless Maps |
I woulda still helped |
Author: | Hikaru [ Tue Aug 26, 2008 7:09 pm ] |
Post subject: | Re: MS4 Seamless Maps |
Seamless Maps is when you can adjust the size of the maps right? |
Author: | one [ Wed Aug 27, 2008 1:07 am ] |
Post subject: | Re: MS4 Seamless Maps |
Nope, with seamless maps the next map will already be loaded when you get to a mapborder, so you wont really notice when switching to another map. So, does this code yet work? Whats your difference in uncapped fps? |
Author: | Lea [ Wed Aug 27, 2008 4:27 am ] |
Post subject: | Re: MS4 Seamless Maps |
Seamless is where you stand in the center of the map and the map moves. The borders are hidden and unnoticeable, hence "seamless" |
Author: | Hikaru [ Wed Aug 27, 2008 4:59 am ] |
Post subject: | Re: MS4 Seamless Maps |
So then what's the different between seamless and scrolling if it's like that? |
Author: | Lea [ Wed Aug 27, 2008 5:08 am ] |
Post subject: | Re: MS4 Seamless Maps |
scrolling might have large size maps but still have map transitions. Seamless doesn't have map transitions. |
Author: | DarkC [ Mon Sep 15, 2008 1:35 pm ] |
Post subject: | Re: MS4 Seamless Maps |
Does this work now? Or is it not done? |
Author: | Jacob [ Mon Sep 15, 2008 1:38 pm ] |
Post subject: | Re: MS4 Seamless Maps |
Not done, it was just a basic idea / start. |
Author: | DarkC [ Mon Sep 15, 2008 1:43 pm ] |
Post subject: | Re: MS4 Seamless Maps |
Alrighty, I'll try to finish it later. If I do, I'll put up how I did it. |
Author: | one [ Mon Sep 15, 2008 4:28 pm ] |
Post subject: | Re: MS4 Seamless Maps |
also displaying npcs and players on surrounding maps would be cool... but it would mean that playermovements for 9 maps have to be send, thus up to 9x the traffic... |
Author: | Mattyw [ Sun Sep 21, 2008 12:53 am ] |
Post subject: | Re: MS4 Seamless Maps |
DarkC wrote: Alrighty, I'll try to finish it later. If I do, I'll put up how I did it. Tried? ;D |
Author: | GIAKEN [ Fri Oct 10, 2008 7:10 am ] |
Post subject: | Re: MS4 Seamless Maps |
Finish this Dugor baby. |
Author: | Labmonkey [ Sun Oct 12, 2008 4:07 pm ] |
Post subject: | Re: MS4 Seamless Maps |
one wrote: also displaying npcs and players on surrounding maps would be cool... but it would mean that playermovements for 9 maps have to be send, thus up to 9x the traffic... At max if you optimize it right you will only send 4 map's data. |
Author: | one [ Sun Oct 12, 2008 9:44 pm ] |
Post subject: | Re: MS4 Seamless Maps |
Labmonkey wrote: one wrote: also displaying npcs and players on surrounding maps would be cool... but it would mean that playermovements for 9 maps have to be send, thus up to 9x the traffic... At max if you optimize it right you will only send 4 map's data. uhm right, 4 maps would be enough, didnt really think about it ^^" anyway, that would be awesome. |
Author: | Sh4rk [ Sun Jan 18, 2009 6:35 pm ] |
Post subject: | Re: MS4 Seamless Maps |
Someone finish it ? |
Author: | timster0 [ Mon Jan 19, 2009 12:11 am ] |
Post subject: | Re: MS4 Seamless Maps |
Wow, looking good. Hope it gets finished. |
Page 1 of 2 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |