A Simple 2D RPG (Role Playing Game) that combines various game systems.
- Game-Systems-Integration
- Table of Contents
- How to use this project
- Important code helpers being used in this project
- Local Webserver Setup
- Creating a Docker container
- Logging into the Docker container
- Stopping the Docker container
- Deleting the Docker container
- Starts the Docker container
- Setting up the server instance
- Starting the apache service
- Moving files to the hosting directory
- Cloud Webserver Setup
- Obtaining a Domain
- Cloudflare for DNS and HTTPS
- Hosting from home server
- Hosting from AWS
- Hosting
- Frequently Asked Questions
- How to set up a Script Template
If you want to download this project in order to extend/modify it yourself or if you would like to create a build for an OS other than Windows, follow these instructions:
- Clone or download this project using the green icon near the top of this page.
- Unzip the project files if downloaded.
- Open the project in Unity using the Unity Hub.
- On Unity Hub, select Projects.
- Then select Add.
- On the file explorer, find the project you cloned or downloaded then click Select Folder.
- On Unity Hub, double click on this project's name in the Projects section.
- Once the project is open, expand the scenes folder and open the Default scene.
- Clean Settings UI - by Landan Lloyd
- Dotween - by Demigiant
- Editor Toolbox - by Arimger
- JSON Object - by Defective Studios
- Naughty Attributes - by dbrizov
- CharacterController2D - by prime31
- SerializableDictionary - by Rotary Heart
- StandaloneFileBrowser - by gkngkc
- Lean Touch - by Carlos Wilkes
- Lean GUI - by Carlos Wilkes
- Lean Pool - by Carlos Wilkes
-
Creates a Docker container, then maps port 80 in the container to port 80 on the host, then maps port 443 in the container to port 443 on the host, then names the container 'webserver', then mounts the folder as '/data', and uses a Ubuntu image.
docker run -dit -p 80:80 -p 443:443 --name webserver -v C:/Users/h1ddengames/Desktop/Items/Builds/WebGL:/data ubuntu
-
Logs into the container using /bin/bash shell
docker exec -it webserver /bin/bash
-
Stops the docker container but does not delete it. Can be restarted at a later time.
docker stop webserver
-
Deletes the Docker container and all the data stored within.
docker rm webserver
-
Starts the docker container
docker start webserver
-
Updates the package list, then upgrades all currently installed software, and finally installs apache2
apt update -y && apt upgrade -y && apt install apache2 -y
-
Starts the apache service.
service apache2 start
-
Copies recursively and asks if files should be overwritten if the names are the same.
cp -ir /data/* /var/www/html/
- Go to Namecheap.
- Create or login to an account.
- Add two factor authentication.
- Search for a domain name.
- Add the domain to cart.
- During checkout make sure that WhoisGuard is enabled.
- Give a false address/phone number just in case.
- Finish payment and checkout.
- Go to Cloudflare.
- Create or login to an account.
- Add your new Domain.
- Take the nameservers given and go to Namecheap.
- Login to Namecheap then go to your domain.
- Change the DNS nameservers to the nameservers given by Cloudflare.
- Wait for about 1-2 hours for the nameservers to update.
- Go back to Cloudflare and refresh the page.
- Click on DNS then update the ip address to your home public ip.
- Click on SSL/TLS then select Flexible.
- Click on Edge Certificates then turn on 'Always Use HTTPS'
- Open Windows Firewall.
- Click on Advanced Settings.
- Click on Inbound Rules.
- Click on New Rule.
- Click on Port then Next.
- Click on TCP and Specific local ports, then enter '80, 443' without the '', finally Next.
- Click on Allow the connection then Next.
- Enable for Domain, Private, and Public then Next.
- Give a name such as 'Webserver' then Finish.
- Open command prompt and type 'ipconfig' without the ''.
- Take note of the default gateway and the host computer's ip address.
- Go to 192.168.0.1 or your default gateway.
- Login to the gateway.
- Go to the Port Forwarding Settings.
- Enter a new rule for forwarding port 80 to port 80 for your host ip address.
- Enter a new rule for forwarding port 443 to port 443 for your host ip address.
- Save settings and exit the gateway interface.
- Create an AWS account.
- Add two factor authentication.
- Login and go to the dashboard.
- Type EC2 then go to the EC2 dashboard.
- Click Launch Instance.
- Create a Ubuntu 18.04 Image.
- Add the default security group and add port 22, 80, and 443 to the inbound rules.
- Finish the setup to start the instance. During the setup create a new keypair and save it to a safe place.
- Once the instance is started, copy the entry on the dashboard for the public dns (IPv4) column.
- Open a command prompt and run the command listed as "Command to SSH into the AWS server"
- Follow steps from the title "Setting up the server instance"
- Follow steps from the title "Starting the apache service"
- Use SCP to move files from you machine to the EC2 instance by running the command listed as "Command to send files from local machine to AWS server"
- Follow the steps from the title "Moving files to the hosting directory"
- Update Cloudflare with the ip address found in the EC2 dashboard under the column IPv4 Public IP.
-
Command to SSH into the AWS server.
ssh -i webserver.pem [email protected]
(Replace the contents of everything past the @ sign with the entry from step 9.)
-
Command to send files from local machine to AWS server.
scp -i webserver.pem -r C:\Users\h1ddengames\projectDirectory [email protected]:~/data
- In order to create a custom script template go to the following location: C:\Program Files\Unity\Hub\Editor\2019.3.0b11\Editor\Data\Resources\ScriptTemplates
- Open the file 81-C# Script-NewBehaviourScript.cs.txt
- Replace the contents with the script template you'd like to use.
- Here is the script template I use:
// Created by h1ddengames
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using SFB;
using NaughtyAttributes;
using RotaryHeart.Lib.SerializableDictionary;
namespace h1ddengames {
public class #SCRIPTNAME# : MonoBehaviour {
#region Exposed Fields
#endregion
#region Private Fields
#endregion
#region Getters/Setters/Constructors
#endregion
#region My Methods
#endregion
#region Unity Methods
void OnEnable() {
#NOTRIM#
}
void Start() {
#NOTRIM#
}
void Update() {
#NOTRIM#
}
void OnDisable() {
#NOTRIM#
}
#endregion
#region Helper Methods
#endregion
}
}