Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fronkongames/gamework-foundation
Architecture-agnostic code and tools to make Unity based games.
https://github.com/fronkongames/gamework-foundation
framework game-development game-framework gamedev gamedevelopment indiedev mit-license u3d unity unity-3d unity3d unity3d-framework
Last synced: 5 days ago
JSON representation
Architecture-agnostic code and tools to make Unity based games.
- Host: GitHub
- URL: https://github.com/fronkongames/gamework-foundation
- Owner: FronkonGames
- License: mit
- Created: 2022-04-10T18:09:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-20T00:49:18.000Z (5 months ago)
- Last Synced: 2025-01-09T01:36:36.626Z (12 days ago)
- Topics: framework, game-development, game-framework, gamedev, gamedevelopment, indiedev, mit-license, u3d, unity, unity-3d, unity3d, unity3d-framework
- Language: C#
- Homepage:
- Size: 72.4 MB
- Stars: 101
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
A set of code useful for developing Unity based games. It is independent of any architecture, so you can use it together with your favorite framework.
These are the foundations on which [Game:Work Core](https://github.com/FronkonGames/GameWork-Core) is built.
## 🎇 Features
- Architecture agnostic, use it in any code.
- Many [attributes](./Runtime/Attributes) to make your classes more usable in the editor. Custom [Inspector](./Editor/Inspector) to help you create your own inspectors.
- Multiple utilities to improve your developments: [checkers](./Runtime/Development/Check), [debug draw](./Runtime/Development/Draw), [profiling](./Runtime/Development/Profiling) and a console with custom commands.
- A lot of .Net and Unity types [extensions](./Runtime/Extensions).
- The most used [design patterns](./Runtime/Patterns), in generic versions so that they are easy to adapt to your needs.
- [Utilities](./Runtime/Development/Prototype/) to speed up prototyping time.
- Commented code with test units.## 🔧 Requisites
- Unity 2022.3 or higher.
- Universal RP 14.0.11 or higher.
- Test Framework 1.1.31 or higher.## ⚙️ Installation
### Editing your 'manifest.json'
- Open the manifest.json file of your Unity project.
- In the section "dependencies" add:```c#
{
...
"dependencies":
{
...
"FronkonGames.GameWork.Foundation": "git+https://github.com/FronkonGames/GameWork-Foundation.git"
}
...
}
```### Git
Just clone the repository into your Assets folder:
```c#
git clone https://github.com/FronkonGames/GameWork-Foundation.git
```### Zip
Download the [latest release](https://github.com/FronkonGames/GameWork-Foundation/releases) and unzip it into the Assets directory.
## 🚀 Use
The functionality is divided into folders, this is its structure:
```
|
|\_Runtime......................... Utilities for the game.
| |\_Algorithms.................. Algorithms.
| | \_Structures.............. Data structures.
| |\_Attributes.................. Attributes for fields and class properties.
| |\_Components.................. Components.
| |\_Development................. Developer utilities.
| | |\_Check................... Assert extension.
| | |\_Console................. Development console.
| | |\_Draw.................... Utilities for drawing gameplay information.
| | |\_Profiling............... To find bottlenecks.
| | \_Prototype............... Useful components for prototypes.
| |\_Extensions.................. Utility extensions.
| | |\_System.................. C# extensions.
| | \_Unity................... Unity extensions.
| |\_Math........................ Mathematical utilities.
| |\_Patterns.................... Design patterns.
| | |\_Behavioral.............. Behavioural patterns.
| | |\_Creational.............. Creation patterns.
| | \_Structural.............. Structure patterns.
| \_Utils....................... Utilities.
|
|\_Editor.......................... Editor utilities.
| |\_Drawers..................... Custom attribute viewers.
| |\_Fonts....................... Font for debug.
| \_Inspector................... Editor appearance utilities.
|
|\_Settings........................ Project settings.
|\_Demos........................... Demo scenes.
|\_Media........................... Misc resources.
\_Test............................ Unit tests code.```
Check the comments for each file for more information.
### Attributes
```c#
[Title("Attributes Demo")]
``````c#
[MessageBox("MessageBox test", MessageType.Info)]
``````c#
[Label("Int field")]
[Field(50)]
public int intField;[Label("Int less than 0")]
[FieldLess(0, -1)]
public int intLess = -1;[Label("Int less equal than 0")]
[FieldLessEqual(0, 0)]
public int intLessEqual;[Label("Int greater than 0")]
[FieldGreat(0, 10)]
public int intGreater;[Label("Int greater equal than 10")]
[FieldGreat(10, 10)]
public int intGreaterEqual;[Label("Int")]
[Slider(0, 10, 10)]
public int intSlider;[Label("Int snap 10")]
[Slider(0, 100, 50, 10)]
public int intSnap;[Label("Ints min/max")]
[MinMaxSlider(0, 100, 0, 100)]
public int intMin = 0;[HideInInspector]
public int intMax = 100;[Label("Float field")]
[Field(1.0f)]
public float floatField;[Label("Float less than 0")]
[FieldLess(0.0f, -1.0f)]
public float floatLess = 1.0f;[Label("Float less equal than 0")]
[FieldLessEqual(0.0f, 0.0f)]
public float floatLessEqual;[Label("Float greater than 0")]
[FieldGreat(0.0f, 1.0f)]
public float floatGreater;[Label("Float greater equal than 0")]
[FieldGreatEqual(0.0f, 0.0f)]
public float floatGreaterEqual;[Label("Float")]
[Slider(0.0f, 1.0f, 1.0f)]
public float floatSlider;[Label("Float snap 0.5")]
[Slider(0.0f, 1.0f, 0.5f, 0.1f)]
public float floatSnap;[Label("Floats min/max")]
[MinMaxSlider(0.0f, 1.0f)]
public float floatMin = 0.0f;[HideInInspector]
public float floatMax = 1.0f;
``````c#
[Label("Nice name")]
public string badName;
``````c#
[Password]
public string password;
``````c#
[Indent(0)]
public string noIndent;[Indent(1)]
public string indented;
``````c#
[NotNull]
public GameObject cantBeNull;
``````c#
[File]
public string filePath;[Folder]
public string folderPath;
``````c#
[Scene]
public int sceneIndex;
``````c#
[NotEditable]
public string notEditable;[OnlyEditableInEditor]
public string editableInEdit;[OnlyEditableInPlay]
public string editableInPlay;
``````c#
public bool toggle;[EnableIf(nameof(toggle))]
public string enableIf;[DisableIf(nameof(toggle))]
public string disableIf;
``````c#
public bool toggle;[ShowIf(nameof(toggle))]
public string showIf;
``````c#
public bool toggle;[HideIf(nameof(toggle))]
public string hideIf;
``````c#
[KeyCode]
public KeyCode keyCode;
``````c#
[NotEditable]
public int counter;[Button(nameof(Increase))]
public string buttonInc;[Button(nameof(Reset))]
public string buttonReset;public void Increase() => counter++;
public void Reset() => counter = 0;
```### Custom Inspector
A simple way to create your own inspectors by quickly accessing all the private fields of your components.
### Check
Checks the values of the variables that a function receives. If the condition is not met, **an exception is thrown**. Only active when '**UNITY_ASSERTIONS**' is defined (default only in the Editor).
```c#
public void GetImpact(GameObject gameObject, float damage, Vector3 impact)
{
Check.IsNotNull(gameObject);
Check.IsWithin(damage, 0.0f, 100.0f);
Check.Greater(impact, Vector3.zero);
...
}
```Take a look at the [Check class folder](./Runtime/Development/Check).
### Draw
Visualize in the Editor Scene window useful information of your game, in a simple way and without affecting the final performance of the game.
```c#
// Displays an array of points.
points.Draw();// Displays the player's direction.
player.transform.Draw();// Displays the name of the GameObject.
player.DrawName();// Displays RaycastHits.
int hits = Physics.RaycastNonAlloc(playerRay, playerHits, 100.0f);
if (hits > 0)
playerHits.Draw(playerRay);
```### Prototype
Useful components to support the development of prototypes:
* [First person](./Runtime/Development/Prototype/FirstPersonCamera.cs), [third person](./Runtime/Development/Prototype/ThirdPersonCamera.cs) and [free](./Runtime/Development/Prototype/FreeCamera.cs) cameras.
* [Screenshooter](./Runtime/Development/Prototype/Screenshooter.cs): asynchronous screen capture.
* [Hardware monitor](./Runtime/Development/Prototype/HardwareMonitor.cs): shows various performance data.
* [Collision Test](./Runtime/Development/Prototype/CollisionTest.cs): triggers events when collisions are detected.
* [Trigger Test](./Runtime/Development/Prototype/TriggerTest.cs): triggers events.
* [Face To](./Runtime/Development/Prototype/FaceTo.cs): orients the object so that it faces a target.
* [Follower](./Runtime/Development/Prototype/Follower.cs): follow a target.
* [Mover](./Runtime/Development/Prototype/Mover.cs): moves object linearly.
* [Rotator](./Runtime/Development/Prototype/Rotator.cs): rotates an object.
* [Material scroller](./Runtime/Development/Prototype/MaterialScroller.cs): moves a texture at a linear speed.### Development Console
A developer console for executing commands.
Simply add a GameObject with the [DevelopmentConsole](./Runtime/Development/Console/DevelopmentConsole.cs) component and assign the commands you want to use to it.
Commands are ScriptableObjects that you can create from [DevelopmentCommand](./Runtime/Development/Console/DevelopmentCommand.cs).
See the commands included in [this folder](./Runtime/Development/Console/Commands/).```c#
///
/// Quit application.
///
[CreateAssetMenu(fileName = "Quit", menuName = "Game:Work/Development/Command/Quit")]
public class QuitCommand : DevelopmentCommand
{
public QuitCommand()
{
Id = "quit";
Usage = "quit";
Description = "Quit application.";
}public override bool Execute(string[] args)
{
Application.Quit();
return true;
}
}
```### Profiling
It measures in a simple way the time it takes for a block of code to execute, or the memory it consumes.
```c#
using (Profiling.Time("Some slow code"))
{
...
}
```Output the message: "**Task 'Some slow code' took 27.66ms (0 frames)**"
```c#
using (Profiling.Memory("Some hungry code"))
{
...
}
```Output the message: "**Task 'Some hungry code' consume 4.00 kb**".
### Algorithms
Algorithms and data structures.
- Structures: [ArrayList](./Runtime/Algorithms/Structures/ArrayList.cs).
### Patterns
The most used design patterns:
- Behavioral: [Command](./Runtime/Patterns/Behavioral/Command), [Observer](./Runtime/Patterns/Behavioral/Observer), [Strategy](./Runtime/Patterns/Behavioral/Strategy), [Visitor](./Runtime/Patterns/Behavioral/Visitor), [State](./Runtime/Patterns/Behavioral/State).
- Creational: [Service Locator](./Runtime/Patterns/Creational/ServiceLocator/), [Singleton](./Runtime/Patterns/Creational/Singleton).
- Structural: [Decorator](./Runtime/Patterns/Structural/Decorator).All using generics.
### Unit tests
## 📜 License
Code released under [MIT License](https://github.com/FronkonGames/GameWork-Foundation/blob/main/LICENSE.md).
'[Prototype Asset Pack](https://assethunts.itch.io/prototype)' by [AssetHunts](https://assethunts.itch.io/).
'[Prototype Textures](https://www.kenney.nl/assets/prototype-textures)' and '[Mannequin Character Pack](https://assethunts.itch.io/mannequinfree)' by [AssetHunts](https://assethunts.itch.io/).