VS Code - Defold Buddy (extension with productivity tools)

Defold Buddy

Tools for Defold to make your life easier and coding experience nicer. The main focus of the Buddy is to automate repetitive boring tasks.

Features

  • IntelliSense for Defold API and project dependencies
  • Autocompletion for Defold URLs of your project
  • Asset Portal
  • Open Defold Editor from VS Code
  • Build (run) your game via Defold Editor from VS Code
  • Fetch libraries via Defold Editor from VS Code
  • Hot reloading for script and lua files on save
  • Create a complex Game Object file from Explorer context menu
  • Generate manifest (reduce game bundle size)

IntelliSense for Defold API and project dependencies

GitHub release

Demo (Defold API)...

  1. Open a Defold project
  2. You should see a prompt to initialize the extension

or

  1. Press Ctrl+Shift+P (or Cmd+Shift+P) or go to View > Command Palette.
  2. Select Defold Buddy: Initialize

Demo (project dependencies)...

Autocompletion for Defold URLs

Demo...

Note: read about the addressing if you are not familiar with the concept

Known issues

For now the suggestions are not refreshed automatically when you make any changes to your .go and .collection files. For now you need to re-index them manually by runnin a command.

  1. Open a .script file, you should see suggestions after typing a ", or pushing Ctrl+Enter with cursor next to a ".
  2. Run “Defold Buddy: Index game files for autocompletion” when you need to refresh the autocompletion

Asset Portal

Demo...

  1. Press Ctrl+Shift+P (or Cmd+Shift+P) or go to View > Command Palette.
  2. Select Defold Buddy: Asset Portal

Build (run) your game via Defold Editor from VSCode

Demo...

Note: requires Defold editor running in the background

Note: you can set a hotkey for this command as well as for any other command

Hot reloading for script and lua files on save

After a .script or .lua file is saved it is automatically hot-reloaded if the game is running.

Demo...

Note: read about hot reloading in Defold

  1. Open Defold editor
  2. Run your game via the editor
  3. Modify a .script file and save it, the modified file should be hot-reloaded

Create a complex Game Object file from Explorer context menu

Create a Game Object file (.go) with components (sprite, script) and a factory file (.factory) for that Game Object with less clicks

Demo...

Generate manifest (reduce game bundle size)

Demo...

You can generate the app manifest from Defold editor:

fc6f5813cdea82f6a8f264f7634f3b28855e6a3f_2_408x429

Or from VSCode:


Feedback :heart:

If you would like to collaborate, contribute or request a feature feel free to do it at Github

Credit

Manifest generation code was copy pasted from Defold App Manifest generator by britzl.

Resources

Annotations used in this extensions are generated with Defold Lua Annotations.

17 Likes

It would be great to add debugging. I read that mobdebug is used in the Editor and there is a VS Code extension for it. If anyone knows and can explain how to use it with Defold then it should be possible to add debug settings into one of the above extensions.

And it would be even better to start the project directly in Editor from VSCode (not via Bob because it didn’t work for me when I tried it in one of the existing extensions).

2 Likes

This is something we will look into. I can’t say when though. We have a few performance related tasks that we are currently focusing on.

I need to look up the details. I’ll share here later today.

3 Likes

Wow! Thank you @mikatuo ! :heart:

Btw. Is there any request for something like this:

to implement e.g. in game.project settings? That would be a great feature! I know Defold App Manifest generator, but if it would be a part of Editor it would be a blast!

3 Likes

The long term plan is for us to have it configurable in the editor yes (with more features), but for now the online tool is doing the job well enough.

3 Likes

Thank you! No rush. Once it’s ready I will add it into the extension.

Online manifest generator is great! Since it’s JavaScript it was super easy to add it.

It is part of the editor now? @vlaaad added support for it a few months ago:

12 Likes

Yes, I totally missed it!

6 Likes

Indeed, I ported manifestation web tool into the editor :slight_smile:

21 Likes

That is fantastic!

Experimenting with more interesting stuff. Generating hashes for instances and components for all .collection files. It doesn’t include components for referenced instances yet.

Demo

5 Likes

v.0.6.2 - Added autocompletion for url-s inside .script files:

Demo

9 Likes

The debugger is started by the editor when start.lua script is loaded and run in the engine. The script is sent as a RunScript protobuf message to the running engine to the /post endpoint on the engine service.

2 Likes

Thank you! And this readme DEBUG_PORTS_AND_SERVICES.md also helped a lot.

Can’t get it to work yet, but at least it doesn’t crash when I post a reload message. Will need to dig more into it.
image

Let us know if you get stuck!

1 Like

v 0.7.2 - Create .go + .script + .factory files from the Explorer’s context menu

Demo

6 Likes

Added intellisense for project dependencies.

Demo

9 Likes

Great feature!
I found in some extensions, when calling a function, “:” is used instead of “.” , like “room:send()”, but the intellisense always uses “.” :
image
image

1 Like

Nice that you are using the plugin))
I can have a look. What was the extension? It might be that EmmyLua annotations are required to correctly identify “:” vs “.”

The extension is Colyseus-Defold and the annotations are written by myself. :grinning:
image

3 Likes