Tiled Map Engine

here a video of the issues

https://www.youtube.com/watch?v=7zlMyP46tcs

thanks

Hi.

I forgot to give a value to velY so that was the strange behaviour  :wacko: .now it is  solved.

-Still doesn´t know why is not landscape as the map is wider than taller and the way to implement  parallax.

Can anybody post also a quick example that how should enemies be added?from a spawn point as the player and giving different properties to the spawnpoints(properties as enemy.speed=1.5, enemyallowedmovement=200,enemy.x,enemy.y,…)

How can be removed when the player kill them?i can not find in the documentation

edit:

i have tried this both solutions  for parallax at enterframe but doesn´t work

[lua]

                map.layer[“fondo2”]:setLinearVelocity(velX*0.2, velY*0.2) 

                map.layer[“fondo2”]:translate(velX*0.2, velY*0.2) 

[/lua]

thanks in advance

Quick update on engine progress:

I’ve created a “data structure” called a  Twindex - named because of its two almost identical index lookup tables - that allows for quick X,Y position lookups. It’s based on the idea that if you can iterate only through the X,Y positions that actually have something in them, things will work a lot faster. For example, if you are iterating through 24 cells each frame, but only 2 of them actually have something in them, you could actually just do those two and achieve the same effect.

Anyhow, things are looking good - Twindex implementation’ll take a while, but it should be worth it, I think :slight_smile:

Quick question for the community:

Which is better, a single-file tile engine with all the code in one Lua module or a folder with cleaner code but more files? I’m wondering whether Ceramic should be split up into multiple files or not - all usage would be exactly the same, you’d just require() it with

[lua]

local ceramic=require(“Ceramic.Ceramic”)

[/lua

EDIT: If no one has a preference, I think I’ll split things up to get the code cleaner and less overwhelming.

I prefer many files with cleaner code, i think is easier to understand, but thats me :slight_smile:

great about the Twindex! ill check it out!

Hi guys - just getting started - have got a few items to ask:

  1. Lastest Code - Is it from here?  https://github.com/GymbylCoding/CoronaTiled  (still called CoronaTiled?)
  2. Latest Doco - Is it from here?  https://github.com/GymbylCoding/CoronaTiled/wiki/Documentation
  3. Forum for discussion - here I assume?  :) 
  4. Bugs/Issue Register - Is there one?  Location?
     
  5. Trying to get the object layer working.   When I try to the platforms part of the sample app it actually crashes the simulator (I’m on a recent daily build).  Any ideas how to get it going?  
    Exception Type:  EXC_BAD_ACCESS (SIGSEGV)

Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000021
 
6. Also I’m noting I can’t open the Platformer.tmx file up in Tiler either, I get "Error loading tileset image: ‘/Volumes/MAC_HDD/greg_oldHome/source_tiled/CoronaTiled-master/tilesets/8-bit.png’

Line 4, column 68".   

Will a basic background tile I get the very thin lines between tiles.  How do you normally handle this to remove it? Going to the tile layer in Tiles are letting a layer property of “layer:layerScale” to 1.1 does not seem to do anything?

Probably shouldn’t ask more at this stage :slight_smile:  If I can get an object layer example going (after getting some feedback from above) that would be great…

 

Ok, let’s see.

  1. Yep - the CoronaTiled name is because the repo was saved as CoronaTiled (that was the original name) and you can’t change the name after it’s been created.

  2. Yep

  3. Yep

  4. Unfortunately, forked repos don’t allow issues, for some reason, so the issue tracker’ll be on the original page: https://github.com/superqix/CoronaTiled/issues

  5. Hm… It’s working for me. Any more information?

  6. Apologies, I changed the name from 8-bit.png to 8-bit_mario.png. If you download the newer commit, that problem should be fixed.

  7. That can generally be handled by setting the min- and magTextureFilter to “nearest”. I’ll have to see if Ceramic automatically scales tiles or not, also.

  • Caleb

re 6 - I can open it now thanks

re 5 - in the console I just see this (and separately there is the Mac report dialog that comes up).  I’m on simulator build: Version 2013.1161 (2013.7.12).   Did export the platformer level just to see if this fixed things but it didn’t…
 

2013-07-18 20:54:17.033 Corona Simulator[19168:707] The file sandbox for this project is located at the following folder:

    (/Users/Greg/Library/Application Support/Corona Simulator/CoronaTiled-master-849B7505F1423B47A5277C793373E1D9)

/Applications/CoronaSDK/Corona Terminal: line 9: 19168 Segmentation fault: 11  “$path/Corona Simulator.app/Contents/MacOS/Corona Simulator” $*

Gregs-MacBook-Pro:~ Greg$ 

(PS - wonder if it’s related to this somehow - was this understood/fixed? http://forums.coronalabs.com/topic/29681-tiled-map-engine/?p=191863  )

I’m not a very hard-core computer tech or anything, but I think a segmentation fault occurs when an address that doesn’t exist is attempted to be accessed. It’s not occurring for me, though, which is the odd thing. I’m on build 2013.1137, so I’m a little older than you, but that shouldn’t do anything, or at least I don’t think it should.

I really have no earthly idea what could be happening. The only thing I can think of is, if you really want the bug fixed, to start debugging it yourself. It doesn’t crash for me, or I’d debug it - when I open it, it works perfectly.

As for the other error you mentioned in your PS, that was fixed.

  • C

just reverted back from build 2013.1161 to 2013.1137 and it works now…doh!   Wonder what CoronaLabs did in the later build…we could lodge the whole project in as a bug & say it crashed the simulator?

Branch is merged!!!

https://github.com/superqix/CoronaTiled

Congrats to Caleb on a great addition to the project!

Hi Jedi - how does this compare to what was at " https://github.com/GymbylCoding/CoronaTiled"?  If we were just on this branch does going to https://github.com/superqix/CoronaTiled give us some features or bug fixes?  Which one should we look to from here on in?

They are now the same project–of course they’ve always been the same project, I was just a little slow on the merge request :) 

This is the way github works, when you want to make a change you “fork” the project–which lets you break it and add stuff–and once you are done your “merge” it back in the main project.

Make sense?

ok - just wondered if you had improvement that may have been in your branch that I haven’t seen yet? i.e. just that you mentioned the word “merge”…  which one should we go to now as the main source?  (still haven’t got my head fully around the “git” concept - easier to understand the one central repository previous concepts :slight_smile:  )

hi,

are xParallax,yParallax layer properties working now?

I have created 2 layers on Tiled and change its parallax properties with different values but the whole map moves at the same speed

thanks

@txarly:

Yep, they work, but only if you’re using the built-in camera system.

@greg886:

You can kind of envision the GymbylCoding/CoronaTiled page as my “work desk” for it, and the superqix/CoronaTiled page as the main public version. So now you’ll want to go to the superqix page for everything :slight_smile:

  • C

@Caleb - ok thanks - I’ve marked one a “stable” and the other as “daily builds” in my bookmarks to remember  :)

Can I ask a couple of general tile questions I’ve been trying to come to grips with & your advice:

a) What do you think is the optimal tile size?

 

b) How to handle background?  I have a background other than just a color, but rather a pattern.  Easiest would be (and I’ll try it out with memory stat’s enabled) put this as a tile.  Is this going to be OK?  Or is there a better technique noting it would be possible to have much larger tile sizes here, to limit the amount of display objects?   It’s almost as if you would want another map for this with larger tile sizes, but then tie the two together in terms of camera/movement…perhaps this is possible?

In tiled:2 layers each one with property values

layer 1


xParallax = 0.3

yParallax = 0.2

layer 2


xParallax = 0.5

yParallax = 0.2

and, i have this code but parallax doesn´t work i am missing something sure, any idea?

[lua]


    – Main EnterFrame Listener

    ------------------------------------------------------------------------------

    local function onEnterFrame()

    

    if gameIsActive == true then

        setPlayerVelocityX()

        map.updateCamera()

    end    

    end

    ------------------------------------------------------------------------------

    – Add Listeners

    ------------------------------------------------------------------------------

    Runtime:addEventListener(“enterFrame”, onEnterFrame)

    DpadBack:addEventListener(“touch”, move)

    jumpBtn:addEventListener(“touch”, jump)

    map.setCameraFocus(player)

    map.setCameraBounds(

        display.contentCenterX, map(“mapWidth”)*map(“tileWidth”)-display.contentCenterX,

        display.contentCenterY, map(“mapHeight”)*map(“tileHeight”)-display.contentCenterY

    )

[/lua]

Physics Question - Is there a way to define a custom physics shape for a tile, that will come across to Corona?   

For example say you want “grass” sticking up 1/2 tile above the horizontal concrete, with the top 1/2 of the tile being transparent.  So you only want a player to “touch” the grass after they are 1/2 way coming down through that tile.   Options would be as follows I’m guessing, which one would be best:

Option 1 - Specify path in Tiler & this passes through an Ceramic handles this (not sure if this is what you do now - guessing nt)

Option 2 - If Ceramic is where you specify the physics path, then I guess extend Ceramic to the path you want.  You would have to extend it in a way that it doesn’t get overwritten or “break” future Ceramic releases.  

Option 3 - Upgrade Ceramic to have ability to take a custom path from Tiler (specified in a property) and use this.

Others?  Which one would you recommend?   I’ll need to do it somehow.  Could specify an object location with a file name and then in my code manually add in an image piece with a physics boundary, however it would seem it would be nicer if you could specify/handle it via the Tiler map…

Let me know if I should add it the issues register as a feature request…

PS. Discovered the json support.  Tried putting these two parameters on a specific Tile Property, however it did not reduce the physics area for the tile down any.  

Question:  What’s the correct usage of “physics:shape” and how it works?  (for a tile)

physics:enabled,  true

physics:shape,    “!json![-16,0,16,-16]”

I did note that if I set “physics:enabled” to false for the tile, then it did drop off physics against all those tiles in the map (cool)

Any properties prefixed by physics: are added to the physics table:

[lua]

physics.addBody(myObj, { })

                        |

                   Physics Table

[/lua]

So physics:shape is just the shape of the tile. JSON should be used to define it, just as you’re doing, but it would appear that you only have 2 points: -16,0 and 16,-16 which should make a ramp line shape. However, it should work with any amount of points* - including two. Is it simply not adding the body, or…?

Glad you like the per-tile abilities… They _are _pretty cool, if I do say so myself - and I do say so :smiley:

  • C

* Limited, of course by Corona’s 8-point max