Million Tile Engine Beta Release

Interesting!  I’ll add it to my list.  

Hey Dyson,

Does the displayObject reference “group” work in addSprite?  I was using it in the older version and can’t seem to figure it out.  Also, in your documentation it seems you call it “groupObject”.  I think you also have “vector object” in there which should say vector.  Any help would be great!

Curt

Oh, whoops… forgot to switch my mte require call for other .lua files… haha.  That’d be the problem!

I’ll have to look into whether I even have time to team up on it, Danny. I’m in the middle of a job hunt and things are hectic. I’ll be in a better position to do this sort of thing in a month or two, hopefully.

Ookami, you can use the loadTileSet function to overwrite one tileset with another, provided the images have the same resolution and the same number of tiles. You can even do this on a map you’ve already loaded if you want and call refresh() to redraw using the new tiles. 

@dyson122 i can understand your situation. I would be happy to work away at it alone while you are busy, learn the source, improve and add features as I go along.

Then when you have time we can sync up. If that suits you then I am game :slight_smile:

If not, I can naturally hold out until you are ready. Just thought I would offer an alternative.

Cheers

Is there a tool to create levels?

The tool of choice for creating maps is Tiled. http://www.mapeditor.org

On an unrelated note, I just discovered that apparently I’d maxed out the number of conversations / PM’s I can store. I rather wish I’d been notified by email or something, and it bothers me to think people may have tried to PM me and found that they couldn’t. At any rate my inbox is now clear and should be accepting PM’s again.

Excellent!  Thanks!  That’s just what I needed!

A couple updates; First, the MTE 40% discount ends at midnight tonight! Well, actually it will end tomorrow morning. I never specified a timezone, so I’m going to wait until everyone has had a chance to reach midnight. The price will then go back to $24.99

I’m pushing the date of the price increase back to April 2nd! Why? A lot of people now have commented about the April 1st date, pointing out that it is April Fools day and that this may cause confusion. The last thing I want is for people to believe that this price increase is an April Fools joke. It is not.

The MTE update this week will include minor new functionality. You’ll be able to set the color of a sprite and still have that sprite respond to tile and layer lighting. Tile and layer lighting will now also effect “group” sprites, which are group objects into which multiple sprites have been loaded. A common use of this is character customization; for example, a player character might be composed of arm sprites, a body sprite, and a hat sprite, each of which can be individually colored. These sprite groups will now respond to lighting without losing their colors.  Aside from lighting, I’ve moved the touchScroll and pinchZoom functions into MTE for your convenience. You can enable and disable these independently, and you can specify the maximum and minimum zoom. 

The update will go out on Friday. I’ll keep everyone posted as I get more done. You can expect addition pieces of sample codes as well and, if time allows, a tutorial or two.

Hi,

Firstly fantastic engine and just what I need for a number of projects I’ll soon be working on. purchased it weeks ago and I was wondering however if there were any video tutorials showcasing the many API’s ?

Thanks

Danny

There aren’t any video tutorials yet, Danny, but they’re coming! Though, the tutorials will be oriented more to accomplishing certain tasks and gameplay mechanics than demonstrating the API. For example, one of the first tutorials will cover creating a project, setting up its directory structure, creating a map and things of that nature. Video tutorials of API’s might come later, but really I think sample code serves that purpose better. You can load sample code and see the output yourself, and modify it experimentally, rather then simply watching it unfold in a video.

Hi Dyson,

I was just taking a look at the mte.updateTile function.   Firstly, can I check that this uses whatever map is currently loaded as the map to change?

In my main map I have several tilesets in use and would rather keep it like that.  The ‘tile’ parameter references a numeric occurrence of a tile in the tileset for the map.  So how do I point to the correct tile number in the correct tileset?

Thanks!

Yes, updateTile only ever updates the active map- the one currently visible onscreen. It won’t touch any of the other map’s you’ve loaded.

As for how to deal with maps using multiple tilesets, the tile parameter of updateTile is a global tile ID. What Tiled does is add the numbers of tiles from each tileset together and represent tiles in relation to that total. If you have two sets with 100 tiles, and you want the 50th tile from the second set, the global ID would be 150. A useful bit of data to have on hand is the “firstgid”, or “first global id”, of the tileset. You can retrieve that from map.tilesets[aTileset].firstgid as follows;

local map = mte.getMap() local firstgid = map.tilesets[2].firstgid print(firstgid)

Just bought MTE…can’t wait to get it all up and running. Is the “map rotate” feature a future development, or am I missing something in my reading of the APIs?

Hello Dave,

Which map rotate feature are you referring to, specifically? You can rotate a map by changing the rotation property of the map’s masterGroup like so:

local mapObj = mte.getMapObj() mapObj.rotation = 45

Wow…thanks for the fast response. I can see that the engine is very powerful and worth every cent (in fact worth every penny of the GBP £20.26). Good work.

Dave

MTE 0v984 - https://gumroad.com/l/staO/

This week’s update sees the addition of a color parameter for sprites to support the combination of sprite tinting and MTE lighting, new pinchZoom and touchScroll routines built right into the engine for user convenience, a minor expansion of the removeSprite function to support the removal of sprites from MTE without destroying the sprite’s displayObject, an update to the map table structure to allow users to json.encode the map manually, and minor bug fixes.

Tinting a sprite is a common method of customizing sprites while reducing file size among Corona users. However MTE also tints sprites in order to apply tile-and-layer lighting. Before this update the original tint of the sprite would be lost forever in this situation. Now, by giving the sprite a .color parameter, users can specify and preserve the tint of a sprite. MTE will apply the light levels TO the color by blending them instead of overriding the original color. The format of color is {red, green, blue}. So mySprite.color = {255, 0, 0} will turn the sprite bright red. You can also use .color in the sprite’s setup table for addSprite(). Going even further, you can apply the .color parameter to each sprite stored in a group object, and then add that group object to MTE using addSprite. This allows sprites to be assembled from many sub-sprites, each of which can be tinted to customize the appearance of the sprite.

I’ve had a good dozen requests to integrate pinchZoom and touchScroll code directly into MTE, and I’ve done just that! Call enablePinchZoom() or enableTouchScroll() to activate the routines and disablePinchZoom() or disableTouchScroll() to disable them. Keep in mind that you must call system.activate( “multitouch” ) in order for pinchZoom to work, and you can’t actually test pinchZoom in the simulator; you need two fingers, not a single mouse pointer!

Lets see, what else is there. Oh yes. Before this update, adding a sprite to a map basically trapped it there. You could insert the sprite into a different group, but MTE would still attempt to delete it when a new map loads. There is now an additional argument in the removeSprite function: removeSprite(sprite, destroyObject). DestroyObject is a boolean specifying whether MTE should destroy the sprite’s displayObject on removal. This argument is optional; it’s default behavior is true, which conforms to the way MTE has always worked. If you set it to false, the engine will insert the sprite into Corona’s Stage object and remove internal references to it, leaving it intact and reusable (see display.getCurrentStage() in the Corona SDK documentation).

The rewrite moved the table storing the map’s tile displayObjects into the map table. This has caused some trouble when users try to json.encode the map for saving and storage. The saveMap() function did take care of this for you, but the solution was clunky and ultimately unnecessary. I’ve moved the table storing the tile objects back out of map. Previously you could reach a layer’s tile objects at map.layers[layer].tileObjects[locX][locY]. Now you can reach a layer’s tile objects at mte.tileObjects[layer][locX][locY].

Lastly I’ve squashed a few bugs here and there relating to how the engine treats lineObjects and anything which doesn’t have a setFillColor() method, as well as unrelated bugs throughout.

This week’s update will hopefully clear the way for more work on the documentation. I had intended to work on at least one tutorial this week if time allowed, but it turns out time did not allow! The new plan is to work on documentation and map stitching next week and to continue the work on map stitching the next week. 

Enjoy!

Dyson,

I found a bug in this latest update. Seems like sprites that are composed of vectors (newCircle() in my case) and those that are groups with vectors inside of them, are having their fill values overridden with white ignoring what I set them to prior to adding them into mte.

Thanks for bringing this to my attention. Could you try assigning the vector objects a color property as described above and see if they maintain that color? 

Setting the .color property of the vector to the same color as the fill allows for it to preserve the intended fill value. It took a moment to figure out why everything was filling with black though. You reverted to pre graphics 2.0 colors of 255 instead of 0-1 per channel. I never tried the lighting system so if they use this same method, i understand why you did it this way, though breaking continuity with the rest of corona.

I assume setting the .color property is a temporary fix?