Tutorial #1 - Setting up OpenSeed in your project.

in gamedev •  5 years ago  (edited)

Intro

This tutorial goes over how to start using OpenSeed in your next Godot based game project. The code is written in GDscript and is designed to remove as many hurtles as possible for the game developer. This tutorial wont go over any of the finer points of making a game in Godot, but the reader should be able to glean information on how certain things are done based on the info given here.

Prerequisites

  1. Godot: OpenSource Game engine we're using as a basis for development of OpenSeed
  2. Developer ID on OpenSeed*
  3. App ID on OpenSeed*
  4. STEEM Account to use as a master account (not your personal account)
  5. Private Posting Key of a STEEM account.

*At the time of writing there is no developer portal to create or manage your account. If you are planning on using OpenSeed for your game you will need to contact us on Discord by joining the OpenSeed Server.

Downloading OpenSeed

Before we begin you will need to get the latest version of OpenSeed from the git repository here. If you don't know how to use git don't worry, you can just download the zip file.

Once the source code has been downloaded and extracted (if you used the zip file) you're ready to start.


Step 1

Start by copying these files from the openseed-steem-godot folder to your game project's folder:

  • OpenSeed.gd
  • Login.gd
  • Login.tscn
  • NewAccount.tscn
  • NewAccount.gd

At the moment the scripts will look for each other in the root of the games directory (meaning the top most folder within the game project). If you would like to move the OpenSeed files to some place else you will need to update the gd scripts to point to the right place.

Step 2

You will need to fill in some of the variables in the OpenSeed.gd script to make sure everything is pointing to the right place. You should leave everything else alone within the script to ensure everything works.

Please change the following to match your needs:

var devId = ""
var appId = ""
var dev_steem = ""
var dev_postingkey =""

Once these variables are set the program will be able to connect to the OpenSeed Server, and will be able to post things on behalf of the developer. Of course these fields are considered sensitive information and should be removed before uploading the data to a network source such as github. When you export your game this data is stored in the game itself and not easily accessible by those looking for the information.

Step 3

Using the Scene Tree you can now drag and drop Login.tcsn and NewAccount.tcsn into your project. NewAccount is mostly self contained and will function as expected. The Login scene uses signals to tell the game or application if the login was successful and will need the app to do the appropriate actions to finish the login dialog.

Here is how Code Breakers implements these first steps within the main scene of the application.

var openseed = load("res://OpenSeed.gd")
var OpenSeed = openseed.new()

The above needs to be added to any script that you want to use the OpenSeed functions. This is useful if you want to create your own templates instead of using the ones provided.

func _ready():
OpenSeed.loadUserData()
if OpenSeed.token:
emit.signal("Login",1)
else:
$Login.show()

The above will check for the existence of a user account within the game and if none exists it will prompt the user to log in using their OpenSeed account. However, if it finds a user it sends the signal that the player is logged in and their data has been loaded.

func _on_login_login(status):
if status == 1:
$login.hide()

Finally you need to connect a signal from Login to the script you added the above code to. This will allow you to communicate back and forth to the Login dialog via signals. As you can see from the code once the signal has been received and the status is 1 the prompt closes.

Note: I was unable to get the code block to indent correctly. Follow the code layout in Godot as necessary

Next Up

In the next tutorial we will go over implementing a leader board so that players have bragging rights forever immortalized as long as the STEEM blockchain exists.


OpenSeed is being developed by @bflanagin for the steem community and indie game developers alike. The development of OpenSeed and any project developed by @v-entertainment or @bflanagin are community funded. If you would like to help with the development of OpenSeed please join the discord server to find out how you can help.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
Your post was upvoted by the @archdruid gaming curation team in partnership with @curie to support spreading the rewards to great content. Join the Archdruid Gaming Community at https://discord.gg/6yD2Emr. Good Game, Well Played!

This post was shared in the Curation Collective Discord community for curators, and upvoted and resteemed by the @c-squared community account after manual review.
@c-squared runs a community witness. Please consider using one of your witness votes on us here

Congratulations @openseed! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published your First Post
You got a First Vote
You received more than 10 upvotes. Your next target is to reach 50 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

@openseed, thank you for supporting @steemitboard as a witness.

Here is a small present to show our gratitude
Click on the badge to view your Board of Honor.

Once again, thanks for your support!

Do not miss the last post from @steemitboard:

The new SteemFest⁴ badge is ready