Pathfinding and animation solution

Ok, so I just started a project in Defold.
All good and dandy(as a Web Dev I thought it would be a breeze to work with a Lua based game engine - I was wrong),
the engine works great, but I have some questions:
First of all I’m working on a grid based tower defense game, using jumper for the pathfinding.

  1. How the event structure should look for the “unit movement”?
  • right now I’m calculating the path at init and using go.animate with a callback to a function that executes another go.animate for the same game object with different duration and delay. So they are all queued and executed in order. Is there a better way of doing this?
  1. Does anybody have some resources about factories? I can’t find any. (I was expecting this because of the low, let’s say “popularity” of the engine). I don’t really understand what they do and how to use them.

  2. Is there any way of creating plugins or extensions. I would be interested in integrating some JS to Lua transpiler of some sort.

  3. Thanks for the awesome engine, I’m enjoying it more than I did Unity :smiley: .

  4. Waiting for the black theme!

Kind Regards

2 Likes

Welcome to Defold! Let me try and answer your question the best I can and maybe others can also assist:

  1. How the event structure should look for the “unit movement”?
    This is a very broad question with many answers. You mentioned a tower defense game. Are the units moving along a straight line, pre-defined path, a dynamic path using pathfinding? If it’s a straight line the go.animate() is your best choice. If it’s along a pre-defined path, then you can either use go.animate() between each point in the path or move programmatically in update(). If it’s a dynamic path based on path finding and reevaluated several times then you can use either go-animate() or update()

  2. Does anybody have some resources about factories?
    Factories are described here: http://www.defold.com/manuals/introduction/ and here: http://www.defold.com/manuals/collection-factory/ Let me know if you do not understand how they work after reading the docs.

  3. It depends on the kind of extensions you wish to create. You can write extensions in Lua. We are working on a extension system for C code. We might also add support for LuaJIT FFI extensions.

1 Like

Thanks for the tips but still can’t get factories to work.
In the editor I click the browse prototype button ("…") and nothing shows up. My guess is I should select a game object but nothing shows up there.

Anyone can help?

Attached image of the editor

[EDIT] Nevermind, found out I have to use a game object outside of an collection.

It has to be a game object defined on disk, i.e. visible in the Project Explorer.

1 Like

Yup, that seemed to be the solution. Thank you!

I decided to break out and clarify some things so here is a brand new manual specifically on factories here: http://www.defold.com/manuals/factory/

5 Likes

Awesome! Thank you!

Excellent! Factories do indeed warrant their own section in the manuals!