SyntaxBomb - Indie Coders

General Category => Showcase => Topic started by: iWasAdam on December 08, 2017, 15:12:56

Title: FontMap released
Post by: iWasAdam on December 08, 2017, 15:12:56
This is the first public release of the fontmap creator for making your own game levels.
(https://img.itch.zone/aW1hZ2UvMjAzNDc4Lzk1MTE3OC5wbmc=/original/4SbOW1.png)

You can get it here:
https://adamstrange.itch.io/fontmap (https://adamstrange.itch.io/fontmap)

It includes details of the file format and very simple source code for monkey2 for loading and saving.
Title: Re: FontMap released
Post by: Qube on December 08, 2017, 22:21:32
Nice! :) - Any plans to do a loader for AGK?
Title: Re: FontMap released
Post by: Dabz on December 08, 2017, 23:17:16
One feature I've always wanted to see in a tilemap editor is an incorporated pixel editor, so, basically, you can start tiles from afresh,add or edit to an existing set, and when editing a single tile, it's updated live (if you like) on the tilemap.

You never see that, and I've never understood why not, because it'll be bloody handy.

Dabz

Title: Re: FontMap released
Post by: Naughty Alien on December 09, 2017, 02:00:38
+1
Title: Re: FontMap released
Post by: GaborD on December 09, 2017, 02:32:23
Looks really good!
Agree to what Dabz said.
Title: Re: FontMap released
Post by: iWasAdam on December 09, 2017, 06:50:02
QuoteAny plans to do a loader for AGK?
I've never used it, but the support code should be simple to write

@Dabs - Well. I can roll the fontsprite editor and palette editor into a single app as a future thought ;)
Title: Re: FontMap released
Post by: Steve Elliott on December 09, 2017, 10:41:56
Good stuff.
Title: Re: FontMap released
Post by: RonTek on December 11, 2017, 09:09:15
Nice tool.
Title: Re: FontMap released
Post by: iWasAdam on December 11, 2017, 10:15:22
Here is the FileFormat details:
– header –
(4 bytes) int = -9999

(4 bytes) int = number of layers

– layer data –
(4 bytes) int = width of layer (0 aligned)

(4 bytes) int = height of layer (0 aligned)

starting from top left, data is read down the height, then across to the next x cell and continues down until all data is read

– cell data –
(2 bytes) short = map character (referencing the character font)

(2 bytes) short = color reference (referencing the color palette)

and here is the monkey2 code to read in the data

'a map file can contain up to 32 maps with a resolution of 128x128
field _tileMap:short[, , ] = New short[32, 128, 128]
field _colorMap:short[, , ] = New short[32, 128, 128]

method Load( filePath:string )
Print "loading..."

Local fStream:Stream = Stream.Open( filePath, "r" )
If not fStream Then
Print filePath + " not opened"
Return
End If

local id:int = fStream.ReadInt()
If id <> -9999 Then
Print filePath + " ID error"
fStream.Close()
Return
End If

local layers:int = fStream.ReadInt()

Local k:int
For k = _mapLayer To _mapLayer+layers-1
If k < 32 Then
LoadLayer( fStream, k )
End If
Next

fStream.Close()
End method

method LoadLayer( Stream:Stream, layer:int )
_loadX = Stream.ReadInt()
_loadY = Stream.ReadInt()

Print "layer "+layer+" size is "+(_loadX+1)+" "+(_loadY+1)

Local rt:short
Local cl:short

Local x:int
Local y:int
For x = 0 To _loadX
For y = 0 To _loadY
cl = Stream.ReadShort()
rt = Stream.ReadShort()
If x < 128 And y < 128 Then
_tileMap[ layer, x, y] = Clamp( int(cl), 0, 255 )
_colorMap[ layer, x, y] = Clamp( int(rt), 0, 255 )
End if
Next
Next
end method