-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from prooheckcp/development
Version 0.1.0 [BETA]
- Loading branch information
Showing
27 changed files
with
456 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,45 @@ | ||
# RoQuest | ||
Generated by [Rojo](https://github.com/rojo-rbx/rojo) 6.2.0. | ||
![](./gh-assets/FullLogo.png) | ||
|
||
## Getting Started | ||
To build the place from scratch, use: | ||
RoQuest is a sophisticated abstract implementation of a Quest System. Although it can self manage nearly everything it also allows for the developer to manually set and manage everything | ||
|
||
![](./gh-assets/CollectExample.gif) | ||
![](./gh-assets/CollectCorn.gif) | ||
|
||
## 📦 Installing | ||
|
||
RoQuest can be installed in different ways, depending on your project's needs. Choose the method that suits you best: | ||
|
||
```bash | ||
rojo build -o "RoQuest.rbxlx" | ||
``` | ||
|
||
Next, open `RoQuest.rbxlx` in Roblox Studio and start the Rojo server: | ||
### 🐶 Wally | ||
<a href="https://wally.run/package/prooheckcp/RoQuest">Watch wally's page</a> | ||
|
||
```bash | ||
rojo serve | ||
``` | ||
roquest = "prooheckcp/roquest@>0.0.0, <10.0.0" | ||
``` | ||
|
||
|
||
### 🔨Studio | ||
<a href="https://create.roblox.com/store/asset/17475376719">Get the Roblox Model</a> | ||
|
||
|
||
### 🐙GitHub | ||
<a href="https://github.com/prooheckcp/RoQuest/releases">Download from Github Releases</a> | ||
|
||
|
||
# 📚Start Learning | ||
|
||
You can start learning in the docs page! https://prooheckcp.github.io/RoQuest/docs/intro | ||
|
||
## 📷Tutorial | ||
Coming soon! | ||
|
||
# ⭐ Contributing | ||
Please leave a star on [GitHub](https://github.com/prooheckcp/RoQuest), it helps a lot! | ||
|
||
Pull requests are welcome. For major changes, please open an issue first | ||
to discuss what you would like to change. | ||
|
||
Please make sure to update tests as appropriate. | ||
|
||
For more help, check out [the Rojo documentation](https://rojo.space/docs). | ||
# 📄 License | ||
[MIT](https://choosealicense.com/licenses/mit/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
--- | ||
sidebar_position: 2 | ||
sidebar_label: "♻️ Creating LifeCycle" | ||
--- | ||
|
||
# ♻️ Creating LifeCycle | ||
|
||
## 🪜 Create Stairs | ||
|
||
Now that we have a base understanding of a lifecycle let's take a look at it in action! | ||
|
||
For this example we'll make an object that is too high for the player to collect! However whenever the player accepts the quest stairs spawn in! These stairs will allow the player to climb up and get the object! | ||
|
||
Remember the apple quest from the earlier sections? We'll be using that for this one too! Let's start by creating a platform and some stairs... | ||
|
||
![](StairsAndHill.png) | ||
|
||
Make sure to keep the stairs as their own model! | ||
|
||
## 📂 Create Folder Structure | ||
|
||
For me this is one of the most important steps to take into account! We want to make sure that we have a good place to store our lifeCycles. The following example is my personal recommendation but feel free to store lifecycles as you please! | ||
|
||
![](LifeCyclesStructure.png) | ||
|
||
## 💖 Create LifeCycle | ||
|
||
Now let's make the lifecycle! Since we only want to display the stairs for 1 player we'll create this lifecycle on the client folder! Here's an example: | ||
|
||
```lua | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local RoQuest = require(ReplicatedStorage.RoQuest).Client | ||
|
||
local QuestLifeCycle = RoQuest.QuestLifeCycle { | ||
Name = "AppleLifeCycle" -- Important unique identifier | ||
} | ||
|
||
function QuestLifeCycle:OnInit() -- Called when the player joins | ||
self.stairs = workspace.Stairs | ||
self.stairs.Parent = ReplicatedStorage | ||
end | ||
|
||
function QuestLifeCycle:OnStart() | ||
self.stairs.Parent = workspace | ||
end | ||
|
||
function QuestLifeCycle:OnDeliver() | ||
self.stairs.Parent = ReplicatedStorage | ||
end | ||
|
||
return QuestLifeCycle | ||
``` | ||
|
||
## 🔧 Setup Lifecycle | ||
|
||
Now that we created our lifecycle we need to connect it to the quest we wish | ||
|
||
```lua | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local RoQuest = require(ReplicatedStorage.RoQuest).Server | ||
local appleObjective = require(ReplicatedStorage.QuestObjectives.AppleInfo) | ||
|
||
local Quest = RoQuest.Quest | ||
|
||
return Quest { | ||
Name = "Collect Apples", | ||
Description = "Collect 2 apples", | ||
QuestId = "AppleCollection", | ||
LifeCycles = {"AppleQuest"}, -- The lifecycles that will manage this quest's behavior | ||
QuestObjectives = { | ||
appleObjective:NewObjective(2) | ||
}, | ||
} | ||
``` | ||
|
||
## ⌛ Load LifeCycles | ||
|
||
:::info | ||
|
||
Please remember that lifecycles need to be loaded in **both** the client and server | ||
|
||
::: | ||
|
||
```lua | ||
-- Server | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
local DataStoreService = game:GetService("DataStoreService") | ||
local Players = game:GetService("Players") | ||
|
||
local RoQuest = require(ReplicatedStorage.RoQuest).Server | ||
|
||
local questsStore = DataStoreService:GetDataStore("PlayerQuests") | ||
|
||
RoQuest:Init(RoQuest:LoadDirectory(ReplicatedStorage.Quests), RoQuest:LoadDirectory(ReplicatedStorage.LifeCycles.Server)) | ||
``` | ||
|
||
```lua | ||
-- Client | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local RoQuest = require(ReplicatedStorage.RoQuest).Client | ||
|
||
RoQuest:Init(RoQuest:LoadDirectory(ReplicatedStorage.LifeCycles.Client)) | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
sidebar_position: 1 | ||
sidebar_label: "🤔 What is a lifecycle?" | ||
--- | ||
|
||
# 🤔 What is a lifecycle? | ||
|
||
LifeCycles are a feature that I've been a huge fan ever since I started developing libraries. Although it is something simple, it is also something incredibly powerful to create fragmented reusable code. | ||
|
||
But before we jump into making our own lifecycle first we need to understand what it is. Imagine a lifecycle as the behavior of a quest. With this you can determine how a quest behaves when you start it, progress on it, complete it, cancel it, deliver it and so on! In short you can see the Quest as the data and the lifecycle as the behavior of said data! | ||
|
||
![](QuestLifecycle.png) | ||
|
||
:::info | ||
If a player rejoins the game and reloads his data, it will **only** call the lifecycle part where the player was left on. | ||
So if the player already completed the quest but didn't deliver it, when he rejoins it will only call the OnComplete function | ||
::: | ||
|
||
## Client Vs Server | ||
|
||
LifeCycles can both run on the server and or client. This all depends on how the developer injects the lifeCycles into their RoQuest! I'll be showing some examples on the following section for lifeCycles. |
Oops, something went wrong.