Million Tile Engine Beta Release

Wow physics integration - this engine just gets better and better. I really didn’t think you’d be contemplating adding physics, if you can keep the speed up and handle all of the hassle with physics (groups, offscreen, etc…) then I, sir, will me mightily impressed.

Not that I’m not already :slight_smile:

@NinjaPig - if it’s anything like the previous examples (haven’t downloaded the latest version yet), obstacles are simply a flag set in Tiled, which the engine calculates with an isObstacle function.

Hi

 Is any schedule to support isometric tiles  ?

That will be pretty cool

this looks awesome! what about NPC and all, enemies? Do you think tha’ts an easy thing to add?

congrats again!

Indeed, great work :slight_smile:

Very nice - I had a sonic demo going, had him running, sprinting, jumping, spinning, ducking, skidding etc, now I have an easy way to do the parallax scrolling and level design :slight_smile:

For payment processing I’ve heard good thins about gumroad.com - and apparently they have a system for sending out software updates. Not used them myself but heard good things about them.

Well, SegaBoy, I wasn’t originally planning on adding physics support at all, but after working on the platformer samples it occurred to me that physics could simplify some of the tasks particularly where different game genres cross. It makes sense to do your own calculations to control Sonic because he doesn’t necessarily act in a physically accurate way, for example he sticks to sloped ground rather than running into the air at high speeds. However if someone just wants to, say, bounce a ball around a room in an RPG in a freeform manner- not locked to the grid- it would be a hassle for them to have to program the whole state engine just for that sideshow. 

@Ninja Pig Studios; SegaBoy has it down. I don’t have access to my files right now, but collision detection basically boils down to calculating the future position of your sprite, checking for tiles there, and checking for whatever tile property you use to determine whether a tile is solid or not. For RPG type games where the sprites are fixed to a grid like CastleDemo, this is pretty straightforward. You just add or subtract 1 from the sprite’s locX or locY parameter and check that location for solid tiles. Collision detection in a platformer is more or less the same but with per-pixel accuracy. You figure out where the “feet” of the sprite will be and check to see if they’re within a tile. If they are you adjust the velocity so they land ontop of the tile. The feet in this case are points you define in your code relative to the sprite. Platformer collision detection can be a little tricky, but I’m hoping Physics integretion will make this easier for people.

@dingo; The hardest part of Sonic movement in my opinion is getting him to stick to and land on the ground. Once that is taken care of the rest is relatively easy because it only interacts with the code you already have. The ground collision code would work for enemies without changes if I remember right. All you’d need for the enemies is their own velX, velY, etc 2D movement variables. Flying enemies would be quiet a bit simpler. Jumping on an enemy would be as easy as checking for a distance threshhold between the Sonic sprite and the enemy, checking whether Sonic’s isJumping variable is true, and if so adding to his Y velocity for the characteristic post-baddy-destruction hop. Spinning, spindash, ducking, etc, would all involve finagling with the control inputs and setting up a bunch of boolean flags, but the annoying part- the ground detection- would need little modification.

@Danny; Thanks Danny! Kudos are much appreciated. 

@nick_sherman; Thanks nick_sherman! I’d been itching to do something Sonic related for a while now.

Thanks for the suggestion binarymoon. I’ve sent inquiries about software updates to both Gumroad and Quixly. Gumroad is interesting in that it takes credit card payments while Quixly takes PayPal. I can see advantages and disadvantages to both, but software updates will probably be the deciding factor.

EDIT: Actually, whether they work in all popular web browsers will be the deciding factor.

Thanks for update 0.8 dyson122! Performance improvements anywhere are always good to hear

EDIT: So im wondering how to make the player “stop” when trying to walk over certain tiles. In your examples you used Solid:true, but that doesnt work on my tiles.

MTE is now available through Gumroad! The relevant links have been updated. 

http://gum.co/staO

Codingcake: I do plan on adding isometric tile support, however given the complexity of the addition I have as yet no idea how long it will take to complete. I’ll have a better idea after I finish the current update / platforming sample and begin working on it.

Quick question - I’ve been looking at the Open Source Corona Tiled library that a couple of guys are developing. However I am interested in the MTE. I need to use A* pathfinding and for this I need a 2D array of the tiles. Currently CT doesn’t have that built into the data structure so was wandering whether this is the case for MTE?

Quick synopsis - I’ve made a simple tile engine in a 2D array, storing the tile and relevant properties. A* library then runs through this 2D array to calculate shortest path. I do however want the luxury of maps designed via Tiled - hence why I’m lloking at CT and MTE.

Any answers would be appreciated…

I’m actually in the process of doing this right now. This isn’t the most efficient approach, but what I’ve done so far is take the map and create an pathing array:

[lua] 

local map = mte.getMap() 

     mapArray ={}

        local mapH  = map.height

        local mapW = map.width

        for i = 1, mapH do

                mapArray[i -1] = {}

            for j = 1, mapW do

                mapArray[i-1][j-1]=1

            end 

            

        end 

[lua]

Now I set a flag in the object layer when a path is clear so the first step basically sets everything as non traversable. Next step run through the object layer setting values appropriately. My object layer items have x/y so it is simple:

[lua]

local objLayer = mte.getObject({ layer=OBJ_LAYER})

        for x = 1, #objLayer do

            mapArray[objLayer[x].x][objLayer[x].y] =0

        end

[lua]

Note that I’ve just set this up and haven’t tested it yet :slight_smile:

I’ve got A* working perfectly - however it relies on having that 2D array structure. I’m assuming that, from your comments, MTE doesn’t provide this structure, so have to do a workaround as I’m doing with Corona Tiled?

Thanks for the info…

Hello SegaBoy,

You can access the 2D world arrays using mte.getMap(). For example:

local mapData = mte.getMap() print(mapData.layers[4].world[7][15]) --access tile index at (7,15) on layer 4

Regarding tiles for A* and other pathfinding… (I’m using Lime for my current project, but I don’t think the tile engine matters in this case.)

I’m not using A*, but the Jumper library from Roland Yonaba (https://github.com/Yonaba/Jumper) and it wants a 2D array to know where the path can be.

In Tiled I created a tile layer that’s at the bottom of the list (tiles in there are drawn first, everything else is drawn on top of those) and named it walkable.

On that layer I just placed tiles in every location that was NOT walkable – walls, crates, etc. I ended up with a layer of lots of zeros and some other things. Jumper sees zeros as empty locations where it can place the path.

When you export that layer as Lua you get a table of data that’s easy to change into what Jumper needs:

Original:

[lua]

data = {

1,0,0,0,1,

1,1,0,0,1,

1,1,0,0,0

} [/lua]

New:

[lua]

data = {

{1,0,0,0,1},

{1,1,0,0,1},

{1,1,0,0,0}

} [/lua]

Creating a utility to tweak the exported data automatically wouldn’t be hard, but doing it by hand (even on a large map) takes less than a minute.

 Jay

Congratulations, this looks like one of the coolest things to be offered in the Corona community for some time.

Insta-buy…even though I’m not currently in need of a tile engine I’ve purchased to show support of your efforts. Well done sir.

Hi Jay - thanks for the info.

The process I have at the moment is to build a simple 2D array and add attributes to the tile - A* then checks tiles and looks for any tiles with .isObstacle = true to discover the shortest path without obstacles.

I’m planning to have plenty of logic in the environment (interactive items, scent based pathfinding, etc…), but trying to build maps by hand is an absolute nightmare - hence why I want to use Tiled and a tiling engine that will allow all of this.

@dyson122 - thanks for the info, that pretty much sells MTE for me :slight_smile:

Just picked this up and beginning to dig into it but wanted to say that first impressions are amazing; one of the most astounding pieces of Corona code I’ve seen so far and everything appears to be really tidy.

Nice job.

Mario samples are so passé.

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

Thanks for the Kudos SegaBoy! I look forward to seeing what you come up with.