[DWLab] New 2D games development framework

BlitzMax Forums/BlitzMax Programming/[DWLab] New 2D games development framework

Matt Merkulov(Posted 2011) [#1]
Digital Wizard's Lab is framework for 2D game development in BlitzMax.

Open-source. Free for commercial use.

Features:
* Projects with changeable logic frames per second rate and automatic FPS selection.
* Hierarchy of layers which can contain other shapes.
* Cameras, orthonormal or isometric, with definable viewports to display part of game field in areas of the screen.
* Sprites with various shape types: Pivot, Oval and Rectangle.
* Visualizers to display a group of sprites with same displaying parameters. Non-standard visualizers include raster frame, marching ants frame, animated tilemap visualizer and debug visualizer showing collision shapes, vectors and names.
* Tilemaps with changeable position, size, tile indexes, wrapping, automatic enframing and pathfinding.
* Sprite maps with changeable cell size to check collision faster and display only sprites which are collides with camera rectangle.
* Collision system of sprites, tilemaps, lines and groups with use of collision handlers.
* Physics: wedging off sprites, joints.
* Priniting of bitmap fonts with variable letter length and alignment.
* Behavior models which can be attached to shapes, activated and deactivated.
* Graphs with pathfinding.
* HeightMaps with Perlin noise, blur, circle drawing and various painting methods to the tilemaps and pixmaps.
* Controllers system.
* Profiles which store different settings and game state.
* GUI system with windows, buttons, list boxes, sliders and text fields.
* Saving and loading objects with all contents to XML file.









Smart world editor is included with following features:
* Creating hierarchy of layers.
* Creating, moving, resizing, changing order and modifying parameters for sprites of various types.
* Creating, importing, resizing, moving and painting tilemaps with tiles or tile blocks.
* Auto-replacement technique for tilemaps with tile rules editor.
* Collision shapes editor for tilemaps.
* Adding multiple parameters to the shapes.







Notice that commercial distribution of editor and its derivatives is prohibited.

Links:
* Framework v1.4 with compiled windows binaries, editor, examples and demos source (8MB)
* Compiled demos (for Windows)
* Compiled examples packed in single demo file (for Windows)
* Compiled world editor v 1.7.9 with example maps (for Windows)
* Framework tutorial - creating Super Mario Bros remake (outdated)
* Framework tutorial - creating isometric RPG (outdated)
* World editor tutorial
* Official site
* Bug/issue tracker
* Source code
* Facebook project page
* Google+ project page

You can ask me any questions regarding the framework.

You can contact me via:
* ICQ: 392-274-050
* Google Talk / Jabber: MattMerkulov@...

Last edited 2012


GW(Posted 2011) [#2]
This is pretty neat, and a lot to chew on. the tutorial is a nice touch too.
great job!


.rIKmAN.(Posted 2011) [#3]
I've just been sat reading for an hour or so over threads on here to do with game timing, delta time and tweening etc to try and get an overview of how to appraoch a constant fps for my game.

I was thinking of having a look at Grey's Framework, then realised it was old and not for sale / use anymore....and then you appear out of nowhere with this! :)

I'll have a play with this tonight and give feedback once I have had a look at it - many thanks! :)


Difference(Posted 2011) [#4]
Looks massive!

To compile on mac, theres a small error: Slash needs to be put before the ?Win32 in Service.bmx

Function L_ChopFilename:String( Filename:String )
	Local Dir:String = CurrentDir()
	Local Slash:String = "\"
	?Win32
...



BlitzSupport(Posted 2011) [#5]
This looks like a great piece of work, and a good job done on documentation too.


Pete Carter(Posted 2011) [#6]
Great stuff I'm sure I can learn something from this thank you!


Naughty Alien(Posted 2011) [#7]
very nice


Matt Merkulov(Posted 2011) [#8]
To Difference:

It's better to change to:
Service.bmx

...
Function L_ChopFilename:String( Filename:String )
	Local Dir:String = CurrentDir()
	Local Slash:String = "/"
	?Win32
	Slash = "\"
	Dir = Dir.Replace( "/", "\" )
	Filename = Filename.Replace( "/", "\" )
	?
	Dir :+ Slash
	...


I'll add this to the next version.


Matt Merkulov(Posted 2011) [#9]
Anyone knows tips on how to use MaxGUI on Mac? I'll be grateful if someone figure and tell me how to launch World Editor on Mac.


Hardcoal(Posted 2011) [#10]
cool job


Matt Merkulov(Posted 2011) [#11]
Version 1.0.3.1 released with 3 new examples.
* Editor now supports sprite maps.
* Some class restructurization was made.
* Fixed some bugs.

Download (8MB)

Last edited 2011


Rixarn(Posted 2011) [#12]
Awesome matt! will check it out too :) ... btw, how much time it took for you to make this nice framework?


Matt Merkulov(Posted 2011) [#13]
I started developing the framework 1 year ago, but code base for first commit was taken from my old IDE project (temporarily closed) which was developed 2.5 years long.


Rixarn(Posted 2011) [#14]
That's quite some time! Glad to see it finished. I have a project of my own and it hasn't seen the light. It's almost 3 yrs now. And it's nothing near that FW, it's just a game thing i've used to learn how to program haha

Last edited 2011


K@li(Posted 2011) [#15]
Excellent !

i will try

i like the iso test


Rukiri(Posted 2011) [#16]
Wow, this is a great example! I might work on a super mario bros 3 version and update some of your own code.

One thing I noticed is that Mario was not pushed up slightly when he jumped on an enemy, in the actual game he was pushed up. I grew up with this game!

I'll probably tweak the coding for the level editor as it is a bit clunky, if it's okay I'll release it here.


Matt Merkulov(Posted 2011) [#17]
One thing I noticed is that Mario was not pushed up slightly when he jumped on an enemy, in the actual game he was pushed up. I grew up with this game!

He bumps up, but very little to be able to do combo stomping while player press arrow key.

I'll probably tweak the coding for the level editor as it is a bit clunky, if it's okay I'll release it here.

Of course it's okay, it will be great. You can also suggest improvements and I probably will implement them.


Rukiri(Posted 2011) [#18]
I see there's a lot of anti aliasing going on, any way to just display the graphics at there native size? Especially the enemies.


Matt Merkulov(Posted 2011) [#19]
I'll add discrete graphics displaying mode to the new version.

Last edited 2011


Matt Merkulov(Posted 2011) [#20]
New version (1.1) is released. Changes so far:
* Isometric camera implementation.
* Tilemap pathfinding.
* Raster frame visualizer.
* Incbin support for worlds.
* Full support of Oval shape type (replaced Circle).
* Graphics is now maximally discrete

Editor (v1.6) changes:
* Isometric maps support.
* Recent files list.
* Hotkeys help page.
* Automatic incbin file generation.



Download (9MB)

UPD: Isometric cameras processes layers differently than normal cameras. Each layer can have one or several tile maps and any number of sprite maps which should meet following conditions:
* All maps should have equal width and height in tiles and equal tile size.
* Every tile map should have (0,0) topleft corner coordinates.
If these conditions are not met, glitches will occur. You can position tile image relative to drawing center by using VisualDX and VisualDY parameters, stretch them by using XScale and YScale.

Last edited 2011


xcessive(Posted 2011) [#21]
This is some awesome stuff...


UnderwoodNullium(Posted 2011) [#22]
Wow, that's great. How long has it taken from start to finish for you to make this? I'm just curious.


Matt Merkulov(Posted 2011) [#23]
I started developing the framework 1 year ago, but code base for first commit was taken from my old IDE project (it's temporarily closed) which was developed 2.5 years long.


Jesse(Posted 2011) [#24]
Hi Matt,

I am trying to compile the editor under Mac OSX Snow Leopard. and is giving me this error:

Identifier 'TWindowsMenu' not found


is it maybe because it's part of MaxGui?
I tried to import the MaxGui.drivers but I still get the same error. I didn't do a lot of checking since I don't have a lot of time to do it. I'll have some time later today maybe I can solve it before you get back to me.


Matt Merkulov(Posted 2011) [#25]
Hello, Jesse

TWindowsMenu is Windows MaxGUI gadget. I missed cross-platform implementation when writing menu clearing function. Try to load new editor.bmx file from here: http://dwlab.googlecode.com/svn/trunk/editor/editor.bmx

I'll try to execute editor in virtual machine with MacOS tomorrow, let's see what other errors will pop up.

Last edited 2011


Jesse(Posted 2011) [#26]
Thanks Matt. I figured out it was a gadget because it didn't give me an error on that line after renaming it But I couldn't figure out the child.remove().

its compiling fine here now. no problems so far.
here is a link to the Mac Binary if anyone wants it:
http://www.mediafire.com/file/dr82k2c8qn47oqy/DWeditor.zip

Last edited 2011


Matt Merkulov(Posted 2011) [#27]
Version 1.1.1 is released with different orders of displaying tiles implemented (left to right or right to left, etc). With XScale and YScale parameters working with ordinary tilemaps it's now possible to make Prince of Persia level maps:



You can set these parameters in editor with fully working "wrapped" parameter for tilemaps which gives ability to "tile tilemap". It's quite fun to tile isometric maps:



Download (10MB)

Last edited 2011


Rixarn(Posted 2011) [#28]
Amazing stuff :)


MacSven(Posted 2011) [#29]
Is a Fullscreenmode supported?


Matt Merkulov(Posted 2011) [#30]
Yes, you can paste contents of L_InitGraphics function and alter them slightly:
	Graphics( Width, Height, 32 )
	L_CurrentCamera = LTCamera.Create( Width, Height, UnitSize )
	AutoImageFlags( FILTEREDIMAGE | DYNAMICIMAGE )
	SetBlend( AlphaBlend )

I'll add color depth parameter to the function in next version.


Matt Merkulov(Posted 2011) [#31]
Update for v1.1.1: All tile maps now should have equal topleft corner coordinates like ( X * TileWidth, Y * TileHeight ), where X and Y are integers, not neccesarily (0, 0).


YellBellzDotCom(Posted 2011) [#32]
Looking into this, I had a problem with the editor screen not displaying or refreshing properly. I copied the code from the editor.bmx post above but when I tried compiling it I got an error.

The new code...
Case MenuImportTilemap
	Local TileMap:LTTileMap = TileMapImportDialog()
	If Tilemap Then
		Local Layer:LTLayer = LTLayer( SelectedShape )
		If Layer.Children.IsEmpty() And Not Layer.Bounds Then Layer.SetBounds( Tilemap )
		Layer.AddLast( Tilemap )
		EditTileMap( Tilemap )
	End If


Gives a "Unable to convert from 'int' to 'dwlab.frmwork.LTTileMap'" error

The original editor.bmx code...
Case MenuImportTilemap
	If TileMapImportDialog() Then
		Local Layer:LTLayer = LTLayer( SelectedShape )
		If Layer.Children.IsEmpty() And Not Layer.Bounds Then Layer.SetBounds( CurrentTilemap )
		Layer.AddLast( CurrentTilemap )
		RefreshProjectManager()
	End If



I can't continue the tutorial until I get around this. :(

Looks good so far though!


Matt Merkulov(Posted 2011) [#33]
You have also to copy ImportTileMap.bmx from the repository: http://dwlab.googlecode.com/svn/trunk/editor/ImportTilemap.bmx

Or you can download newest version of framework.


YellBellzDotCom(Posted 2011) [#34]
I downloaded the newest version but the editor didn't display properly or refresh. Thats why I tried the editor.bmx from above. I downloaded the framework 1.1.1 full.

Thanks for the help.


Matt Merkulov(Posted 2011) [#35]
What OS are you using?


YellBellzDotCom(Posted 2011) [#36]
windows xp pro, sp3
graphics card is nvidia gForce go 7300, integrated on my dell laptop

When I open the editor, it looks fine, but when I open a window in front of it, like to view some files, then minimize that window, the display in the editor still shows the window there.

Thanks!


Matt Merkulov(Posted 2011) [#37]
When one child window is opened in front of main window, main canvas won't refresh, so there will be marks on the canvas from this window. But these child windows have no minimization buttons, how do you minimized one?


YellBellzDotCom(Posted 2011) [#38]
They arent child windows of the Editor program, they are file windows of the os, or a browser window or the window of another program.

Thanks!


shinkiro1(Posted 2011) [#39]
You can use hook based rendering to redraw the main canvas even if another windos is active. There is a topic about this in the BMax help file: BlitzMax Help -> Languages -> Event Hook based Rendering


Matt Merkulov(Posted 2011) [#40]
To Xyle:
Maybe it's because current view layer is not selected (before it wasn't set at the beginning and now can be null if there's no layers in the world). I'll fix it in next version.

To shinkiro1:
Thanks, I saw it, but I'd better put Editor.Render() in child window modules or better make cascade windows system for framework. Don't quite get the benefit of events yet.

Last edited 2011


Rixarn(Posted 2011) [#41]
I'm learning a lot from your framework. Your generosity inspires me to release whatever piece of decent code I can ha ha. It's cool to learn from other people's code. I'm currently working on a game framework for a small commercial game, but I'll ask if can release the framework...

BTW, Can you recommend me some books for reading if i want to work on game frameworks or something?


Matt Merkulov(Posted 2011) [#42]
Thanks and stay tuned for new cool features! :)

No, I don't know any books on this topic.


Rixarn(Posted 2011) [#43]
Oh no books?, i see... then you came up with good stuff! he he

I can tell by looking at your framework that you have put a lot of work. Visualizers and behaviour models, what a niffty idea. :P

Last edited 2011


Matt Merkulov(Posted 2011) [#44]
I have almost completed Mario without behavior models, but code turned into such mess with which I couldn't continue, so I implemented behavior models and rewrite it all from zero. Models easies development process a lot when project became big.


Matt Merkulov(Posted 2011) [#45]
Version 1.2 is released featuring parameter lists for shapes. Now instead of including class name and other parameters in shape's name, you can conveniently edit every shape's own parameter list.

Examples and tutorial are modified to be compatible with new system. Tutorial is now also featuring sprite maps creation inside the editor instead of creating them in code.

Editor now have full support of parameter lists and ñut (Ctrl-X) / copy (Ctrl-C) / paste (Ctrl-V) operations.

Download (10.5MB)

Last edited 2011


Matt Merkulov(Posted 2011) [#46]
World editor v1.7.1 is released featuring enframing patterns. Now you can ealisy generate tile set enframing rules by forming and applying specific patterns. There's one for areas and for walls:







More info in world editor tutorial.

Download world editor v1.7.1 (1.1MB).


Matt Merkulov(Posted 2011) [#47]
Editor v1.7.2 which is part of DWLab Framework v1.2.4 now has ability to display sprites using raster frames. Now it's easy to prototype game GUIs:



Downoad Framework (15MB).


TomShep(Posted 2011) [#48]
AAAhhhhh I cant wait to get stuck into this game lab - probably next weekend is the first chance ill get though - massive sad face!!


Matt Merkulov(Posted 2011) [#49]
Version 1.3.2 is released with new features such as GUI system, profiles and controllers system.



Pack includes Color Lines 1.0 beta which uses all those new technologies with game menu system template. Whole GUI and game field can be edited in world editor v1.7.5

There are also some structural changes in the framework: angular sprite model merged with static one in code and editor now support only one type of sprite. Though vector model is still available in code. I decided to get rid of sprite models because it can be confusing to use them in editor especially by novices.

Download (13MB)

Last edited 2011


Armitage 1982(Posted 2011) [#50]
Hi Matt

I'm trying the SVN version today but run into a few issues :
- a few modules aren't present in the repository, I had to download the 1.3.2 Framework to find them
- I cannot reproduce the bug in debug mode but in release mode the Mindstorm example crash one time only when I try to destroy an object (but I'm pretty sure it's not related to the framework, rather the example). This example is also the only one not having sounds (while working under Virtual Machine windows, I'm on a mac right now) !?
- Editor leave with error : editor[2511:100b] invalid drawable
- In a general, I don't know if it's "un-defringed image" or something, but every sprite leaves strange pixels on the edges. It's not visible under Mac Os but totally messing the mario example under Virtual Machine Windows (while it's ok with any others max stuff) :

- same with the parallax example but nothing like this with the MindStorm one


Leon Drake(Posted 2011) [#51]
keep having some issue with this part

Type TCollisions Extends LTBehaviorModel
    Method ApplyTo( Shape:LTShape )
	 LTSprite( Shape ).CollisionsWithTilemap( Game.Tilemap, 0 )
    End Method
End Type


for some reason Game.Tilemap = null even though i added

Game.tilemap = self in the init method of TTiles

not sure what the problem is.

Edit: Derp NVM i didnt realize i have to set the classname for the tileset as well.



Last edited 2011


Matt Merkulov(Posted 2011) [#52]
to Armitage:
Soon v1.4 will be released, I'll fix all examples according to system changes and try to test them on different platforms.

to Leon Drake:
Wow, cool screenshot. BTW, to get rid of this contour of magnified sprite you can use one small utility I wrote: http://dwlab.googlecode.com/svn/trunk/utils/smooth_mask.bmx


Leon Drake(Posted 2011) [#53]
thanks Matt that should help.


i did have a couple questions. So for the samus sprite it's fairly big 52x52 mainly cause of the gun and running animations. it has over like 80 frames. Which looks sweet in game right now. However is there anyway to set the collision mask on the sprite itself. I ended up having to shrink the sprite and then scale up the image portion of it so the collision mask wasn't this giant box.

It would be great if i could set it slightly different on some frames like for instance when she goes into morphing ball. I assume i could do a complete replacement but it would be easier just to change the collsion rect.

Last edited 2011


Leon Drake(Posted 2011) [#54]
Also @ Armitage. I've had those issues before with bmax and other games. it had to do with my video card settings for instance i think perhaps forcing down texture resolution was causing it, i can't remember exactly. but try seeing if that changes anything.


Armitage 1982(Posted 2011) [#55]
@Leon Drake
Thanks, it's probably something around this because this screenshot was taken from a Windows Virtual Machine over Mac. I don't know exactly why (maybe single surface optimizations ?) but it's not so important imo. Pretty rare to play games on a VM. But maybe if someone using bootcamp could report something similar then it would be an issue.

I don't know exactly why I'm waiting to setup a bootcamp Windows, maybe I found it pretty easy to switch from windows to Mac thanks to Virtual Machine... Anyway, I seriously doubt being able to play Skyrim in bootcamp, so useless :p


Leon Drake(Posted 2011) [#56]
have you tied compiling and running the game via blitzmax on mac?


Armitage 1982(Posted 2011) [#57]
On mac it's ok, I have a few line under my old Windows but nothing too bad.


Matt Merkulov(Posted 2011) [#58]
I'll try to think up of managing sprite group (moving, collisions, etc).


Leon Drake(Posted 2011) [#59]
cool deal, no rush. i may just do like a sprite replacement script when she goes into morphing ball.

i'm attempting to remake the classic metroid on NES using snes super metroid sprites.


Matt Merkulov(Posted 2011) [#60]
Version 1.4 is released. There's a lot of changes again which eases development a lot.

1. A huge pack of simple examples for nearly every command is written. You can view it in documentation, launch and change them from there.

2. Collision handlers are implemented (replacing CollisionType parameter). Now collision reaction code is stored in separate class instead of shape class, so you can have multiple collisio handlers for one shape and shared collision handlers of multiple shapes. Collision handlers are already implemented in examples and demos, so check them out.

3. Behavior model structure is severely extended. Now there are behavior models for waiting, condition models, animators, activators, deactivators which can be expanded by inheritance.

4. Animation stack is another useful behavior model which simplify shape animation management a lot. You simpló add animation models to the list (in order of priority) and activate/deactivate them. Only first active model will be applied to the shape, so only one animation at a time will be played.

5. Some minor additions including switching from one project to another with "freezing" first, current camera cursor, current project global variable (so you will not use project parameter in animation or delta-timing).

With all these changements tutorials getting kind of outdated. After some time I will make behavior model scheme for both tutorials and rewrite the code according to structural changements.

To convert your project to new system, you should:

1. Remove first parameter of all Animate() methods.

2. Move HandleCollisionWith... methods code from the shape to newly created collision handlers and specify them in CollisionsWith....() methods.

Thanks to beta testers for helping me: Tadeus, DanFi, Alexander Golowanow and especially DimasSup and Vladimir Kostin.

Download (8MB)

Download 52 examples compiled (for Windows) in single demo-file (1MB)

Download compiled (for Windows) world editor v1.7.9 and example maps for it (5MB)

Download compiled (for Windows) demonstration programs pack (10MB)

World editor now supports merging with another project and bilinear filtering switching on and off.

And happy new year to everyone! I wish you luck and more enthusiasm in coding, and being in good state and health.

Last edited 2012


Leon Drake(Posted 2011) [#61]
Woot thanks Matt

Last edited 2011


Armitage 1982(Posted 2012) [#62]
Hi Matt

I may have something interesting for you about the "strange pixels on the edges" problem.

I experiment something on my engine a few days ago and the same thing happen when I zoom out over texture loaded with this flag :
MASKEDIMAGE | FILTEREDIMAGE | MIPMAPPEDIMAGE

Removing MIPMAPPEDIMAGE remove this effect (but of course create pixaleted texture when down sized).

MASKEDIMAGE is probably unrelated.
Un-fridged images won't fix the problem. I guess it's the way GL or Max handle MIPMAPPING when zoom out screen...


Leon Drake(Posted 2012) [#63]
maybe i am just weird but i prefer that pixelated look when zoomed in over the smoothed out version.


Matt Merkulov(Posted 2012) [#64]
Yes you can set flags which fits best at any time.


Redspark(Posted 2012) [#65]
This looks great! Does this work with the Mac out of the box or are there some code fixes that are needed? Thanks.


jsp(Posted 2012) [#66]
I had a look at the editor 1.7.9, but when moving the mouse inside the canvas it's somehow accelerated and going a bit crazy.
Is this to be expected?

Loading the Mario example and double clicking the tiles layer ends in EAV.

EDIT: Is it needed that the editor is taking 100% CPU? Couldn't you at least add a little delay in the loop?

Last edited 2012


Matt Merkulov(Posted 2012) [#67]
Does this work with the Mac out of the box or are there some code fixes that are needed?

It should, I suppose, though I had no chacne to test it on Mac. Difference said it compiles.

I had a look at the editor 1.7.9, but when moving the mouse inside the canvas it's somehow accelerated and going a bit crazy.
Is this to be expected?

Never had this, hmm. Which OS do you using?

Loading the Mario example and double clicking the tiles layer ends in EAV.

Do you open the world from the DWLab archive of same version (1.4)? I have no problems doing this.

Is it needed that the editor is taking 100% CPU? Couldn't you at least add a little delay in the loop?

Okay, in the next release. Did't know it works this way.
You can do this immediately by adding delay command at the beginning of TEditor's Logic() method if you don't want to wait.


Jason W.(Posted 2012) [#68]
Aesome stuff!! How did I miss this?

Thank you Matt.

Jason


Matt Merkulov(Posted 2012) [#69]
More coming soon, stay tuned!