Difference between revisions of "LevelEditor"

From Project Wiki
Jump to navigation Jump to search
(Created page with "===Idea=== ''What is my general idea for the feature? ("Tldr!")'' *Have an easily usable template for Xp-cards *Hav an example Xp-card regarding structure and content *XP-Card...")
 
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
===Idea===
+
[[Category:Feature]]
''What is my general idea for the feature? ("Tldr!")''
+
[[File:LayoutLevelEdit.png|thumb|751x751px]]
*Have an easily usable template for Xp-cards
 
*Hav an example Xp-card regarding structure and content
 
*XP-Cards should be formatted in a way that information can be found quickly and efficiently
 
===Intention / Requirements:===
 
''What am I trying to achieve with the idea and what are my constraints?''
 
*Designers should be able to check their xp-cards by themselves
 
*Reduce workload from the lead and give more autonomy to the designers
 
===Refrences===
 
''The Refereces (if available).''
 
{| class="wikitable"
 
|'''Game'''
 
|'''Mechanic'''
 
|'''Descriptions'''
 
|-
 
|EXAMPLE GAME
 
|Example Mechanic from that game with link
 
|What Part do I reference from the mechanic in the referenced game
 
|-
 
|
 
|
 
|
 
|}
 
===Design===
 
''What is my specific design for the feature?''
 
====First:====
 
*The idea behind the feature
 
*Intention and Requirements of the feature
 
*Context needed to understand the design
 
====Second:====
 
*Necessary References
 
*The feature design
 
*Feedback needed for the design to work
 
====Finally:====
 
*Dependency-Links to other features
 
*Variables, needed to balance the feature design
 
===Required Feedback===
 
''What feedback does the designed feature need to function?''
 
====VFX====
 
*Feedback 1 - Short description how it should look/sound/work
 
====Animations====
 
*Feedback 2 - Short description how it should look/sound/work
 
====Sound====
 
*Feedback 3 - Short description how it should look/sound/work
 
===Variables===
 
''What Variables do I, as the Designer, need to balance this feature?''
 
*variableName - what the variable does
 
===Dependencies===
 
''On what other features is this feature rely on?''
 
  
[[Link to Dependencies]]
+
== How do I build a new Level? ==
 +
 
 +
=== Placing Objects ===
 +
Select the Object Type from the left Sidebar.
 +
 
 +
Select the Variant and Rotation as well.
 +
 
 +
Press [Leftclick], when the crosshair is green to place the object.
 +
 
 +
=== Editing Objects ===
 +
Press [Leftclick], when the crosshair is red to select the object.
 +
 
 +
The Inspector in the right Sidebar should now show all variables you can edit.
 +
 
 +
Use the Sliders, Inputfields, etc. to edit the object.
 +
 
 +
=== Removing Objects ===
 +
Press [Rightclick], when the crosshair is red, to remove the object.
 +
 
 +
=== Saving Levels (Needs Edit once Naming System exists) ===
 +
Use the Save Button on the left sidebar.
 +
 
 +
== How do I edit an existing Level? ==
 +
 
 +
=== Loading Levels (Needs Edit once Naming System exists) ===
 +
Use the Load Button on the left sidebar.
 +
 
 +
== How can I test a Level? ==
 +
In the current state, you can move the maincharacter with the usual inputs while in Edit Mode, instantly testing while you build.
 +
 
 +
It's recommended to SAVE before testing out, and LOAD after you're done testing, else it could potentially cause problems.
 +
 
 +
Soon there will be a dedicated test feature utilizing the "Play Mode"
 +
 
 +
== How do I add new Variants to the Leveleditor? ==
 +
[[File:ObjectTemplate.png|thumb|404x404px|The Editor Template]]
 +
Variants here mean mostly visual variants to an already existing template object, for example a green version of a Sentry.
 +
 
 +
=== Creating the Variant ===
 +
Currently, in Assets/Prefabs/Interactables/Templates, there is a template Prefab with only the code-relevant part.
 +
 
 +
Add the Visual Change below the "Model" child object.
 +
 
 +
After you're done with the changes, save the prefab as a variant.
 +
 
 +
=== Adding the Variant ===
 +
Currently, in Assets/Scripts/Leveleditor there is a file called "Editor Template"
 +
 
 +
It contains mulitple list of Variant-Prefabs.
 +
 
 +
Add the Variant-Prefab you created to the list, to automatically add it to the Leveleditor system.
 +
 
 +
== How do I add new Objects to the Leveleditor? ==
 +
This is not nearly as easy as adding new Variants to the Leveleditor, so this should only be done by a programmer.
 +
 
 +
=== LevelData.cs ===
 +
Add constructor to tell the system what that object even needs to be saved
 +
 
 +
=== ObjectTemplate.cs ===
 +
Add them, so their variants can be found be the savesystem
 +
 
 +
=== Savesytem.cs ===
 +
Add instructions on how to build those objects into the level
 +
 
 +
=== EditorUIManager.cs ===
 +
Add the Menu Instructions for Inspector, if needed.
 +
 
 +
== FAQ ==
 +
 
 +
=== What does the Colour of the crosshair mean? ===
 +
'''- Green:''' Grid is Empty
 +
 
 +
'''- Red''': Grid is not Empty
 +
 
 +
'''- Purple:''' Object is Selected
 +
 
 +
=== Can I lick the Leveleditor? ===
 +
Maybe, but please don't.
 +
 
 +
==== More added when Questions occur ====
 +
== How does the Level Editor work? ==
 +
This is just to give a bit of a look behind the curtain, it's more to be seen as a rough reference. Musnt be totally accurate at all times.
 +
 
 +
=== Placing Objects: ===
 +
 
 +
# Checking the world position of the cursor
 +
# Checking if the grid is empty or not
 +
# Instantiating the selected object as child of the "Parent" tagged object
 +
 
 +
=== Removing Objects: ===
 +
 
 +
# Checking the world position of the cursor
 +
# Checking if the grid is empty or not
 +
# Destroy object in selected grid
 +
 
 +
=== Saving Levels: ===
 +
 
 +
# Find all categorised objects using tags (Wall, Sentry, etc.)
 +
# Convert them all into a stripped down serializable datatype
 +
# Insert the stripped down data into an array
 +
# Create a LevelData from all of the data arrays
 +
# Use a binary formatter to encrypt the level data
 +
# Save the encrypted data to file
 +
 
 +
=== Loadng Levels: ===
 +
 
 +
# Read the data from file
 +
# Use a binary formatter to decrypt the data into a LevelData
 +
# Clearing the level by destroying all objects of the "Parent" tagged object
 +
# Building the level by instantiating every object from LevelData as child of the "Parent" tagged object according to the list of prefabs given by the ObjectTemplate
 +
[[Category:Done]]

Latest revision as of 13:58, 3 June 2021

LayoutLevelEdit.png

How do I build a new Level?

Placing Objects

Select the Object Type from the left Sidebar.

Select the Variant and Rotation as well.

Press [Leftclick], when the crosshair is green to place the object.

Editing Objects

Press [Leftclick], when the crosshair is red to select the object.

The Inspector in the right Sidebar should now show all variables you can edit.

Use the Sliders, Inputfields, etc. to edit the object.

Removing Objects

Press [Rightclick], when the crosshair is red, to remove the object.

Saving Levels (Needs Edit once Naming System exists)

Use the Save Button on the left sidebar.

How do I edit an existing Level?

Loading Levels (Needs Edit once Naming System exists)

Use the Load Button on the left sidebar.

How can I test a Level?

In the current state, you can move the maincharacter with the usual inputs while in Edit Mode, instantly testing while you build.

It's recommended to SAVE before testing out, and LOAD after you're done testing, else it could potentially cause problems.

Soon there will be a dedicated test feature utilizing the "Play Mode"

How do I add new Variants to the Leveleditor?

The Editor Template

Variants here mean mostly visual variants to an already existing template object, for example a green version of a Sentry.

Creating the Variant

Currently, in Assets/Prefabs/Interactables/Templates, there is a template Prefab with only the code-relevant part.

Add the Visual Change below the "Model" child object.

After you're done with the changes, save the prefab as a variant.

Adding the Variant

Currently, in Assets/Scripts/Leveleditor there is a file called "Editor Template"

It contains mulitple list of Variant-Prefabs.

Add the Variant-Prefab you created to the list, to automatically add it to the Leveleditor system.

How do I add new Objects to the Leveleditor?

This is not nearly as easy as adding new Variants to the Leveleditor, so this should only be done by a programmer.

LevelData.cs

Add constructor to tell the system what that object even needs to be saved

ObjectTemplate.cs

Add them, so their variants can be found be the savesystem

Savesytem.cs

Add instructions on how to build those objects into the level

EditorUIManager.cs

Add the Menu Instructions for Inspector, if needed.

FAQ

What does the Colour of the crosshair mean?

- Green: Grid is Empty

- Red: Grid is not Empty

- Purple: Object is Selected

Can I lick the Leveleditor?

Maybe, but please don't.

More added when Questions occur

How does the Level Editor work?

This is just to give a bit of a look behind the curtain, it's more to be seen as a rough reference. Musnt be totally accurate at all times.

Placing Objects:

  1. Checking the world position of the cursor
  2. Checking if the grid is empty or not
  3. Instantiating the selected object as child of the "Parent" tagged object

Removing Objects:

  1. Checking the world position of the cursor
  2. Checking if the grid is empty or not
  3. Destroy object in selected grid

Saving Levels:

  1. Find all categorised objects using tags (Wall, Sentry, etc.)
  2. Convert them all into a stripped down serializable datatype
  3. Insert the stripped down data into an array
  4. Create a LevelData from all of the data arrays
  5. Use a binary formatter to encrypt the level data
  6. Save the encrypted data to file

Loadng Levels:

  1. Read the data from file
  2. Use a binary formatter to decrypt the data into a LevelData
  3. Clearing the level by destroying all objects of the "Parent" tagged object
  4. Building the level by instantiating every object from LevelData as child of the "Parent" tagged object according to the list of prefabs given by the ObjectTemplate