Defold headless application for server

Hi! I do not have any issues or problems currently, just want to understand if it is possible to build, because my knowledge of defold using as server is very low.
I know that it is possible to build application with Headless version, which allows to run app as game server.
Is there any guides/manuals/best practices how to do it?
What about scalability? Can I use it, for example with AWS Serverless? As this basically will solve the problem with scalability.
Basically in general would be great if someone would share some information about this topic.

1 Like

We do not have any guides I’m afraid since it is a pretty uncommon scenario, BUT it is definitely possible. Defold has a fairly conservative resource usage, especially in headless mode with no rendering, so it shouldn’t be very taxing to a server to run multiple instances of the engine.

One thing to consider is how clients will connect to your server. Defold has good support for sending HTTP requests and the client side of TCP/UDP/WebSockets. There are fewer resources to build from when you want Defold to act as an HTTP or socket server.

My recommendation would be to look into AWS GameLift as that can be used to scale up instances when needed: https://aws.amazon.com/gamelift/

We have a Defold extension for GameLift: https://github.com/defold/extension-gamelift (It may need to be updated to a newer version of GameLift).

2 Likes

I guess I lied, when said that there is no issue for me. I just tried to build headless app for linux:

And got issue:

What if you start the the Defold editor from a terminal and then try to bundle? Any hints in the output in the terminal?

I’ve created headless Linux bundles for projects with and without native extensions without problems.

Which extension did you try with? GameLift?

1 Like

Started from terminal and got logs:

2020-10-27 22:59:15.562 93151 [JavaFX Application Thread] ERROR editor.error-reporting - {:line 110}
java.lang.NullPointerException: null
	at com.dynamo.bob.util.SpineSceneUtil.loadSkin(SpineSceneUtil.java:748)
	at com.dynamo.bob.util.SpineSceneUtil.loadJson(SpineSceneUtil.java:905)
	at com.dynamo.bob.pipeline.SpineSceneBuilder.build(SpineSceneBuilder.java:396)
	at com.dynamo.bob.Project.runTasks(Project.java:1006)
	at com.dynamo.bob.Project.doBuild(Project.java:807)
	at com.dynamo.bob.Project.build(Project.java:442)
	at editor.pipeline.bob$run_commands_BANG_$fn__37230.invoke(bob.clj:99)
	at editor.pipeline.bob$run_commands_BANG_.invokeStatic(bob.clj:98)
	at editor.pipeline.bob$bob_build_BANG_.invokeStatic(bob.clj:140)
	at editor.disk$async_bob_build_BANG_$fn__38253$fn__38256$fn__38257.invoke(disk.clj:217)
	at clojure.core$binding_conveyor_fn$fn__5739.invoke(core.clj:2030)
	at clojure.lang.AFn.call(AFn.java:18)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

Have not included any extension for server. As I understand there is something wrong with spinescene, should not it be skipped using headless version?

Yes it looks like a spine related problem.

No, the headless version includes the same resources as a debug or release build. The difference is that the engine doesn’t set up a “window” and will do no rendering (the render script will run but nothing will be drawn).

Try exporting with Spine version 3.7.94. You might have exported with a newer version or used a feature that’s not fully supported (though still works in builds ran directly from the editor since that may be different code).

Check this post too

3 Likes

Wow, I have recreated spine animation with version you suggested and it worked!
Do not know how much time I would spend searching for a fix, thanks!

4 Likes