Million Tile Engine Beta Release

Wow!!!

Desperate for more information on the Perlin noise functionality…

MTE’s perlin noise function is highly configurable.

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

I generated the entirety of the world above from a blank 200x200 tile map using the following code:

mte1.enableHeightMaps() local layer = {layer = 1, scale = 6, roundResults = true, perlinLevels = {{min = 0, max = 1, value = 33}, {min = 1, max = 2, value = 33}, {min = 2, max = 3, value = 33}, {min = 3, max = 4, value = 36}, {min = 4, max = 5, value = 37}, {min = 5, max = 7, value = 38} } } local heightMap = {layer = 1, scale = 1, offset = -0.5, perlinLevels = {{min = -0.5, max = 0, value = 0}, {min = 0, max = 1.1} } } local lighting = {layer = 1, scale = 255, offset = 90 } mte1.perlinNoise({freqX = 0.05, freqY = 0.05, oct = 4, layer = layer, heightMap = heightMap, lighting = lighting})

The perlin noise function will generate pseudo-random noise, process that noise based on input you give it, and load the results into either a world data (tile) table, a heightMap table, a perlinLighting table (which takes precedent over the layer lighting configured in Tiled), or an output table you specify- or any combination of the above. 

Within each of these outputs you can set the scale of the output. For example, layer data is scaled so that the noise falls between the values of 0 and 100 by default. In the example above I’ve changed it to a scale of 6, because I want to assign six possible tiles to the layer based on the perlin noise value. The result is that the noise is scaled so that it falls into a range of from 0 to 6. You can offset the scale if you’d like as well. An offset of 3 and a scale of 6 will give you data ranging from 3 to 9. Tile data likes to be in whole numbers. You can use the roundResults, floorResults, and ceilResults boolean parameters to get whole number values from the noise, otherwise the noise will have a decimal value. These parameters are available for all output modes, and can be set individually for each mode.

A perlinLevel is a table assigning an arbitrary output value to a range in the perlin data. In the above example the output is scaled to 0 to 6. I assign the tileID of my water tile to the lower perlin values and various other tiles to the upper perlin values. PerlinLevels can be set independently for each of the four output modes.

Within perlinLevels you can set masks. A mask is a table assigning an arbitrary output to a range of PRE-EXISTING DATA. If you call a perlin operation on a world table which already contains tiles, masks can be setup to produce an output based on the pre-existing tileID’s, within each perlinLevel. Say you’ve generated a world with sandy beaches, grassy midlands, and rocky mountains, and now you want to add forests to this world. You could run the perlin noise function a second time to determine the location of forests, using perlinLevels to define forests and voids. You could then use masks within those levels to choose the type of tree tile; palm trees on sand tiles, leafy trees on grasslands, and scraggly mountain trees on mountains.

All this is optional. If you call perlinNoise({}) with an empty set of parameters it’ll spit out a 2D table of noise ranging from 0 to 100, the size of the map array. 

Speaking of size, you can specify the size of the perlin noise output. For the world data, heightMaps and lighting the size should be equal to the size of the layer, but in other cases you can set any arbitrary size.

Hello kiendaden. Examples are coming eventually, for a variety of things. Another user suggested that I integrate touch scroll and punch zoom directly into MTE, and I’m looking into the possibility of that. In the meantime I recommend checking the CastleDemo sample project. You’ll find touch scroll and pinch zoom code in main.lua, starting at about line 301. Simply uncomment the code block to test it out. 

I also have a new update for everyone.

MTE 0v980-12 - https://gum.co/staO

This is a minor update correcting reported bugs.

  • Fix for MTE trying to read non-existent width and height properties of object groups in Tiled map TMX files.

  • Fix for MTE setting width and height properties of object groups to 0, causing the Simulator to hang.

  • Fix for constrainScreen causing errors if the camera is not focused on a sprite.

Hello Dyson, 

Thanks for your quick reply and the example you give is great. I watched carefully about the code that you write about zooming and scrolling map. and I realized that if I use the

mte.toggleWorldWrapX(false) mte.toggleWorldWrapY(false)

 are still happening around the black when dragging the map. 

So how to solve the problem is no longer about a black background for my game only 1 single map (not wrap map). I mean the first point of the map will always be in the first position of the screen even drag the map down or right. 

Look forward to receiving guidance and your help

zmvd.png

Oh sorry about that, I completely missed the second part of your question! Just call mte.constrainCamera() after setCamera() and the camera won’t scroll into the black edges of the map anymore.

Hello Dyson,

Oh, oh, That’s great!  Thank for your quick reply :smiley:

Hi dyson - Haven’t been using MTE just yet but was hanging out with the new version that lets me use physics calls normally (versus having to use the MTE physics calls) if you recall.   Is this now available in the latest release?  

Also is Tiled the only map tool supported?  I’m really after (ideally) effectively Tiled, but with good support for adding non-tiles images for placement, such that how it appears in Tiled visually will be how it will look in Corona.  Idea is to be able to hand out such a map generator to my friends so they can develop levels, and then run them on Corona to see how they look, then hand me the result back.  But again I really need the WYSIWYG type approach for image placement on top of the tile layouts.  

So wondering if you there is an alternative to Tiled that might support this?

There is Level Director I see (unfortunately only for windows I think - http://www.retrofitproductions.com/level-director/ ) but perhaps is a possibility.  Not sure if MTE could suck in data from it?

Hello greg886,

MTE contains a require statement for the physics library so that it can spawn and cull tiles with physics bodies attached. The call mte.physics.addBody, for example, is in fact exactly the same as physics.addBody. It just happens to be routing through the MTE library file, so to speak. In fact you could just use your own require statement and make the physics calls directly if you wanted to.

Tiled is the only map tool supported. Tiled does support WYSIWYG placement of images on object layers- those images just have to be from a tileset. You could load any image you want as a tileset of 1 big tile and drag that to any position on an object layer. Or you could store many of your level elements in an imagesheet and use that as your tileset- just make sure each “tile” has the same dimensions and they’re arranged in a grid within the tileset. It isn’t the perfect solution, but expanding MTE to support other editors is just way beyond the scope of the project. I’m slammed as it is trying to bring it to retail release! It wouldn’t be all that difficult to do, really, but I can’t afford to slip it in before 1.0.

On an unrelated note, the rewrite will have limited support for Normal Maps driven by a single point light source assigned to a sprite. This is one of those things I’ll need people to test after its out this friday, as I don’t have the time, tools, or expertise to create normal maps myself. The normal mapped floor in the video below comes curtesy of DeadPixel, who may or may not still be hanging around the forums somewhere.

[media]http://www.youtube.com/watch?v=tO3-Jgydetg[/media]

Keep in mind that normal maps require Premium Graphics restricted to Corona Pro and Enterprise users. It is also a pretty big performance hog best saved for high-end devices.

thanks Dyson - Thanks for the work around tip with Tiled.  So would I be correct in saying one might then:

* create a tileset(spritesheet) for each set of image sizes you might want to use. Say have a 100x100 tileset, then 200x200, etc

* then as you create a new image for the game you create it in the tileset that fits it, such that you keep that image size to the that of the tileset

A few questions:

a) does MTE then place the image in the precise place on the screen? i.e. will it be a what you see on Tiled will be what you get in Corona re the image placement?

b) any guide re what size tileset you should be using, or I guess the answer to this would be the same as the general answer to how big a spritesheet should/could be for a corona app?  (i.e. depends on target device etc)

c) does MTE support using the Tield objects, e.g. such as a line.  That is if I put an image (from a tileset) and place it, MTE will display it where I want.  But then if I drew a zig-zag line also in Tiled, could I within my app (using MTE) pick up the coordinates of the line and use it for moving the image along the line?  

regards

Greg

I recommend having a look at the Platformer - Angled PHYSICS 0v958 sample project as it does a lot of what you’re asking about. Specifically check out AngledPhysics3.tmx in the Platformer Angled Tiled Map folder. It includes examples of every kind of Tiled vector object as well as pixel-perfect placement of tiles on an object layer(the metallic tiles near the big red pipes). The brighter of the three off-grid tile objects also has properties set to change it’s size when the map loads, helping to mitigate the need for multiple tilesets of different sizes. It isn’t a perfect solution, but its workable. 

MTE will load the entire contents of the map into memory, including objects like polylines. You can set properties to display the polyline if you want, or you can just use it’s data for your own purposes. MTE won’t automatically move an object along a polyline of course, but you could program this behavior easily enough. For example, if you created a line and named it zigZag1, you could retrieve it by calling “local zigZag = mte.getObject({name = zigZag1})” The line data would be at zigZag.polyline, if memory serves.

The Million Tile Engine is finally up on Twitter and Facebook! Please let me know whether you have any problems with the pages, I’m not a huge Twitter or Facebook user and I’m not yet fluent with the platforms. I’ll be posting more frequently to Twitter, letting folks know what I’m doing on a day-to-day basis. I’ll continue to post longer, more detailed update news here and now Facebook as well.

https://twitter.com/MTEforCoronaSDK

https://www.facebook.com/pages/Million-Tile-Engine/729090240457650

The first half of the week was spent working on sample code for the MTE functions moveCameraTo, moveSpriteTo, addSprite, setCamera, constrainCamera, getObject, updateTile, and getSprites, with various minor bug fixes to the the engine happening along the way. Putting these functions through their paces was quite useful for that, actually.

On my schedule for Thursday and Friday are two more pieces of API sample code, work on a new tutorial, and an investigation into the feasibility of TMX map stitching; that is to say, a function allowing developers to load additional maps and insert their data into a pre-existing map. This is something I mentioned months ago but which fell off the truck, so to speak.

Any suggestions of API functions to cover in sample code or topics for tutorials would be most welcome!

Hi dyson122,

Thanks for the great work, I purchased your MTE engine a few days ago and am eager to get working with it.  My suggesion for a demo would be an airplane flying over terrain where the motion of the plane (any maybe enemies) is independent of the tileset (maybe with momentum)? 

A super engine!!!

Hello, I just purchased the library. Is there a nice way to add Move Pinch Zoom functionality to the map? I mean without having to implement it outside of it?

Ok, I’ve got my zoom pinch move class working with mte, but I’ve an issue, right now when you call cameraMove(deltaX, deltaY) on a isometric tileset, instead of panning the camera it just moves it across the tilesets diagonal directions. 

Is there a way I can achieve a panning movement of the camera on isometric map?

https://gumroad.com/l/staO - $24.99 

 

 
MTE 0v980-19 - https://gumroad.com/l/staO/mtesale
 
Another week, another update! MTE 0v980-19 includes the first batch of sample code for the API functions moveCameraTo, moveSpriteTo, addSprite, setCamera, constrainCamera, getObject, updateTile, getSprites, loadMap, getTileWithProperty. These samples include multiple examples demonstrating proper use of the functions’ various parameters and arguments and their effect on the output. Each example is commented out- uncomment one example at a time to observe the output.
 
Working through these samples also provided ample opportunity to hunt down half a dozen bugs and squash them. Half a dozen minor problems have been corrected.
 
A new isometric conversion helper function is available: isoVector2(velX, velY). If you call mte.moveCamera(10, 0) on an isometric map, the camera will actually move diagonally towards the bottom right corner of the screen in order to follow the tile map. The isoVector2(velX, velY) function converts the desired screen vector into a map vector to produce correct results. Running your velX = 10, velY = 0 through isoVector2 will spit out (7.07, -7.07). Calling mte.moveCamera(7.07, -7.07) on an isometric map will move the camera ten pixels to the right. 
 
I will continue to add documentation to MTE, including many more pieces of sample code as well as written and video tutorials. Aside from documentation, over the next two weeks I will be investigating map stitching, a feature I mentioned months ago but which fell by the wayside. This functionality would allow developers to load additional maps and append them directly to the currently active map, in essence increasing the size and absorbing new Tiled properties. I did say I would not be adding anything to MTE, but this was a feature promised and forgotten and as such I consider it grandfathered in.
 
My interpretation of the MTE price surveys is that support exists for increasing the price of MTE. Increasing the price would also help to offset my expenses. Some people would also like to pay less, of course. I think a compromise is in order! For the next four days, until Midnight on Monday the 17th, MTE is 40% off! On April 2nd, however, the price is going up to $34.99. So, the time to buy is definitely now! 
 
Spread the word!
 
EDIT: I already got a couple comments about the April 1st price change date; No, this is not an early April Fools joke. I probably should have seen that coming. I’ve decided this would all be simpler if I just moved the date to April 2nd :stuck_out_tongue:

EDIT2: The sale has ended.

Ahhh I just bought without discount few hours ago :frowning: sad… well thanks for the helper function.

Yes, I saw that too, maxtrix2000. If you’d bought the engine a day or two ago, that’s one thing, but I can see how missing it by four hours would be annoying. I’m getting in touch with Gumroad now to see if we can arrange a partial refund.

Do not worry, just keep up the good work. I almost don’t make a dime out of my games so I know how difficult is to get customers. No worries it’s a great work. 

:wink:

I appreciate that, maxtrix2000! Making money from this kind of thing has definitely proven… interesting. I did already send you a PM asking for more information, but you can just disregard that if you like.

Love that you’re doing the sample code sections, a great addition to the help guide.