Million Tile Engine Beta Release

Hi Dyson,

isSimulator = system.getInfo(“environment”) == “simulator”

application = {

content = {

width = 640,

height = 960, 

scale = “letterBox”,

fps = 60,

–[[

        imageSuffix = {

   ["@2x"] = 2,

}

–]]

},

This s my Config.lua, the Total Tiles count when there is lag is around 800. More over now i changed the fps in config to 60, so its very much better than compared to previous . But still i couldn’t get the smoothness in my project. I am using three layers in my map. Tile size is 32x32 and the map size is  1760 x 1248. 

In my original project i am using spine , when my character moves, at that time fps value is not printing in the screen, but when there is no movement its printing.  Every problem mostly  happens inside the constrain camera movement. I hope i will get a good solution.

Thanks,

Kumar KS. 

Azmar, MTE converts any Tiled object into a Sprite if it has properties defining its visual appearance. For example, if you make an ellipse object and give it a lineWidth property that ellipse will be drawn as a white shape with the lineWidth specified. That visible shape is a sprite. If you set the name of the object in Tiled the sprite will be assigned the same name, and you can retrieve it with getSprites({name = name}). That said, the engine doesn’t have any built-in functions for created fully animated sprites from Tiled Objects. 

You’ll have to set the category bits and mask bits of your physics objects on each layer so that they only interact with their current layer. You can see an example of category bits and mask bits in use in the Platformer - Angled PHYSICS 0v984-7 sample project, in the AngledPhysics2.tmx and AngledPhysics3.tmx maps. These are features native to Corona Labs’ physics implementation.

The lighting system is resource intensive. If you’re using physics objects and obstacles you should look into physics.castRay() http://docs.coronalabs.com/api/library/physics/rayCast.html as an alternative. 

Kumarks, the FPS value not printing at any time indicates an error is occurring. I suggest you start Corona Simulator by clicking on Corona Terminal; this will start the simulator and also display a terminal it will use to print errors and other debug messages. If you’d like to email your project to me I’ll have a look at it and see if I can’t figure out why its running so poorly for you.

WELL, it has been quite a while it seems since I updated MTE and I haven’t been quite as present here as I have been in the past. The reason for this is my ongoing job hunt and the demands it places on my time. That said, I have not been idle either! When faced with time constraints I’ll usually spend less time talking to you folks and more of the time on coding or working on customer support issues.

So, what have I been up to? I’ve been hard at work on MTE 0v990. Changes and additions so far:

  • forceDefaultPhysics layer property: if true, all tiles on the layer will use the default physics data stored in mte.physicsData.
  • managePhysicsStates MTE parameter: boolean enabling or disabling MTE’s management of sprite physics states. Setting mte.managePhysicsStates = false will prevent MTE from overriding sprite.isAwake and sprite.isBodyActive for ALL sprites.
  • managePhysicsStates sprite parameter: boolean setting whether MTE manages the physics state of the sprite. Setting sprite.managePhysicsStates = false will prevent MTE from overriding sprite.isAwake and sprite.isBodyActive for that sprite.
  • physicsSourceScale tileset property: used to set the scaleFactor of PhysicsEditor data imported into MTE. Applies to all tiles in the tileset.
  • physicsSourceScale tile property: used to set the scaleFactor of PhysicsEditor data imported into MTE. Applies only to that tile.
  • Support for Tiled Object rotation in Tiled v0.9.1-243.
  • mte.expandMapBounds(parameters): Increases the size of the map in any direction.
  • mte.appendMap(src, dir, locX, locY, layer): Inserts data from the a map file into the current map, adding layers and expanding the map bounds if necessary.
  • mte.drawObjects now takes a single boolean argument, new, which sets whether the function should redraw all objects or only draw new objects, for example the objects added by appendMap.
  • Fixed offscreenCulling: sprites will no longer fall through the world under certain circumstances.
  • Tiled Objects with physics bodies attached will no longer switch off while they are only half-way off the screen.
  • Tiled Object Culling: setting the cull property of the object or the cullObjects property of the object layer will cull those objects just as MTE culls tiles!

At the moment I’m working on improved culling for large tiles- tiles larger than the tile size of the map- so they aren’t culled before fully leaving the screen. After that I’ll have to do a few passes to make sure all these new systems are working together. 

Hello!

Is this engine graphics 2.0 compatable?  I’d like to create a game similar to the NES and/or SNES Zelda game… your product seems like a good choice.  Let me know.

Hello Scottadelman,

Yes, the current version of MTE is compatible with graphics 2.0. Let me know if you have any other questions. It’s always great to see another NES / SNES Zelda fan- games like that were among the original impetus for MTE’s creation.

Hey,

Whats up, no replies to any posts ? I have a new issue , I am using Tiled map editor for creating the maps. The problem is i am loading the obstacle objects at the run time , like i am giving some  property to the tiles where i want to place my obstacle. At the runtime i am getting the property of the tile using the function getTileProperty() and placing the objects there. The issue is i can place the obstacle at the top of my map for example at tile (10 ,10), but as i move down (14, 28) the tile i could not place my object and  i could not retrieve my tile properties too.What could be the problem . Reply to the post as soon as you see it.

Thanks ,

kumar KS.

Hello Kumar,

The reason I haven’t been answering posts is that I’ve been knee-deep in a job hunt, which itself is the result of mounting financial pressures. Basically I’ve been distracted by more important matters, like putting food on the table. All very stressful,  and demanding much of my attention.

Luckily it looks like the ordeal will be over soon. I’ll be settling into a job over the course of next week and then things will start to even out. 

Your problem could have any number of causes. I see nothing wrong with what you’ve described so far. What are you passing to getTileProperties? Is (10,10) onscreen? Is (14,28) offscreen?

Hi Dyson,

glad you are back and settle down there, congrats :slight_smile:
 

I’m trying generate random map via code, and here I have a terrains tileset and doodad one in same map.

When I call updateTile, it always using the first tileset of the map.

Is there any way to use 2nd or 3rd tileset when I call updateTile?

Hi Dyson, 

As a person exactly in the same situation, I know first hand how stressful it can be. Congratulations on finding a job. Wish you and yours all the very best. 

Regards,

Kerem

Hi Dyson,

Thanks for replying to my post, as u said the point (14,28) is in off screen . I could not create any sprites in the offscreen  . And a new problem raised yesterday, if i add more no of sprites to a map , does the performance of the mte reduces ?  Because when i add four sprites the performance is OK, but when i increase more than that say (6) sprites, my game is lagging very much. If not what are elements that will reduce the performance ? And all the best for finding a new job.

Thanks,

Kumar KS. 

+1 on asking about the performance stuff, sounds like a very broad question though. I’ve been hearing lots of stuff like offScreenPhyscis is a huge performance drop, etc. I got like a 40x40 map, 10 NPC, 2 monsters, lots of animating stuff, multilayering of stuff, UI and inventory and stuff is starting to lag for me too.

Hi Dyson

Just bought this a couple of weeks ago and first now I have the real opportunity to try it out.! And so far I like what you done :wink:

But…

The first problem I have is with the onComplete on moveSpriteTo, in my test it fires directly and not after the time it has been completed !?The doc say it should fire when the move is completed but that seems not to be the case…it just fires as soon the move starts…
Example:
mte.moveSpriteTo( { sprite = hero, locX = xTile, locY = yTile, time = 2000, transition = easing.linear,onComplete=removetile(player.level,xTile,yTile,name) } )
Is it supposed to work like this or are I just doing something wrong ?

The other problem I have is, how do I specify the physics for some of the objects in tiled (not all) and mte will pick it up ? seems like what ever I do my physics objects will just fall past the tiled objects (think about it as a platform game with only one tiled level),… any ideas ?

I’m will kind of answer my own question here ;)  Seems like you just add the physics properties into tiles and mte will take care of it :D  sweet … (but it would be good it it was documented :rolleyes: )

MyJDdCE.png
Cheers

While on the topic of mte.moveSpriteTo(), I would like some delay parameter so when it does one movement, the next one can be delayed as indicated, not always fired right when its called. I am using the moveSpriteTo as my monster movement, and would like them to delay before each movement (check longer for an object to go in their range before they start moving again)

hi,

Still playing around and trying to get things to work, so at the moment I’m using the “Castle Demo” to try my ideas.

So I’ve enabled physics on the tiles (bodyType = static and physics = true) but what I discovered was that when I set the mte.physics.setDrawMode(“hybrid”) in the main.lua, the physic collition area is much smaller then the tile !!. After a bit of testing it seems like it’s down to the
local scale = 2

mte.setCamera({ locX = 53, locY = 40, scale = scale})

if I put the scale to “local scale = 0” then the tiles collision area is the whole tile…but then the whole map is tiny

I would assume that when you change the camera “scale” it would change the physics collision area as well or is it something else I need to do?

Cheers
 

Rotter; I’ll look the problem with moveSpriteTo’s onComplete parameter tomorrow. It shouldn’t be firing immediately, no.

Corona’s hybrid physics display is bugged such that it doesn’t update the hybrid display when the scale of the group changes. This is purely cosmetic. The collision bodies are the correct size, it’s just that the hybrid display output is the wrong scale.

Azmar; this sort of thing is beyond the scope of the function. One way you could achieve this effect yourself is to start a timer.performWithDelay at the end of one movement to start the next after the delay you specify. 

Dyson

Hmm something is not right here… See this video. https://vidd.me/u0k

All i did was to add the physics to the castle code and to the tiles properties.

As you can see, we have gaps where it should be static tiles and also the dynamic tiles are all over the place !.So think it’s more then a cosmetic issue. :blink: unless I’m doing something wrong…

I checked the onComplete parameter of moveSprite to and it is working correctly. Your situation- running a function but also passing parameters to it- requires the use of a Lua closure. Simply put a closure is a function that returns another function. If you set onComplete equal to a function, that function will always run immediately. This isn’t a problem when you set it to the variable declaration of the function, because the function stored at that address will then run when the move is complete. However, calling a function will do just that: call a function, immediately.

mte.moveSpriteTo( { sprite = hero, locX = xTile, locY = yTile, time = 2000, transition = easing.linear,onComplete=removetile(player.level,xTile,yTile,name) } )

You are calling removetile(player.level,xTile,yTile,name). The function will run immediately and onComplete will be set equal to its output, which in this case I’m guessing is probably nothing.

You can change it like so:

mte.moveSpriteTo( { sprite = hero, locX = xTile, locY = yTile, time = 2000, transition = easing.linear,onComplete= function() return removetile(player.level,xTile,yTile,name) end } )

With this modification, you are calling the Lua closure immediately, which returns the function you want to call later, along with the variable arguments used by it, and onComplete is set equal to this function.

The default behavior of Corona’s physics implementation is to have downward gravity. The dynamic tiles are all over the place because they are 1) colliding with each other and the nearby static tiles and 2) being pulled down by gravity. Dynamic tiles are treated like sprites; they are not culled by the engine when they move offscreen. Static tiles are culled when they move offscreen. The result is that the dynamic tiles begin to “fall” towards the bottom of the screen because the world has culled out from under them. When you move back towards that part of the map and it comes onscreen, the engine respawns the static tiles which effectively lock the dynamic tiles in place where-ever they were at the time.

You can change the gravity with a physics API call:

physics.setGravity(0, 0)

You may find that the active tiles still wander around when they’re offscreen due to the last push given them by the static tiles as they cull. You can give them a shape property to define the shape of the physics body. You may want to reduce the (true) size of the physics bodies so that they don’t touch their neighbors and jostle around as they do in the very beginning of the video you posted.

As for the gaps which should be static tiles, are you sure you used the same grass tile, or that all the grass tiles have physics enabled? Some of the tilesets used in CastleDemo have duplicate tiles.

HI ,

In my game on each time exit, i am cleaning up mte by calling mte.cleanup(). But still my memory is keep on increasing for each game i play . More over i am manually cleaning all the objects which i am creating . 

Thanks,

Kumar KS.

This has probably been asked before, but I can’t seem to find it.  Using the castle demo code, I have a Tiled layer for ground (with layer property “level” = 1) and another Tiled layer for obstacles (layer property “level” = 1 as well), and the tiles in the obstacles layer all have the property “solid” = true.  I would expect the sprite to collide with the obstacles since they all have the same level property, but the sprite just walks beneath them.  If I place the tiles on the ground layer, it works (but the tiles don’t look right, so that’s not an option).  How do I get MTE to recognize that the two layers are on the same level?

Has anyone else had trouble with a culling artifact?  I have a slight black line on the right side of the screen when standing, and when the sprite starts walking to the right you can see the empty tiles before they are filled.  When the sprite walks to the left, you can see the tiles on the right edge being deleted before they are off screen.  I think the only real difference between this and the castle demo is that the tiles are 40x40 instead of 32x32.  The sprite is also off centered to the left, which makes me think the larger tiles are shifting the visible screen to expose the tile culling on the right side.