LÖVE
Follow these steps to quickly set up and start using Planetary Processing with your LÖVE game. For more detailed information on both the SDK and the server-side API, please visit our documentation.
LÖVE Version
The Planetary Processing SDK depends on https calls for securely encrypted authentication with our servers, as such we only support LÖVE version 12.
Currently LÖVE version 12 is in pre-release state and must be built from source or downloaded from the continuous integration on the LÖVE GitHub repo.
Create a Planetary Processing Game
Navigate to the games section of our web panel
Click Create Game in the top right
Provide the details of your game. Upon its creation, you will be taken to your Game Dashboard.
For this quick start, we will be using Anonymous Auth, which allows players to connect without a username and password. To enable this, navigate to the settings section of your Game Dashboard and enable Anonymous Auth as the Player Authentication Type within Game Settings.
Clone your Game Repository
Clone the git repository as listed in your game dashboard - this is your Planetary Processing backend code.
Setting Up Your LÖVE Project
Firstly you'll need to setup a new LÖVE project with at least a
main.lua
file, then you'll need to clone the Planetary Processing SDK. To do this you can clone it from our GitHub repository by running the following command from the same directory as yourmain.lua
:
Then from within your
main.lua
you can require the sdk with:
This creates the sdk object which can be used to interact with Planetary Processing.
Then you must, within
love.load
, callsdk.init(gameid, [username, password])
(username and password are not required in this example as we are using anonymous auth) as well assdk.join()
. You must also include a call tosdk.update()
withinlove.update
. So at a bare minimum yourmain.lua
should look like:
Now that you have completed these steps, SDK will keep an up-to-date snapshot of the entities visible to the connected player in
sdk.entities
.
Entities are stored as tables which follow the format in the LÖVE SDK documentation.
Try using the entities to draw something to the screen within
love.draw
, for example:
You can use
sdk.message(msg)
to send a message to the player entity on the backend, try it perhaps by sending a message to move the player.
Editing Your Backend Code
Using the repo we cloned earlier you can edit the behaviour of entities by changing their Lua file within the entity
directory.
You can also change how many and what entities are spawned in the init.lua
file.
We recommend experimenting here to get a sense of what you can do with Planetary Processing.
As a suggestion, you could change entity/player.lua
to take the message sent in the previous section to perform some action or move around!
Push Your Planetary Processing Backend Code to the Game Repository
After configuring your game entities and logic, push your changes to the game repository:
Deploy Latest Version in the Web UI
Go back to your game dashboard in our web panel
From the actions menu in the top right, select "Deploy Latest Version" - this will roll out your updated server-side code.
Start Game in the Web UI
Click "Start Game" to begin your server-side simulation.
Play Your Multiplayer Game!
Launch your LÖVE project.
Connect to the multiplayer game through the game client, authenticate, and enjoy playing with others!
Last updated