Million Tile Engine Beta Release

Ah yes, TexturePacker can do some strange things to the orders of tiles. I’m assuming here that you used Gimp to slice your tileset into individual tiles so that TexturePacker could extrude them for you and output a new tileset. Three things to keep in mind are the naming of your tiles, the algorithm setting in TexturePacker, and the max size settings in TexturePacker.

Usually Gimp’s slice command names tiles as slice_0_0, slice_0_1 and so on. This is a format TexturePacker works well with. However if the names are in the format of slice1, slice 2… slice10, you’ll run into a problem. In this case slice10 will often immediately follow slice1. The solution is to pad the numbers with zeroes so that slice1 is slice01, slice2 is slice02, and so forth.

In TexturePacker, under Layout, you want the Algorithm set to Basic and the Sort By set to Name. Further down you should make sure Allow Rotation and Enable Auto Alias are unchecked, and Trim is set to None.

TexturePacker will fill the allotted Max Size from left to right, top to bottom. If fewer tiles will fit across the image than in your source tileset, the row will be truncated, as will the next and the next in a cascading fashion until your tiles appear scrambled. The solution is to alter your Max Size settings until everything fits. Count the number of tiles in one row of your source tileset and then check the number of tiles in one row in TexturePacker. If Fewer tiles fit in a row in TexturePacker than increase the Max Size W: setting until the correct number fits. Do the opposite if too many tiles are present in the row. Eventually everything should snap into place as it should be.

So awesome.

Don’t worry nicholasclayg, physics support is coming! I’ve finished working on the functionality to be included in the Friday release and I’m moved on to converting some of the samples. The update will include separate Physics versions of the Platformer - Basic and Platformer - Angle sample projects. The physics versions of Sonic Finale and CastleDemo will come in a later update as I flesh out the physics integration. 

sweeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeet.

Thanks for that Dyson. I kinda figured that out myself last evening. It seems that GIMP doesn’t have any method of padding the names with zeros and I have 512 tiles currently. Instead of manually renaming 512 tiles (yawnnnn) I figured I better make a program to do the tedious work for me.

I made a program last evening in VB.Net and it works really well so now my frustration level is back to it’s normal high level :slight_smile:

I am guessing that others have this issue as well? If so I am happy to share my program.

I’ve used this powershell script to do the same:

########################################################### # AUTHOR : Marius @ Hican - http://www.hican.nl - @hicannl # DATE : 23-04-2012 # COMMENT : This script renames all .jpg files to the # name of the .jpg parent folder recursively, # extended with an increasing number. # Put the script in the root of the folders' # parent folder. # NOTE: This script can also be used for renaming # other / multiple files, just adjust the filter! ########################################################### $path = Split-Path -parent $MyInvocation.MyCommand.Definition Function renameFiles { # Loop through all directories -Recurse $dirs = dir $path | Where { $\_.psIsContainer -eq $true } #Foreach ($dir In $dirs) #{ # Set default value for addition to file name $i = 00222 # $newdir = $dir.name + "\_" $Invocation = (Get-Variable MyInvocation -Scope 1).Value $dir = Split-Path $Invocation.MyCommand.Path "current dir is $dir" # Search for the files set in the filter (\*.jpg in this case) $files = Get-ChildItem -Path $dir -Filter \*.png | sort -property Name -descending Foreach ($file In $files) #-Recurse { # Check if a file exists If ($file) { # Split the name and rename it to the parent folder $split = $file.name.split("Submarine\_A\_") # $replace = $split[0] -Replace $split[0],($i + ".png") $replace = "Submarine\_A\_00" + $i + ".png" # Trim spaces and rename the file $image\_string = $file.fullname.ToString().Trim() "$split renamed to $replace" Rename-Item "$image\_string" "$replace" $i++ } } #} } # RUN SCRIPT renameFiles "SCRIPT FINISHED"

Nice script :slight_smile:

MTE v0.844 - http://gum.co/staO

The Million Tile Engine grows ever more feature-rich! The plan moving forward from 0.820 was to release the next two mega-features, Physics and Isometric Maps, in two huge updates spaced many months apart. This plan lacked flexibility. The new plan is to release these new features incrementally as they are ready so that I can respond to developer feedback and address reported bugs.

With MTE version 0.844, layers, tiles, and objects can have physics properties used by the engine to create physics bodies automatically when a map loads. This significantly streamlines the process of creating collision detection for a wide variety of game genres and reduces the complexity of code required from the developer.

The engine handles physics body creation intelligently and manages their states as the map view moves. Static tiles are created and culled. Dynamic bodies fall and bounce and roll until they leave the map view, at which point they go to sleep and wait for the camera to return. Add tiles to a map which transform themselves into sprites, or place Tiled Objects with pixel-perfect precision to create platforms and terrain free from the positional constraints of the tile grid. 

A good place to start is the Reserved Tiled Properties and the API documentation. There are many new properties and function calls to see. Follow up with a gander at the “Platformer - Angled PHYSICS” sample project, see how simple it’s code has become in comparison to it’s non-physics predecessor. This sample includes two slightly different maps, one standard, another showing off collision filtering between map layers. It’s a lot of fun to watch and move through.

This is not the end of the work on Physics. I’ll be looking forward to hearing what you- the developers- still need, what you would like to see added. One thing I know already: multi-body objects. You can already create these from sprites, but they will be coming to Tiled properties in one form or another as well.

As Physics fleshes out I’ll start looking more towards the second mega-feature; Isometric Maps, and a few more exotic treats I’ve teased in this forum thread.

Enjoy!

EDIT: This post contains experimental features which are not a part of MTE.

[media]http://www.youtube.com/watch?v=WaickzD6tj4[/media]

Experimental MTE functionality.

Thank you Dyson for the update - hopefully I will have some time to work with the new features. I can’t wait for Isometric maps and physics looks great!

Hi all,

First of all kudos to dyson122 on a great API that really helps to leverage Tiled so that it is pretty much a level editor.

I was wondering if anyone was seeing an issue with the FPS going insanely high? I’m using storyboards and everything works fine if I load straight into the gamescene with MTE running. However if I go from a basic menu into the game menu the FPS goes up to 1000. 

This also appears to happen when using the same menu to go into the storyboard demo project so I’m not sure if it’s my misunderstanding of storyboards or an issue with MTE. I’ve attached the code of the menu I go into first before the game. If you change the RotateConstrainStoryBoard demo project to load this scene first it ‘should’ replicate.

his only seems to happen when I use the widget to create buttons. If I just create an imagerect for a button it seems to be fine

cheers

local storyboard = require( "storyboard" ) local scene = storyboard.newScene() local myData = require ("mydata") local widget = require( "widget" ) ---------------------------------------------------------------------------------- -- -- NOTE: -- -- Code outside of listener functions (below) will only be executed once, -- unless storyboard.removeScene() is called. -- --------------------------------------------------------------------------------- local buttonHandler = function( event ) myData.prevMap = nil myData.nextMap = "map1" storyboard.gotoScene("scene") end -- Called BEFORE scene has moved onscreen: function scene:willEnterScene( event ) local group = self.view local button1 = widget.newButton { id = "button2", defaultFile = "buttonYellow.png", overFile = "buttonYellowOver.png", label = "Load map", labelColor = { default = { 51, 51, 51, 255 }, }, font = "Arial", fontSize = 22, emboss = true, onEvent = buttonHandler, } button1.x = 410; button1.y = 290 group:insert(button1) end -- Called immediately after scene has moved onscreen: function scene:enterScene( event ) end -- Called when scene is about to move offscreen: function scene:exitScene( event ) end -- Called prior to the removal of scene's "view" (display group) function scene:destroyScene( event ) end --------------------------------------------------------------------------------- -- END OF YOUR IMPLEMENTATION --------------------------------------------------------------------------------- -- "willEnterScene" event is dispatched before scene transition begins scene:addEventListener( "willEnterScene", scene ) -- "enterScene" event is dispatched whenever scene transition has finished scene:addEventListener( "enterScene", scene ) -- "exitScene" event is dispatched before next scene's transition begins scene:addEventListener( "exitScene", scene ) -- "destroyScene" event is dispatched before view is unloaded, which can be -- automatically unloaded in low memory situations, or explicitly via a call to -- storyboard.purgeScene() or storyboard.removeScene(). scene:addEventListener( "destroyScene", scene ) --------------------------------------------------------------------------------- return scene

Hey Folks,

I’m just trying to get a feel for the sample code provided (Angled PHYSICS 0v844), but there is a mystery that has me stumped.   I cannot see how the green (or in Angled 2, the red) balls are created.  From the paragraph above, it is obvious that you created them in Tiled and that was what I suspected anyway.  But when I look through your Tiled maps, I don’t see them.  Where do I look for them?  How can I see their properties?  Can you see them in the version of Tiled you are working with?  What version of Tiled are you working with?  

I am using the latest version of Tiled (0.9) and I’m wondering if maybe it’s not showing something you can see.  Any thoughts would be appreciated.

Michael

EDIT: I just created this post as it’s own topic.  Should have done that in the first place.  Sorry!

No problem, michael714, I answered in your other thread.

Neonyourself, I couldn’t reproduce your 1000 fps bug, but copying your menu file and modifying RotateConstrainStoryboard as instructed did cause other issues. Your buttonHandler event is calling storyboard.gotoScene(“scene”) twice in quick succession; once for each event phase. modifying your code to trigger on event.phase = “ended” fixed the issues on my end and may solve yours as well.

local buttonHandler = function( event ) if event.phase == "ended" then myData.prevMap = nil myData.nextMap = "map1" storyboard.gotoScene("scene") end end

I’ve said it once before - but WHOA! Dyson you are a genius!

 WHOA!!!   this is really great !!!

  Is this function release??

Thanks SegaBoy and codingcake!

Not yet, codingcake. There is still much work to do before it is ready for use. I suspect this is going to be the kind of functionality most useful on newer/stronger devices like the iPad2+ or the newest generation of iPod Touch given how demanding it is on the hardware. 

Hey Dyson - quick question. Are you still thinking about incorporating physics into MTE? The reason I ask is that I’m currently working on a top-down game with stealth mechanics and using Box-2D Raycast feature would make calculating line-of-sight a lot easier then what I’m currently trying.

Be interested if you had any opinion on what would be the best way to go - at the moment I’m just confusing myself with trig, Bresenham’s algorithm, etc… :slight_smile:

EDIT

And another question… 

I thought I had this implemented into MTE, but it must have been another tile engine. I’m trying to incorporate A* functionality and in order to do so I need to expose the grid as a 2D array, which I can then check the tile properties (isObstacle). I have tried to use GetMap(), but I can’t seem to locate this data structure?!? Does MTE expose this data structure in any way that I might be able to use?

Got it .world :slight_smile:

Does MTE support the Tiled functions:

Insert Rectangle,

Insert Polygon,

Insert Polyline,

Insert Ellipse?

If It doesn’t, do you think you could add them in?  It would be nice to be able to draw the objects in Tiled, put “physics” in the objectlayer/objectproperties, and use those as physics objects (instead of just tiles).

s2q.png

Physics integration is a work in progress at the moment. Here we see the player casting rays at his surroundings. Impacted tiles are tinted red.

Dyson, keep up your great work on this. It gets more impressive every week :slight_smile: