From Unity3d to Defold

I have been using unity for about a year or so, and I find defold incredibly confusing. Is there a tutorial for switching?

1 Like

No, we don’t have a dedicated tutorial for Unity to Defold. What do you find confusing? I’m happy to try to explain.

What is the alternative to prefabs? How do you create new scenes? Is Defold node based or component based?

In Defold we have factories that can be used to spawn game objects or groups of game objects. For gui components we have gui templates.

It depends a bit on what you mean by scene (I’m not really that familiar with Unity), but I assume that you by scene mean a level, screen or other larger function that can be navigated to somehow. If this is the case then you have a few options, but what people usually do is to contain a scene within collection and load/unload it using a collection proxy. If you don’t want to do a lot of that work yourself there’s a few screen managers in the Asset Portal, with Monarch being one of the more popular ones.

The basic building block of a Defold game revolves around game objects. Game objects live in a collection and they have an id and a transform. You can parent game objects and create a scene graph hierarchy.

Game objects are cheap and takes virtually no time to create, but they are boring. What makes them interesting is the fact that you can attach components to them. A component could be a sprite or a spine animation, a sound, a script etc.

Internally Defold keeps optimized perallocated lists for all component types and handles them one by one for optimal performance.

So, while we do have a scene graph we also internally use something very similar to an ecs system.

4 Likes

So in summary, prefabs are replaced with factories, scenes are simply collections that can be toggled, and defold is entity component based? Did I get that right?

1 Like

You can use plain factories with single GOs but it’s more flexible to use collectionfactories because then you can parent GOs and in the scripts of that collection you can reference things relatively so you can have a person.collection with head, body, foot GO and instead of needing to reference head42 it’s just head when messaging between each GO’s components.

Check out Monarch for handling screens it’s the best for it https://github.com/britzl/monarch

If you want to make 2D games the Orthographic camera extension is all you need https://github.com/britzl/defold-orthographic

If you want to do 3D the RenderCam extension is what you need https://github.com/rgrams/rendercam

Most of the time I use RenderCam but for pixel art projects I only use Orthographic.

For audio you should use FMOD https://github.com/dapetcu21/defold-fmod

There are a wealth of useful examples here to study and see how projects can be put together https://github.com/britzl/publicexamples/tree/master/examples

7 Likes

Yes, I believe you got that right!

I’m thinking of creating an FAQ or full manual page for users coming from Unity, Godot and similar engines. Much like the Defold for Flash users manual. If you have more questions or observations regarding differences or similarities between Unity and Defold, then please share them here!

8 Likes

Almost. Factories spawn stuff based on ”prototypes”. A prototype is either a game object file (single go) or a hierarchy of game objects in a collection file.

1 Like

When should it be ready?

Not sure. I’m caught up in other work this week. I also need more material to put in the manual so I need to interview users who have done the switch to learn about their difficulties. Please share any input you might have or questions!

2 Likes

I’d say Defold works totally differently in many ways.

Main thing is that in Unity you get so much built-in stuff thrown at you, and you sorta shield yourself from that and use some of the built-in tools first, then advance perhaps through adding stuff form the asset portal.

In Defold you’re getting…eee… well, not even a stub, but more like a stub placeholder. And then you go to the Asset Portal and pick even the basic components, such as the camera.

Sooo the first mile with Defold may be overwhelming, but enjoyable once you survive it.

Probably it may be easier to get around Defold once you watch the sort of a real-life use case:

Or if this is not your thing and you’re more of a tutorials person, then this:

Good luck! And don’t give up easily :wink:

9 Likes

Sorry to bump this topic, but it’s the most relevant for what I want to present.

There is a manual for Flash users (I was recently translating it to Polish version, so I read it very carefully :wink: ) and I thought about preparing the analogical manual for other game engines users. So, I started this document:

And I started with Unity specifically, because in the past I was using it the most, but it was a long time ago, I primarly used it for 2D and I never released any game with Unity, so I need your help with it.

I wrote a little bit about basic building blocks and some other stuff, but it needs a verification from someone with more experience :wink: If you have experience with some other engines and could write something like this for other engines, it would be a blast!

I believe, together we could write something like this! :wink:


Other related topics to link here:

5 Likes