Using URL hyperlinks to specific game matches?

I’m making a browser-based game in defold, for now it’s just tic-tac-toe.
I want to make a feature that lets you share a URL, such as through discord, twitter, etc to post a match so others can watch the replay or spectate it live etc.

For example if the game is normally playable at www.mygame.com, a URL might look like:
www.mygame.com/matchid?=1234

Is there a way to make this type of URL ‘talk’ to a Defold game so that Defold can navigate the game to that specific match, in other words a match with the ID of “1234”?

On mobile, what you are talking is called Universal Link.
For Defold, unfortunately there’s no current supporting extension for that but you can use extension-iac
The idea here is from your webpage you can redirect to your app uri such as yourappscheme://match/123

If your game is just a HTML5 game so it’s must easier when you can use html5.run(...) in lua scripts to get the query value from current browser url

1 Like

Thank you!

You can look at example with HTML5 params here:

Get query params: https://github.com/Insality/druid/blob/master/example/example.gui_script#L223
Set query params: https://github.com/Insality/druid/blob/master/example/example.gui_script#L28

3 Likes