Archive for September, 2020

Partial roundrobin progress

September 20, 2020

Today I made a small bit of progress in generalising the signalling server logic to support round robin selection when the host of a lobby disconnects.

Tomorrow hopefully I’ll be able to tie this piece of work off.

Linked the signalling server to the book-keeper

September 19, 2020

Today I:

  • created a new route “lobbies” on the book-keeper, a new controller (the lobby_controller) and a new Lobby table.
  • installed axios on the signalling server, and posted to the book-keeper on the lobby route if a new room is created therein, or if a room is to be destroyed
  • added the BOOKKEEPER_URL as a config variable to the configuration of the node.js heroku app (to point to my rails heroku app).
  • I also redeployed the node.js and rails heroku apps, and heroku run rake db:migrate on the rails app in particular.

Initial testing on localhost indicates that it works like a charm, with the book-keeper state being tidied up with manual disconnect in game, and also when just exiting from the game entirely:

Next steps would involve potentially

  • introducing lobby handover if the host disconnects
  • allowing lobby names to be chosen by the host rather than randomly generated (this should be straightforward to do)

Then, after this has been done, I would like to transfer this general pattern to the dndsandbox client, and then (finally!) start looking at writing code in the Godot engine again in terms of presenting the lobbies in the UI, selecting one, joining, and then making sure that the client networking logic is working properly. It has been a while, so I have a feeling that I might be slightly rusty.

Linking the signalling server and book-keeper

September 18, 2020

In order to link the signalling server and the book-keeper, I believe I will want to make an axios request to the book-keeper from the joinLobby / createLobby function in the signalling server, here, with a payload of the form { lobbyId, peerId }. On the book-keeper I can then record the current active lobbies and their respective peers.

Since it has been some time since I looked at the book-keeper, it is possible that it might be wise to alter the way I structure the endpoints / present the data. I don’t think that graphql is necessary for my purposes though, that might be too much complexity. Nonetheless potentially I might want to massage the data structure / schema a bit in order to suit the new direction of this project.

Another tutorial on multiplayer in Godot

September 17, 2020

I discovered this today; a tutorial on making a client / server game in Godot. Maybe this information isn’t necessary for progress, but I think it might be worth skimming at some point.

Roaming around for in game level editor tutorials

September 16, 2020

Today I found this in game level editor tutorial by Martin Senges. He also appears to have many other interesting tutorials on his youtube channel. (I feel that continued investigation here is warranted, particularly as I am starting to narrow in on laying the foundation of networking for the sandbox project.)

Of course, Rungeon is probably also worth checking out on youtube for the basics with respect to tilemaps, as opposed to gridmaps.

Demo project working across different computers

September 15, 2020

Today I managed to get the demo project for webrtc signalling working across different computers.

To do this, I needed to download the webrtc files for linux and windows, and place them in the relevant directory structure: https://github.com/Faless/webrtc-native-demo/releases/tag/0.3. After that, I was able to build both for mac and for windows without the error: export templates appear to be missing or invalid which is a bit misleading, to say the least!

After doing that, I was able to compile to an OSX target, and also separately compile to a windows target. For the windows target, four files were generated, two of which were dlls. For various reasons, sending by email is verboten with dlls so I had to transfer via USB.

Then I ran each client on the two different machines (laptop on OSX, tower on Windows 10) and they were both able to communicate via the signalling server perfectly. This is fantastic, because it means that I now have a foundation on which to transfer some relevant code paths to the sandbox godot game.

My next goal will be to see if I can hook up the sandbox to the node.js server on heroku, and also see separately if I can transfer information from said server (or a separate one) to the book-keeper, in order to keep track of current ‘rooms’ on the signalling server, and thereby elect whether to join or leave such via presently said information as output from the book-keeper api.

WebRTC more remembering, + demo working

September 14, 2020

I remember now what I think I was missing. It turns out that one needs to follow the instructions at https://github.com/godotengine/webrtc-native in order to build a dll to run webrtc on a native plugin (that is not html5) in order for a Godot game to support webrtc properly. And I remember that I had a bit of a saga in compiling webrtc for osx (linux and windows are better supported).

Nonetheless, I did succeed back in the murky days of June 2020, and I was able to find where I put those files.

After adding said information to the Godot example from https://github.com/godotengine/godot-demo-projects/tree/master/networking/webrtc_signaling, as well as pulling 3.2 again from godot and rebuilding, because whyever not?, everything worked perfectly.

A next step will be to build the game and try to run it on several different systems, and see if the functionality still works.

After that, further steps will be to start porting some of this pattern to the sandbox game I was prototyping earlier.

Dropshipping for fun and profit

September 13, 2020

Today I was skimming through my emails, and came across this gem from Shopify. Dropshipping apparently is a thing that you can do with Shopify, but not only their platform – WooCommerce as well. So it might be worthwhile investigating the potential for creating a separate VM to run a WooCommerce shop for a particular product niche and explore whether that is a worthwhile business proposition to invest time setting up.

Fixed issue with herokuapp, reviewing webrtc plugin

September 12, 2020

Today I took this demo for a spin using this server deployed on heroku. I did need to alter this line to const PORT = process.env.PORT || 9080; due to the way that heroku assigns ports to node processes, and also change the label on the host in the client_ui scene to ws://<herokuappdeploymenturl> in order for it to work. But it does sort of work, yes. Tailing the logs on the heroku app reveals multiple lobbies being created, and if I join an existing lobby with a different peer I see that there are multiple peers in said lobby.

However, this line doesn’t seem to return anything when multiple peers are connected to a given lobby, which is puzzling.

I think the next step is to try to bake in the latest webrtc plugin for godot in osx again, and see if things are a bit more up to date / the get_peers thing works in the latest version. Certainly the WebRTCMultiplayer documentation indicates that it should work.

Deployed node.js app to heroku

September 11, 2020

Today, following on from yesterday, I deployed the server_node app to heroku.

Basically, I just copied the code from here to a new repo, then

git init
git add .
git commit -m "initial commit"
heroku login
heroku create
heroku git:remote -a <app_name>
git push heroku master

Next steps will be:

  • to take the basic app for a spin and see if it works on os x in two separate clients on a single machine, running on Godot compiled with the webrtc module from source and then
  • to do the same thing, but with two separate computers, running separate clients