Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

MetaFab at Godot

A topic by DevTurbinh created Dec 23, 2022 Views: 208 Replies: 2
Viewing posts 1 to 2

Hello, i make games on Godot and i would like to know how to use the MetaFab plugin on Godot, could you help me?

Submitted (5 edits)

The UI Example that goes with it is set up so that you can follow along with the official getting started guide. (see links below)

In short, you register your development account on Metafab to get your API credentials and then follow along to create players, currencies, items, shops, and so on.

To get the addon into your Godot project just drop the ‘addons/metafab-api’ folder into the root folder of your project. Enable it in the project settings and then reload the project to make sure it sets up the global variable needed to start using the API in other scripts.

Basic usage example that gets all registered players (admin only)

func _on_action_request():
  var res = MetaFab.get_players(self, "_on_action_request_result", secret_key_string)
  # Error can happen if servers are down or the device is not connected
  if res != MetaFabRequest.Ok: print("[%s] Error: %s" % [name, res])

func _on_action_request_result(code: int, result: String):
  var json = JSON.parse(result)
  # Anything but 200 means something went wrong on the server
  if code == 200: print("[%s] Result: %s" % [name, json.result])
  else: print("[%s] Code: %s / Error: %s" % [name, code, json.result])

Sadly I do not have time to set up a full tutorial/guide before the jam starts. But feel free to ask if it is not clear and let me know if you run into issues.

Links:

(+1)

Thank you very much, but I ended up giving up on this game jam, because it's too complicated. Good luck!