FontMap released

Started by iWasAdam, December 08, 2017, 15:12:56

Previous topic - Next topic

iWasAdam

This is the first public release of the fontmap creator for making your own game levels.


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

It includes details of the file format and very simple source code for monkey2 for loading and saving.

Qube

Nice! :) - Any plans to do a loader for AGK?
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Dabz

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

Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Naughty Alien


GaborD

Looks really good!
Agree to what Dabz said.

iWasAdam

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 ;)

Steve Elliott

Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb


iWasAdam

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