SAS Map Editor

BlitzMax Forums/BlitzMax Programming/SAS Map Editor

Scott Shaver(Posted 2005) [#1]
I've built a simple srolling tile map editor for use with BlitzMax the source is included as well as a few samples and html docs. This is an alpha V0.01. Both MacOS X and Windows executables are included in the zip.

You can find more info here: http://www.scottshaver2000.com/forum/viewtopic.php?t=99


Filax(Posted 2005) [#2]
Very nice ! but don't forget to distribute iglass font with your app !
because the gadget are redrawed with graphics glitch !

Good job scott :)


Scott Shaver(Posted 2005) [#3]
Opps, I thought the fonts got incbin'd into the exes, they seem to run fine on my machines without them. Where should I look for the glitches?


Filax(Posted 2005) [#4]
Notify : i have try to copy the iglass font under you exe folder
but don't work ! i think that you must import bmax font class under
your framework ?

Lol :) sorry you are right about font incbin :) i think that the import
command is the solution.import blr.font

Example of glitch : Extract your app under desktop and execute .
go to menu and load a map. you will see the file listbox glitch
behind combobox, due to bad font height computing.


Perturbatio(Posted 2005) [#5]
it runs for me fine.


Filax(Posted 2005) [#6]
hi scott :

Try to comment :

'Framework BRL.GlMax2D

'Import BRL.System
'Import BRL.Basic
'Import BRL.pngloader
'Import BRL.Retro
'Import iglass.igl

You will see the graphic difference with button and listbox font !


Scott Shaver(Posted 2005) [#7]
Yep I see the little placement problem, I'll fix it next time around. That is strange. There is also a bug when you exit it always thinks the loaded map has changed and asks if you really want to quit. It has something to do with the click on the exit menu item being detected by the editor draw code. The maps do get saved properly though.


Scott Shaver(Posted 2005) [#8]
6/22/2005
The second alpha release V0.2 is now up on the site.
Version: 0.2 (Alpha)
Release Date: 6/22/2005
Changes:
Added support for handling the parallax values in the layers.
Added support for displaying a cell grid to make find cells easier.
Added transparency support for each cell in each layer.
Updated the documentation.
Only the Window Exes are included this time but the source is still there so Mac users can build it.


LeisureSuitLurie(Posted 2005) [#9]
Well, I could if I owned iGlass...which I don't. :(

If you put up a Mac build, I'll mail you cookies.


Scott Shaver(Posted 2005) [#10]
well I wasn't going to put up another one until I had more changes but here we go.

6/23/2005
The third alpha release V0.3 is now up on the site.
Version: 0.3 (Alpha)
Release Date: 6/22/2005
Changes:
General bug fixes.
Windows and Mac executables are included.


Filax(Posted 2005) [#11]
you have alway the font problem :) solve this by comment

'Framework BRL.GlMax2D
'Import BRL.System
'Import BRL.Basic
'Import BRL.pngloader
'Import BRL.Retro
'Import pub.igl

you exe will be a little bit more bigger but you solve problem :)


Scott Shaver(Posted 2005) [#12]
That isn't reasonable fix. :) I wan't the exe to be as small as possible. There must be another solution.


Kernle 32DLL_2(Posted 2005) [#13]
upx compression


LeisureSuitLurie(Posted 2005) [#14]

well I wasn't going to put up another one until I had more changes but here we go.

6/23/2005
The second alpha release V0.2 is now up on the site.
Version: 0.3 (Alpha)
Release Date: 6/22/2005
Changes:
General bug fixes.
Windows and Mac executables are included.



What kind of cookies do you like, Scott?

;)


LeisureSuitLurie(Posted 2005) [#15]
Drat! When I launch it no video modes are offered. Can't do anything with it. :(


Scott Shaver(Posted 2005) [#16]
Yikes. Is the video mode select window showing up but it is just empty?

go into the directory where the SAS Map Editor.app file is located and create a text file named mapeditor.cfg with a single line in it with the following:

screen mode:800 x 600 x 32 @ 85


Let me know if that works.


LeisureSuitLurie(Posted 2005) [#17]
I'll try it when I get home.

It might be because I use an iMac which has the LCD, so hertz is not really a factor.


Scott Shaver(Posted 2005) [#18]
Hmm maybe I'll have to put in a config option for not using the hertz parameter. I think the above will work for you though.

you can also try

screen mode:800 x 600 x 32 @ -1


but that causes an uncontrolled frame rate so scrolling the map will be way too fast.


Scott Shaver(Posted 2005) [#19]
Another alpha release V0.3.1 is now up on the site.
Version: 0.3.1 (Alpha)
Release Date: 6/27/2005
Changes:
General bug fixes.
New sample programs.
Windows and Mac executables are included.

Screen shots and explainations of the examples are here:

http://www.scottshaver2000.com/forum/viewtopic.php?t=101


Scott Shaver(Posted 2005) [#20]
Version: 0.3.2 (Alpha)
Release Date: 7/11/2005
Changes:
General bug fixes.
Added transparent color control.
Added background color control.
Added tile selector window.
Updated the documentation.
Updated the file format to 1.1. Still reads 1.0 maps but only saves to 1.1.
Windows and Mac executables are included.


Scott Shaver(Posted 2005) [#21]
I screwed up the zip and included the wrong exe for windows. If you have already downloaded it please do so again. sorry.


Scott Shaver(Posted 2005) [#22]
Version: 0.4.0 (Alpha)
Release Date: 8/4/2005
Changes:
Updated the documentation.
Fixed a bug in the tile selector window that caused only some tiles to be displayed.
Removed the recent files menu item, until I get around to making it work.
Removed the layer properties menu item, until I need it.
Added support for the mouse scroll wheel to select the current draw tile.
Added the ability to shift the cells in the current layer with the arrow keys when the shift key is pressed
Added the ability to shift the cells in all layers with the arrow keys when the control key is pressed
Windows and Mac executables are included.

I may have the wrong Mac exe in the archive could someone please run it on a Mac and verify that the Help|About dialog says 0.4.0?


Scott Shaver(Posted 2005) [#23]
http://www.scottshaver2000.com/forum/viewtopic.php?p=382

Version: 0.4.1 (Alpha)
Release Date: 12/4/2005
Changes:
Allow tiles of up to 512x512 in size now.
Made loading and saving large maps much faster.
Version: 0.4.1 (Alpha)


Scott Shaver(Posted 2006) [#24]
Version: 0.4.2 (Alpha)
Release Date: 1/31/2006
Changes:
fix code to work with iglass 1.5.4 and blitzmax 1.16
This contains only the windows exes


WarpZone(Posted 2006) [#25]
Hello.

I am using blitzMax 1.16

I don't have iglass, so I commented out the following code:

'Framework BRL.GlMax2D
'Import BRL.System
'Import BRL.Basic
'Import BRL.pngloader
'Import BRL.Retro
'Import pub.igl

I copied the libs folder to C:\BlitzMax\SAS_Map_Editor which is where BlitzMax's errors said it was looking for the libs folder.

I am trying to compile sample1.bmx in its original install location, which on my computer is C:\BlitzMax\SAS_Map_Editor\samples

Unfortunately, I can't seem to get it to compile. My compile output looks like this:

Building Sample1
Compiling:Sample1.bmx
flat assembler version 1.64
4 passes, 0.1 seconds, 110777 bytes.
Linking:Sample1.debug.exe
C:/BlitzMax/SAS_Map_Editor/samples/.bmx/Sample1.bmx.gui.debug.win32.o(code+0x62): undefined reference to `__bb_cocoamaxgui_cocoamaxgui'
C:/BlitzMax/SAS_Map_Editor/samples/.bmx/Sample1.bmx.gui.debug.win32.o(code+0x71): undefined reference to `__bb_fltkmaxgui_fltkmaxgui'
C:/BlitzMax/SAS_Map_Editor/samples/.bmx/Sample1.bmx.gui.debug.win32.o(code+0x8a): undefined reference to `__bb_maxgui_maxgui'
C:/BlitzMax/SAS_Map_Editor/samples/.bmx/Sample1.bmx.gui.debug.win32.o(code+0xb2): undefined reference to `__bb_win32maxgui_win32maxgui'
Build Error: Failed to link C:/BlitzMax/SAS_Map_Editor/samples/Sample1.debug.exe
Process complete

What am I doing wrong? How can I fix it?

Thank you! :)


Scott Shaver(Posted 2006) [#26]
you need to copy the libs directory into the directory that holds the samples.

c:\maped\
c:\maped\samples
c;\maped\libs

have fun


Scott Shaver(Posted 2006) [#27]
Version: 0.5.0 (Beta)
Release Date: 2/11/2006
Changes:
Added page-up, page-down to move around the map faster.
Changed the tile selection window so tile are displayed exactly like they are in the tile image.
Made tile selector scroll faster.
Made map scroll faster.
Added P key to "pick up" the tile the mouse is over.
New Bug: the editor freaks when the map is less than the width of the editor window, be careful.
Map properties window now allows you to change everything except the number of layers. If you change
the width and height of the map save it and reload it to see the size change.
Added windowed mode. Just add "windowed=true" to the top of the config file, this keeps it from being
full screen.
Updated documentation.




WarpZone(Posted 2006) [#28]
Got the new version. Not even trying my own code this time, just trying to compile the Sample programs.

I have copied the libs directory to the samples directory.

When I try to compile sample1, it says:

Compile Error
Identifier 'LayeredMap' not found

My output is:

Building Sample1
Compiling:Sample1.bmx
Compile Error: Identifier 'LayeredTileMap' not found
[C:/BlitzMax/SAS_Map_Editor/samples/Sample1.bmx;30;1]

Process complete

Regarding the pre-compiled samples:

-I could not find a jump button in the game Sample4.exe. Spacebar resets the player's X/Y coordinates to 1,1. Was this intentional?
-In Sample5.exe, the player does not seem to collide correctly with the pellets. They disappear if they even get near the top of the man's head, and they will not disappear if only the bottom of the guy's chin completely covers them. He collides with the walls as expected.
- In sample3.exe, the orange and the grey tiles both scroll at the same speed when moving vertically. Was this intentional? Also, if you go too far to the right, the dark grey layer disappears COMPLETELY.

The file I have is from h_ttp://www.scottshaver2000.com/blitz/sasmapeditor/SAS_Map_Editor.ziphttp://www.scottshaver2000.com/blitz/sasmapeditor/SAS_Map_Editor.zip Is this the right link?

I wish your zip file included the version number so we know what version we are getting when we download. Also, I wish the link to it was at the top of your forum post instead of buried in the middle. :P

Thank you. Still can't get it to work. :(

Are there any other good 2D mapping systems availible for BlitzMax?

Thanks. :)


Filax(Posted 2006) [#29]
Link dead ? i just want to look ? :)


CS_TBL(Posted 2006) [#30]
Unfortunately I can't say it's that good. The GUI is arcane and map-editors can be soooo much quicker and handier. Ditch IGlass and go for MaxGUI, most of the unconvenience came out of the GUI. In the end, I didn't manage to draw a map with it. :\ (sorry ^_^, no offence tho)
Over the years I developed a knack for creating map-editors in B+. The record is still 45 minutes coding for an editor with macro-editing/drawing, tile-pick, load/save etc. :P

Haven't done much on that matter with BMax yet due bugging SetViewport (which is required due lack of the original DrawImageRect), there's somewhat of a workaround tho, by pre-slicing an image into chops.


Scott Shaver(Posted 2006) [#31]

When I try to compile sample1, it says:

Compile Error
Identifier 'LayeredMap' not found

My output is:

Building Sample1
Compiling:Sample1.bmx
Compile Error: Identifier 'LayeredTileMap' not found
[C:/BlitzMax/SAS_Map_Editor/samples/Sample1.bmx;30;1]

Process complete



I have no idea it compiles just fine for me, did you download the sas.tilemaps module and install it?


Regarding the pre-compiled samples:

-I could not find a jump button in the game Sample4.exe. Spacebar resets the player's X/Y coordinates to 1,1. Was this intentional?



Yes, these are just simple examples.


-In Sample5.exe, the player does not seem to collide correctly with the pellets. They disappear if they even get near the top of the man's head, and they will not disappear if only the bottom of the guy's chin completely covers them. He collides with the walls as expected.



Again these are just simple examples, not production quality code.


- In sample3.exe, the orange and the grey tiles both scroll at the same speed when moving vertically. Was this intentional? Also, if you go too far to the right, the dark grey layer disappears COMPLETELY.



Both are intentional.


The file I have is from http://www.scottshaver2000.com/blitz/sasmapeditor/SAS_Map_Editor.zip Is this the right link?



yes


I wish your zip file included the version number so we know what version we are getting when we download.



I assume you mean the filename as the readme contains the version number. I don't do that because I don't want to have to go around changing links in forum posts. The file will always be the most current version.


Also, I wish the link to it was at the top of your forum post instead of buried in the middle. :P

Thank you. Still can't get it to work. :(



Added a link at the very top of my forum post.


Link dead ? i just want to look ? :)



Don't use the link in WarpZone's post use the link at the top of this topic.


Unfortunately I can't say it's that good. The GUI is arcane and map-editors can be soooo much quicker and handier.



Fair enough. :) It was written mainly for me, so to each his own. This is a work in progress it will improve with time, just like it did yesterday.


In the end, I didn't manage to draw a map with it. :\ (sorry ^_^, no offence tho)



It really isn't that hard to do. :)


Over the years I developed a knack for creating map-editors in B+. The record is still 45 minutes coding for an editor with macro-editing/drawing, tile-pick, load/save etc. :P



Well I guess you don't need this one then. :) Others may or may not find it useful though. The main thing is it produces a format that can be used with my tilemaps module which makes it very easy for me to put together a map based program.


Haven't done much on that matter with BMax yet due bugging SetViewport (which is required due lack of the original DrawImageRect), there's somewhat of a workaround tho, by pre-slicing an image into chops.



What bug is that, I use SetViewport and am having no problems with it.


CS_TBL(Posted 2006) [#32]
Draw an image in a viewport, the down-side of the viewport is ignored, so what you essentially draw is a full column.

At least here it does.

so instead of (1 tile)

+---+
|   |
|   |
+---+












______   < canvasbottom


it draws:

+---+
|   |
|   |
|   |
|   |
|   |
|   |
|   |
|   |
|   |
|   |
|   |
_____  < canvas bottom



Scott Shaver(Posted 2006) [#33]
Weird I'm doing something similar where I draw tiles down to a certain point (bottom of the viewport) and is seems to work just fine. I'm not using a max gui canvas, maybe that is where the bug is?


CS_TBL(Posted 2006) [#34]
prolly..

Anyway, since I'm not going to use anything else but GUI/gadgets and events, I'm going to work around it, or wait for a bugfix.
I had the idea of slicing this image into little pixmaps, but then again, setscale doesn't influence pixmaps and I really want 2:1 scaling for my tiles. So I'm bound to use chopped images.

Ofcourse you can build a map with this buggy setviewport, as long as you build from y-0 to y-max, every new row will overwrite the previous one, however this really is a cpu-hog, as every column you draw is really drawn as a full column..


WarpZone(Posted 2006) [#35]
What? You mean I need a tilemap module in order to use the SAS map editor?

I had no way of knowing that! You should have said something! Put a link to the tilemap module alongside the link to SAS so noobs can find both files in the same place!

Is there any other software or add-ons I need in order to run this, in addition to ordinary BlitzMax?


Scott Shaver(Posted 2006) [#36]
You don't need it to USE the map editor, you need it to compile the samples.


I had no way of knowing that! You should have said something!



You mean besides the readme.txt file that says


Also you will need the Tilemaps module at http://www.scottshaver2000.com/forum/viewtopic.php?t=135


LOL. Okay I added a link to the forum post about the map editor that points to the module.

make sure you have the latest version of the map editor zip by looking for the above in the readme.txt in the samples directory. Or look at the readme.txt in the main directory and make sure it says:

Version: 0.5.0 (Beta)
Release Date: 2/11/2006

in the release list.


WarpZone(Posted 2006) [#37]
LOL, okay, yes. :) I should have read the readme file. :)

But still, it couldn't hurt to list links to all the files needed by SAS wherever you pot a link to SAS itself. :)

Hmmm. It seems I have version 0.4.1 , not 0.5.0. I'll have to try downloading it again, I guess.

Thank you for your help. :)


Scott Shaver(Posted 2006) [#38]
you are going to bury me for this but look down a bit farther in the readme, I forgot to change the version on the first line. :P


WarpZone(Posted 2006) [#39]
Aww, I'm not gonna bury you for a little thing like that, Scott. :D

(Just to be an ass, I'll point out that the source code of sample6.bmx says "' Sample5.bmx By Scott Shaver" at the top of it. :P Is this what they mean by "code reuse?")

I've got an army of bulldozers on standby though if I can't get this thing to compile! I've downloaded your bundle of modules and put them in the C:\BlitzMax\mod directory. So I have C:\BlitzMax\mod\tilemaps.mod\ among other things. (Is it legal to give a folder a .extention in Windows? I guess it must be since 2 other .mod folders were already here when I got here.)

Anyway it still won't compile.

Building Sample6
Compiling:Sample6.bmx
Compile Error: Identifier 'LayeredTileMap' not found
[C:/BlitzMax/SAS_Map_Editor/samples/Sample6.bmx;36;1]

Process complete

I have no idea what the problem is, either. :( Do I need to do something within BlitzMax to install the modules? Did I install them to the wrong folder?

Please hurry with an aswer, I'm paying these bulldozer driver guys by the hour. :)


Scott Shaver(Posted 2006) [#40]
:)

The mods should should go in the mod directory under

BlitzMax/mod/sas.mod/tilemaps.mod
BlitzMax/mod/sas.mod/sascardlib.mod
BlitzMax/mod/sas.mod/spritebehaviors.mod
BlitzMax/mod/sas.mod/bitmapfont.mod

make sure the top of the samples all look something like this:

Strict 

Framework BRL.GlMax2D
Import BRL.System
Import BRL.Basic
Import BRL.pngloader
Import BRL.Retro
Import pub.igl
Import SAS.tilemaps


?Win32
SetGraphicsDriver(GLMax2DDriver())
?

' init the graphics mode
Graphics 800,600,32',85

' Load a LayeredTileMap file
Global map:LayeredTileMap = LayeredTileMap.Load("maps/PacDude.smf")



Also you have to build the modules after you put them in the mod directory. To do this go to a command prompt and:

cd \BlitzMax\bin
bmk makemods -a sas

If everything is okay you will see it compiling the modules. Stop and restart BlitzMax. You should be good to go at that point.

Good luck.


WarpZone(Posted 2006) [#41]
Worsk great now! :) Thanks!


Scott Shaver(Posted 2006) [#42]
http://www.blitzbasic.com/Community/posts.php?topic=56543 is a new version that uses max gui.


Scott Shaver(Posted 2006) [#43]
New version

http://www.scottshaver2000.com/blitz/sasmapeditor2/sasmapeditor2.zip
===================================================================

Version: 1.1.2
Release Date: 2/19/2006
Changes:
fixed a redraw issue and the 100% CPU usage issue
Also removed the pub.igl import from the samples

The tilemap module is included in the zip now. you should copy the
sas.mod folder to you bmax/mod directory and rebuild the module.