On my computer, The ultima online client seems to use 10 CPU and no more then 20,000K memory. (60 FPS)
Where as, mine uses no more then 6,000K memory, and 50 CPU +. I'm looking for a faster way to draw my tile by tile map, so it wont be needing as much CPU, and has high FPS results. (55 FPS)
Here are parts of my code you should be interested in looking at...
Start-up variables:
Code: Select all
Global MapWidth = 1000
Global MapHeight = 1000
Global ScreenWidth = 1024
Global ScreenHeight = 768
Structure tile
x.l
y.l
z.l
type.l
EndStructure
Global Dim Map.tile(MapWidth,MapHeight)
For i=1 To MapWidth
For b=1 To MapHeight
Map(i,b)\x=i
Map(i,b)\y=b
;Map(i,b)\type=
Next
Next
Code: Select all
Procedure RenderMap()
BottomRightX = ((ScreenWidth-1 + ScreenPosX) / TileWidth) - 1
BottomRightY = ((ScreenHeight-1 + ScreenPosY) / TileHeight ) * 2
If BottomRightX > MapWidth
BottomRightX = MapWidth
EndIf
If BottomRightY > MapHeight
BottomRightY = MapHeight
EndIf
If BottomRightX < MapWidth
BottomRightX = BottomRightX + 1
EndIf
If BottomRightY < MapHeight
BottomRightY = BottomRightY + 1
EndIf
TopLeftX = ScreenPosX / TileWidth
TopLeftY = (ScreenPosY / TileHeight) * 2
For y = TopLeftY To BottomRightY
For x = TopRightX To BottomRightX
IsoX = x * (TileWidth + (y & 1) * (TileWidth / 2)) - ScreenPosX
IsoY = y * (TileHeight / 2) - ScreenPosY
Select Map(x,y)\type
Case 0
DisplayTransparentSprite(floor1,IsoX,IsoY)
Case floor1
DisplayTransparentSprite(floor2,IsoX,IsoY)
EndSelect
Next
Next
EndProcedure
..::Origin::..