Dusk Engine

Many thanks for your advice.

One more thing: I noticed a small latency in tiles and objects when the camera is moving… means not each object is moved with the same speed. For example: when the ground is moving, objects set on top (or even in the same layer) are sometimes a little bit faster or slower when everything is moving. I mean NOT constantly and I guess it is the “old” rounding problem which is the cause. I now wonder how this is happening and what I can do to move everything with the same speed. For example: When a tree is put on a grass tiled ground and the world is moving (camera) the tree sometimes is moved a little bit faster or slower. I guess it’s because the rounding is turned off now… but aren’t the groups (with all tiles and objects) are moved as a whole? Shouldn’t this be smooth then? Is there a way to fix objects with the map 100%, so they move even and steady. Maybe some changes to the camera?

Thx for all ideas and help!

UPDATE: How exactly is the map.setTrackingLevel working? I had a value of 0.05… maybe this is somehow the reason!? Working with a value of 1 “fixes” the problem, but then the camera is stopping without delay. But having some delayed camera stop feels better. Is there a way to have both… no flickering object-map with some camera easing?

Sounds weird. The cause wouldn’t be rounding, because the camera just moves each group. And you say you have all your objects in the same layer (or layers with the same parallax ratio)? If you’re moving your ground directly and you’re trusting to Dusk’s camera system to move everything else, you should make sure you don’t have a tracking level set (use map.setTrackingLevel(1)). If that doesn’t help, can you record a screencast of what you’re seeing?

  • Caleb

Thx for the fast feedback. Here is what I have figured out so far and what I’m using right now:

I have a map with grass (layer tiles) and an object layer with the character and trees.

I have a TrackingLevel of 0.05.

The character is moved by adding 1px to it’s x and (or) y value or  diagonal 0.75px.

I have turned off the rounding.

When the character is moving there is a small “flicker” between objects and ground and even between different objects and the character. The flicker also is there when the character is stopped and the camera is still moving (because of its small Tracking value… with a TrackingValue of 1 the flicker disappears). The flicker first stops when the camera stopped moving 100%

I tested all the settings and when turning on the rounding the flicker seems to disappear (but not 100% -  tested in Simulator only). But then there is the blurry character sprite when the character is moved less then 1px … like for example only 0.75px.

So this is how I use it right now: I check if the character is moving then turning off the rounding. When the character is stopping I turn on the rounding, so the last camera movement is smooth. This way everything looks okay. There still is a difference between objects and the rest of the map while the character is moving but it’s better than a blurry character and because everything is moving it’s not so much of a problem.

I now ended up using a value of +1 for the character moving to get the best optical results.

While testing on the device I discovered something strange: When using for example a TrackingValue of 0.05 in the Corona Simulator the camera is moving to the character when the character movement has ended, centering the character in the center of the screen. But when testing the code on the device the camera stops with the character and is not centering the character. I updated to the latest version of dusk… is it possible it has to do with changes in the last version?

The character being blurry is not an issue with Dusk. That’s (I’m fairly sure) because of fractional pixels.

The flicker you mentioned: Is it the same flicker that happened between tiles?
The non-centered camera you mentioned: It didn’t happen with the version you had prior to this version?

  • Caleb

I bought your game today btw :slight_smile:

The blurry character I think I can avoid by moving with rounded values.

Regarding the flicker I guess it is the same what happens between tiles.

And the version I have used should be the one prior to the latest… it still had the manual code dusk.setPreference(“experimental:roundCameraPosition”, true) and it was working.

I will do some more tests tomorrow. Maybe someone can confirm/unconfirm a difference between the camera tracking in the simulator and on the device?

Caleb, I confirmed a different behavior in the simulator compared to device camera movement with the latest version of Dusk. I changed back to my ‘old’ Dusk version and the movement on the device worked fine like in the simulator.

There has to be something which handles the camera movement differently on a device (iPad4) in the latest Dusk version.

Anyone else can confirm this?

UPDATE:

I experimented with the rounding and noticed it maybe is the problem here. So please forget the post above and I will first look further into it!

Hi, is there a way to add blendMode to tiles or a tile layer?

@d.mach: Ok, let me know if you need anything more. And thanks for buying my game; I appreciate it :).

@sakid.farid: Yep. Just put it in your layer properties:
[lua]
tiles:blendMode : add
[/lua]

Or, for a single tile in the tileset, add it to the tile’s properties:
[lua]
blendMode : add
[/lua]

  • Caleb

Awesome! Thanks Caleb.

I just noticed when looking at a map generated with dusk doing nothing else the system memory is counting up. It’s not much, but I wonder if this can create some problems when for example a game is played for some hours straight?

Are you sure it’s Dusk doing that? I just tested on multiple maps and I can’t see that happening.

  • Caleb

Mhh… I don’t have anything else going on, but it could be something in the debug code which wasn’t written by me. When you don’t see a memory problem I’m sure it is something on my end then.

Sorry for the trouble!

No problem :slight_smile:

  • Caleb

Is there a sample available which shows how to use a simple RPG like birds eye map from tiled with dusk? I really could use a sample showing a map created in tiled with some grass, a sprite character and some trees. :slight_smile:

Thx for your help!

Daniela

Unfortunately, no. Just Bob, which is moderately similar. It’s like a top-down maze game demo (I’m sure you’ve already seen it, though).

https://github.com/GymbylCoding/Dusk-Engine/tree/master/Demos/bob

  • Caleb

Hi

Im a little confused as to how the parallax works in Dusk. I know you can add parallax.x and parallax.y values on a layer. Problem on a tile layer is that you cant add something beyond the end of the map which would then scroll in as you reach the end. Also hard to tell where things would end up. With the image layer you can only have a single image. A repeat option for the image layer would be great where you could repeat the image for a set number or unlimited.

Or maybe im missing a trick here…

I can’t get an animation to work when I’m using a second tileset. Here is some code from the json map file for the tileset and the animation settings.

The animation on the first tileset is running, but the second isn’t. Maybe you can see some error here?

"tilesets":[        {          "firstgid":1,          "image":"..\/graphics\/tiles\_set\_1\_64x64.png",          "imageheight":990,          "imagewidth":990,          "margin":1,          "name":"tiles\_set\_1\_64x64",          "properties":             {             },          "spacing":2,          "tileheight":64,          "tileproperties":             {              "18":                 {                  "bodyType":"static",                  "name":"treasurechest",                  "physics:bounce":"0",                  "physics:enabled":"true"                 },              "3":                 {                  "anim:enabled":"true",                  "anim:options":"!!! start: 1 count: 2 time: 1000"                 }             },          "tilewidth":64         },         {          "firstgid":226,          "image":"..\/graphics\/tiles\_FOW\_1\_64x64.png",          "imageheight":204,          "imagewidth":1020,          "margin":2,          "name":"FogOfWar",          "properties":             {                              },          "spacing":2,          "tileheight":64,          "tileproperties":             {              "226":                 {                  "anim:enabled":"true",                  "anim:options":"!!! start: 227 count: 3 time: 1000"                 }             },          "tilewidth":64         }],  "tilewidth":64,  "version":1,  "width":16

Ah… found the problem. After putting all the tiles into one tileset (which was NOT necessary I guess!) I noticed I have to subtract 1 from the frame number to make the sprite work. Means in the example above it should work with 225 instead of 226

"225": { "anim:enabled":"true", "anim:options":"!!! start: 227 count: 3 time: 1000" }

even when the tilemap number for using the tile is 226!