Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Dusk Engine
Started by Caleb P Dec 13 2013 12:22 PM

193 replies to this topic
dusk engine tilemap game engine opensource
[TOPIC CONTROLS]
Page 1 of 8 1 2 3 »
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Pro
  • PipPipPipPipPipPip
  • 941 posts
  • Jedi

After many, many pages of comments on the original forum post, the Dusk Engine is now live on GitHub.

 

From the readme:

 
The Dusk Engine (concept version named CoronaTiled; pre-beta named Ceramic Tile Engine) is a fully featured game engine for Corona SDK. It's designed to help you "weed out" extra code for level creation and let you focus on the game mechanics, instead of the level makeup.  
 
That pretty much sums up what Dusk is.
 
 
Documentation can be found here: https://github.com/GymbylCoding/DuskEngineDocs
 
- Caleb


[TOPIC: post.html]
#2

Panc software

[GLOBAL: userInfoPane.html]
Panc software
  • Pro
  • PipPipPipPipPipPip
  • 741 posts
  • Jedi

Someone replace the Lime forum with this in the Tools & Services forum group!!!



[TOPIC: post.html]
#3

soggybag

[GLOBAL: userInfoPane.html]
soggybag
  • Starter
  • PipPipPipPipPipPip
  • 253 posts
  • Jedi

Great, just dowloaded this will try and make something tonight. Thanks!



[TOPIC: post.html]
#4

Azmar

[GLOBAL: userInfoPane.html]
Azmar
  • Pro
  • PipPipPipPipPipPip
  • 82 posts
  • Jedi

Everything looks amazing with the new engine! Only my second week into corona and lua, after testing your old engine I am trying to bring everything over from my old game with the new engine. When I load up my map and insert it into the gui, only the bottom layer stays on the map but any multiple layers in the .json file all fall off the screen right when I start the program. I tried making them static in the tiled program (the other layers), or insert each layer into the back.gui but those did not work.


Edit: I tried doing gravityScale = 0 to the layers and that did not work, adding objects to the screen work fine doing that method just not with multiple layers in Tiled.



[TOPIC: post.html]
#5

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Pro
  • PipPipPipPipPipPip
  • 941 posts
  • Jedi

Are you sure you're using the right layer properties?

 

Here's the correct approach (where the first is what you enter into the "name" field, and the second is the "value" field).

 

For an object layer:

objects:bodyType          =          static

 

For a tile layer:

tiles:bodyType          =          static

 

- Caleb



[TOPIC: post.html]
#6

soggybag

[GLOBAL: userInfoPane.html]
soggybag
  • Starter
  • PipPipPipPipPipPip
  • 253 posts
  • Jedi

Just started playing with this. I'll have to rebuild my last project, it's not a drop in replacement. No big deal, I needed to rewrite everything it was getting sloppy. 

 

I ran into a problem with setCameraBounds() which, now takes a bounds object. This is what I came up with for bounds to keep the map in the viewable area of the screen. 

 

map.setCameraBounds( {	xMin = map.data.width - map.data.width * 0.5, 
						xMax = map.data.width - map.data.width * 0.5, 
						yMin = display.contentHeight * 0.5, 
						yMax = map.data.height - display.contentHeight * 0.5 } )

 

I noticed a few things. It seems you can now set physics properties, in Tiled, without the prefix: physics.  For example: bodyType = static, seemed to work fine. 



[TOPIC: post.html]
#7

soggybag

[GLOBAL: userInfoPane.html]
soggybag
  • Starter
  • PipPipPipPipPipPip
  • 253 posts
  • Jedi

Here's a Tiled question. What options are available for Image layers? I'd like to add more than one image layer and position the image on the layer. It seems if I load an image the image is always on the left. 

 

I suppose this could be handled with large tiles? Or I could move the image with code in my program. 



[TOPIC: post.html]
#8

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Pro
  • PipPipPipPipPipPip
  • 941 posts
  • Jedi

I ran into a problem with setCameraBounds()

What problem did you have :)?

 

I noticed a few things. It seems you can now set physics properties, in Tiled, without the prefix: physics.  For example: bodyType = static, seemed to work fine. 

No, the only reason bodyType = static works is because bodyType is a Corona property, not a physics value:

physics.addBody(myObj, "static", {}) -- Sets bodyType = static
myObj.bodyType = "dynamic" -- Sets it to dynamic, this is the only property (except for isSensor) that this can be done with

 

Here's a Tiled question. What options are available for Image layers? I'd like to add more than one image layer and position the image on the layer. It seems if I load an image the image is always on the left. 

Not many :) Tiled image layers don't currently have many abilities. Basically all Tiled enables you to do is display an image in the top left corner. You can, of course, use Dusk to position it with properties like so (representing the Tiled properties dialog for the image layer):

x          :          55
y          :          103.8314

 

A better solution than that (this should work with the camera) would count on the fact that the actual image object is created as layer.image:

image.x          :          55
image.y          :          103.8314

 

- Caleb



[TOPIC: post.html]
#9

soggybag

[GLOBAL: userInfoPane.html]
soggybag
  • Starter
  • PipPipPipPipPipPip
  • 253 posts
  • Jedi

Liking the new engine, seems to be working well so far. Is it possible to scale stiles up? For example I have some 32 by 32 pixel tiles that I would like to display at 64 by 64 pixels. I like the pixel look and the smaller tiles would take up less file space.

[TOPIC: post.html]
#10

PewPewNinja

[GLOBAL: userInfoPane.html]
PewPewNinja
  • Starter
  • PipPipPip
  • 42 posts
  • Advanced Member

Caleb im moving from lime to dusk engine and i wonder what is the best way to implement enemies,



[TOPIC: post.html]
#11

Sape

[GLOBAL: userInfoPane.html]
Sape
  • Pro
  • PipPip
  • 19 posts
  • Member

How can I erase a tile (or change its alpha value etc) from a layer permanently? I might be doing something totally wrong, but I tried to fiddle with tile alpha and also tried layer.erase() with proper x&y positions. Everything works ok as long as the modified tile stays in the camera view. But when I move the view so that the modified tile is out of bounds and then re-enter, the erased tile is drawn to the view again.



[TOPIC: post.html]
#12

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Pro
  • PipPipPipPipPipPip
  • 941 posts
  • Jedi

@soggybag:

There isn't a built in function; try this:

map:scale(2, 2)
map.updateView() -- Make sure you do this when scaling or you'll get a slight jitter

 

@PewPewNinja:

I'd create your enemies separately and then add them to the map:

local enemy = display.newImage("myEnemy.png")
enemy.whizzbang = 53
enemy.moose = "Mushroom"
 
map.layer[whatever]:insert(enemy)

If you want to position your enemies from within Tiled, you can do that as I did with the Bob sample: create a property value for the enemies' position (nested tables would be best if multiple enemies exist) and position them when you load your level. Dusk's property entry with dots ability makes this easy:

Tiled Properties:
enemyPositions.1          :          !json! [10, 20]
enemyPositions.2          :          !json! [30, 31]

Then, when you create the enemy:

enemy.x, enemy.y = map.layer[whatever].tilesToPixels(map.enemyPositions[1][1], map.enemyPositions[1][2])

 

@Sape:

I'll add this as soon as I can. There isn't a built-in way to do this yet (other than erasing it each time it gets drawn, which could get hairy).

 

- Caleb



[TOPIC: post.html]
#13

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Pro
  • PipPipPipPipPipPip
  • 941 posts
  • Jedi

@Sape:

Just pushed a commit that enables this. For any tile layer, now, to lock a single tile, use this:

map.layer[1]._lockTileDrawn(35, 21) -- Now this tile will never get erased

map.layer[1]._lockTileErased(35, 21) -- Now this tile will never get drawn

map.layer[1]._unlockTile(35, 21) -- Remove any locks from a tile

 

You can also lock a section with the lock command, which works like draw or erase:

map.layer[1].lock(1,23, 1,23, "drawn") -- Last one can either be "drawn" or "d"; "erased" or "e"; or "unlock" or "u"

 

- Caleb



[TOPIC: post.html]
#14

Sape

[GLOBAL: userInfoPane.html]
Sape
  • Pro
  • PipPip
  • 19 posts
  • Member

Thanks Caleb for the fast commit, _lockTileErased does exactly what I need.

There seems to be a small issue in the camera.lua update function, viewY seems to be be calculated using xParallax instead of yParallax?



[TOPIC: post.html]
#15

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Pro
  • PipPipPipPipPipPip
  • 941 posts
  • Jedi

Just committed that issue, too :)

 

- C



[TOPIC: post.html]
#16

Azmar

[GLOBAL: userInfoPane.html]
Azmar
  • Pro
  • PipPipPipPipPipPip
  • 82 posts
  • Jedi

I been fiddling with the code more, still using the base dusk code example folder I decided to add onto it  with a player sprite sheet based off a character. Added a player:setSequence("moveDown") when he is moving down in the pointInRect part. And also added a new flag for when he stops animation in the direction he chose he stays "still" in the direction he was facing so moving right he stays right still. I modified the code a bit to get rid of rotation.
The problem I am having is sometimes during any movement phase he will "slide" while still moving just the animation won't change, this happens sometimes when changing directions or after going in same direction after a few seconds. Any way to fix this? I can post code as its just adding onto the dusk example.

 

Another side problem is sometimes a black line occurs on screen and its usually a black line vertically coming down? I think this a problem with the camera? I updated it to (1) to follow the character better to always center him.

Thanks for the help, amazing new engine, very clean and easy to understand!



[TOPIC: post.html]
#17

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Pro
  • PipPipPipPipPipPip
  • 941 posts
  • Jedi

I think I'll have to see your code, as I don't quite get what you mean :)

 

As for the lines, are you speaking of the quick flickers that sometimes go across the screen? If you are, I'm not sure how to fix them. Possibly extrude the tileset?

 

- Caleb



[TOPIC: post.html]
#18

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Pro
  • PipPipPipPipPipPip
  • 576 posts
  • Jedi

I just learnt today about this new map library. It looks pretty cool.

 

Two questions:

 

(1) Is there any document I can read in order to use it?

 

(2) Is it possible to use it for this kind of game: http://goo.gl/uLCzUc



[TOPIC: post.html]
#19

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Pro
  • PipPipPipPipPipPip
  • 941 posts
  • Jedi

1) Yep - here: https://github.com/GymbylCoding/DuskEngineDocs. Sorry for not posting that originally.

 

2) Hm... Difficult question. You can simulate *something* like it by changing the appearance of your tile images. Currently, though, Dusk doesn't support "full" isometrics.

 

- C



[TOPIC: post.html]
#20

Sape

[GLOBAL: userInfoPane.html]
Sape
  • Pro
  • PipPip
  • 19 posts
  • Member

There seems to be an issue with layer iterators, as all the layers seem to be added to the layerList.tile instead of proper ones (object & image).

 

Anyways, I was wondering why are there two copies of each layer in the map.layer table (Or atleast so it seems)? There seems to be a layer with number/index as its key, and other with the actual layer name. And also the tiles seem to be in the tile tables two times. So for example after loading the map and iterating through each object layer to find a tile with a certain unique properties, two layers contain two objects that match the properties that I'm searching. I can handle this and only do my stuff to the first object that meets my search criteria, but was was wondering is this as intended?



[TOPIC: post.html]
#21

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Pro
  • PipPipPipPipPipPip
  • 941 posts
  • Jedi

Thanks for the input - I just committed the fix for that :)

 

There are two copies so that you can have the easiest access:

map.layer[1] -- Will always point to the first layer
map.layer["name"] -- Or you can do it from the name

 

As for the tiles in the tables twice... Can you please expand a bit? That doesn't sound so good :(

 

[EDIT] I think I've got what you mean, actually - you mean the object layer's objects? They're the same:

layer.object[1] -- For for i = 1, #layer.object iteration
layer.object["name"] -- For easier object access

 

- C



[TOPIC: post.html]
#22

Sape

[GLOBAL: userInfoPane.html]
Sape
  • Pro
  • PipPip
  • 19 posts
  • Member

Yep, that was exactly what I meant. I was a bit confused when iterating through the objects and they seemed to be there twice.

Thanks for the quick answer.



[TOPIC: post.html]
#23

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Pro
  • PipPipPipPipPipPip
  • 941 posts
  • Jedi

For the reference, using layer.objects() should always go through the objects but once; you can use it for iterating:

for object in map.layer[1].objects() do
  -- Whatever
end

 

- C



[TOPIC: post.html]
#24

soggybag

[GLOBAL: userInfoPane.html]
soggybag
  • Starter
  • PipPipPipPipPipPip
  • 253 posts
  • Jedi

I created an object layer in Tiled. Named it platform, and assigned the following properties:

 

bodyType = static

collisionType = platform

physics:bodyType = static

physics:enabled = true

 

I was expecting this to make all objects on the layer physics static bodies. For line objects I couldn't see them. For boxes the objects were dynamic. 

 

Setting properties on each object worked. Though,

 

physics:bodyType = static

 

did not set the body type, while:

 

body=static 

 

Did set the body type to static. 

 

Is it possible to set the properties for all objects on a layer in one place? Seems like this worked in the pervious version?



[TOPIC: post.html]
#25

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Pro
  • PipPipPipPipPipPip
  • 941 posts
  • Jedi

bodyType is a special value; it's not added (not even in "normal" circumstances) from within the physics table. So when you want to set the bodyType, you have to just add it to the object, not the physics table (which means bodyType isn't prefixed by physics:).

 

As for properties for the objects, use the objects: prefix:

objects:bodyType = static

 

For tile layers, note that this prefix is tiles: instead.

 

- Caleb




[topic_controls]
Page 1 of 8 1 2 3 »
 
[/topic_controls]



Also tagged with one or more of these keywords: dusk, engine, tilemap, game engine, opensource