Word game in Defold

Hey there!

Been a while since I posted here. Last time I was considering using Defold for my projects (I have 3). I finally settled on one and I am currently working on it.

It’s a word game. I didn’t touch Defold just yet: I am primarily coding the “backend”, that is, the dictionary (close to 200k words!) and all requests to its data structure to make them optimal. I am not decided on the platforms I plan on releasing the game on. I know PC is one. I wonder how mobile would fare against my data structure. I measured things and the dictionary takes about 11.5MB in memory according to Lua and loads in 0.22 seconds (EDIT: not using LuaJit here) on my PC (i7 6700k with 32GB RAM). The dictionary consists of words of course (1.5MB in memory) and a hash table which occupies the rest (10MB approx.). The file sizes for these two parts are 1.5MB for the words and about 950KB for the hash table.

I am not so much worried about performance with respect to speed as the data structure is well optimized. But I wonder how long it would take on an average phone (say 6GB RAM) and average mobile SOC to load and organize the data in memory. This is why my next step is to finally setup a project in Defold :muscle: and do two builds: PC and mobile, and do some profiling on mobile just to help me see if my project is feasible on that platform.

So… after this long intro :slight_smile: I have some questions!

1- I am faced with the deadly blank page syndrome each time I open Defold :sweat_smile: : it’s the first time I use an engine. My question is: in Defold, suppose I have this object called “Game Manager” for lack of a better word (in reality it will be made of several parts such as the dictionary, AI, game logic, etc…), how do I code it in Defold? As script (s?) in a game object? Technically it’s not a game object since it doesn’t have a position, scale nor rotation for example…

2- How easy is it to profile stuff on an actual Android phone and is working with physical hardware easy in Defold? I have not checked the doc very much mind you. But if you could give me some pointers that’d be great!

Thanks!

If I’m satisfied with the results of the tests, I might (probably will in fact) add mobile too!

#1 - Make a goal out of one essential thing that your game will need, and make a project of that. Maybe programming part of the word game, but drawing from a temporary fixed table that doesn’t try to draw from your dictionary of words yet.

1 Like

Yeah that’s a reasonable first step! In reality, the tests I want to do are loading the structure in memory as well as try out some requests. But yes creating some “empty shell” app will help me a lot.

Thanks!

If you want to have Lua code in your game you need to start from a script. And that script has to be attached to a game object. It doesn’t matter what kind of logic you need in the script and it doesn’t matter if you care about a position, rotation and scale of the game object, you still need this setup.

It might make sense to put some code in a Lua module instead of in a script, but in order to use the code in the Lua module you still need to require it from a script component.

1 Like

Hi! Yes that’s kind of what I understood but wasn’t sure about. I will leave my code in modules but require them in a script as opposed to having all my code into one large script. I will have a game object for the dictionary and code a few custom messages so that I can address my needs.

Thanks for your help!

1 Like