Porting Android Game To Defold

Hello @ developers,

This is Onur Yavuz Meral , from Turkey. I am an Architect, started game development last 3-4 years , since some game engines are free to use. Published 3-5 games on android. I decide to update one of them named Crow and since i learned more on programming i want a clean coded, well optimized, content rich update.
Long story short is i need to decrease size of my low games , increase performance and take control of engine. Defold fits my needs i think we will see.

Here is the game link.

A screenshot from game.

Entry 1 Rendering

Needs :

  • Need a orthographic camera that follows character , zooms in-out according to the states,action zones , fits all kind of screens.
    Solution :
    I start working with 1600 x 1000 resolution because my assets designed for it.

After that i build my render script top of it. I will not or could not explain render script deeply, don’t want to misguide new comers.But there is this source and this source mostly explain how to handle multi resolution .

Good thing is you don’t need to configure the orthographic camera, you just tell render script that i have the control with this message, render script handles the rest ;

msg.post(".", "acquire_camera_focus")

And send zoom information that i defined on render script.

msg.post("@render:", "change_zoom", {zoom =zoomFactor} )

You can take a look to scripts, but i am not a lua expert (using about 1 week).
render.script (2.9 KB), mainCamera.script (1.3 KB)

  • 2560 x 1440 screen
  • 1024 x 768 screen

Now its up and running.
Screenshot from 1366x768 (~1.77) screen. Trick is my camera follows player and background is larger than view frame, larger enough to cover all aspect ratios. Also dark art style and black clear color hides artifacts well.
EDIT : Defold handles GUI render stuff , i just designed for original resolution, and set anchors.

  • Post camera effects from a image editing software, but i will find the way with defold.

  • Sorry for bad loop, will edit later.

EDIT : Changed render script. Because , i tested high resolution devices(higher than 1600x1000), it fails with old script, now it handles. Screen shots added for this.
Best Regards,

11 Likes

Heyyy! it looks pretty nice and promising~
It has a “limbo” (the game) look, i like it ^^ i love black and white stuff, what kind of soundtrack are you going with!?

also~
tip:
export your effect as a image, a PNG with transparency for example~
then create a GUI element, finally, add a box to this GUI, import the your effect texture, and set the box’s texture to it~

as for the zoom part, use a camera, and change the z values as you need into a script using messages or something~
(not sure if it will work, but seems worth a try!)

AND BAM! YOU HAVE YOUR EFFECT :smiley:
love your project! :smiley:

1 Like

Hey Onur, as I already said: veery polished game. Keep us up-to-date on this one!

1 Like

Hello @ developers,

First of all @KitStainedHeart , thank you , about your tip : from my experiences about overdraw, i may not use that technique, i will find a way apply image effect directly to the buffer. We will see.
Thank you @jack0088.

Entry 2 Player Control and Environment

I recreate character for this update. Thanks to defold , spine > defold pipeline is very useful.

  • I divided Crow into several part to animate.

  • Wings uses flip-book animation separately from other body parts.
  • Spine screenshot. Parts animated with spine. Will add more animations since workflow is very easy and fast.
    ** Tip , After you export your animation from spine to defold, check your animations if they are ok, if you experience some weird rotation behaviors its because when you rotate 0 to -10 it writes 350 degrees to json file . you can tweak this values with any text editor, just find and replace this values.

  • Character setup. Character uses dynamic collision because character is controlled by forces.

After make character setup i implement a simple finite state machine to control player animations.
This is where i find simple finite state machine for defold . ( actually its not for defold, just helping the robots.) It’s very well commented code. Just copy to your project folder and go. Here is Player.script (4.3 KB).

Here is screen cast from game
. Which gives info about environment.

Best Regards,

6 Likes

Hey, that a nice looking game. Also it will be very interesting to learn about performance improvements with Defold for you.

2 Likes

Hello @ developers,

@Oleg_The_Evangelist thank you.

Entry 3 Some Performance Comparison

I started July 20 , now its August 4. What did i do in this 2 weeks :

  • Learned Lua scripting ,
  • Learned Defold editor ,
  • 75 hand crafted sprites, didn’t used any asset from older build.
  • Learned spine , make character animations , implement to defold
  • Core game play and in-game GUI is implemented, i am just populating the collections now.
  • Prepare Dev diary.

Performance factor 1 : Time to adapt this engine is very low and straight forward. This is very important. I didn’t need 456345734572 hours of tutorial sessions.

Performance factor 2 : Apk size. I just prepared a scene in unity with few of my new defold assets. As you can see in the image, there is 8.5mb difference(maybe more because unity just have few assets to fill screen.) ( Both build production and Armv7 only.)

Performance factor 3 : Draw Calls. 14 - 9 , both has same setup (2 sprite atlas, 1 GUI mask etc.) Same again i didn’t do any special effort to gain 5 draw calls.

Performance factor 4 : Testing over WiFi . Again lots of wasted time gained back.

Best Regards, :v:

10 Likes

It’s crazy how much you’ve learned in so little time. I’m still proud of writing around 140 lines of code on 4 days… good work!

4 Likes

Thank you @88.josh ,

Yeah it was crazy, i did not see a straight information flow before. This whole website , dedicated engine developers, community …

Best Regards,

2 Likes