• Stars
    star
    1,799
  • Rank 25,827 (Top 0.6 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 9 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Nez is a free 2D focused framework that works with MonoGame and FNA

Nez

Build status NuGet version NuGet downloads Join the chat Website

See partial zh-cn translation at README.cn.md éƒšćˆ†äž­æ–‡çż»èŻ‘è§ README.cn.md

Nez aims to be a feature-rich 2D framework that sits on top of MonoGame/FNA. It provides a solid base for you to build a 2D game on. Some of the many features it includes are:

  • Scene/Entity/Component system with Component render layer tracking
  • SpatialHash for super fast broadphase physics lookups. You won't ever see it since it works behind the scenes but you'll love it nonetheless since it makes finding everything in your proximity crazy fast via raycasts or overlap checks.
  • AABB, circle and polygon collision/trigger detection
  • Farseer Physics (based on Box2D) integration for when you need a full physics simulation
  • efficient coroutines for breaking up large tasks across multiple frames or animation timing (Core.startCoroutine)
  • in-game debug console extendable by adding an attribute to any static method. Just press the tilde key like in the old days with Quake. Out of the box, it includes a visual physics debugging system, asset tracker, basic profiler and more. Just type 'help' to see all the commands or type 'help COMMAND' to see specific hints.
  • Dear ImGui in-game debug panels with the ability to wire up your own ImGui windows via attributes
  • in-game Component inspector. Open the debug console and use the command inspect ENTITY_NAME to display and edit fields/properties and call methods with a button click.
  • Nez.Persistence JSON, NSON (strongly typed, human readable JSON-like syntax) and binary serialization. JSON/NSON includes the ability to automatically resolve references and deal with polymorphic classes
  • extensible rendering system. Add/remove Renderers and PostProcessors as needed. Renderables are sorted by render layer first then layer depth for maximum flexibility out of the box with the ability to add your own custom sorter.
  • pathfinding support via Astar and Breadth First Search for tilemaps or your own custom format
  • deferred lighting engine with normal map support and both runtime and offline normal map generation
  • tween system. Tween any int/float/Vector/quaternion/color/rectangle field or property.
  • sprites with sprite animations, scrolling sprites, repeating sprites and sprite trails
  • flexible line renderer with configurable end caps including super smooth rounded edges or lightning bolt-like sharp edges
  • powerful particle system with added support for importing Particle Designer files at runtime
  • optimized event emitter (Emitter class) for core events that you can also add to any class of your own
  • scheduler for delayed and repeating tasks (Core.schedule method)
  • per-Scene content managers. Load your scene-specific content then forget about it. Nez will unload it for you when you change scenes.
  • customizable Scene transition system with several built in transitions
  • Verlet physics bodies for super fun, constraint-to-particle squishy physics
  • tons more stuff

Nez Systems

Setup

Install as a submodule:

  • create a Monogame Cross Platform Desktop Project
  • clone or download the Nez repository
  • add the Nez.Portable/Nez.csproj project to your solution and add a reference to it in your main project
    • if you are working with MonoGame 3.8, use Nez.Portable/Nez.MG38.csproj instead
  • make your main Game class (Game1.cs in a default project) subclass Nez.Core

If you intend to use any of the built in Effects or PostProcessors you should also copy or link the DefaultContent/effects folder into your projects Content/nez/effects folder and the DefaultContent/textures folder into Content/nez/textures. Be sure to set the Build Action to Content and enable the "Copy to output directory" property so they get copied into your compiled game. See the Nez.Samples csproj for an example on how to do this.

Note: if you get compile errors referencing a missing project.assets.json file run msbuild Nez.sln /t:restore in the root Nez folder to restore them.

Install through NuGet:

The NuGet packages are long since deprecated. The source code has been carefully commented and contains a wealth of useful information. Use the source.


All Nez shaders are compiled for OpenGL so be sure to use the DesktopGL template, not DirectX! Nez only supports OpenGL out of the box to keep things compatible across Android/iOS/Mac/Linux/Windows.

If you are developing a mobile application you will need to enable touch input by calling Input.Touch.EnableTouchSupport().

Samples Repository

You can find the samples repo here. It contains a variety of sample scenes that demonstrate the basics of getting stuff done with Nez. This YouTube playlist also has a few relevant videos.

For reference, you can also access Nez's documentation here.

Using Nez with FNA

Note that you have to install the required FNA native libs per the FNA documentation. Here is what you need to do to get up and running with Nez + FNA:

  • clone this repo recursively
  • open the Nez solution (Nez/Nez.sln) and build it. This will cause the NuGet packages to refresh.
  • download/clone FNA
  • open your game's project and add a reference to FNA and Nez.FNA
  • (optionally) add references to Nez.FNA.ImGui or Nez.FNA.FarseerPhysics if you need them

The folder structure the cscproj files expect is something like this:

  • TopLevelFolderHousingEverything
    • FNA
    • YourGameProject
    • Nez

Alternatively, you can use the Nez + FNA template which works for Visual Studio and VS Code available here.

Acknowledgements/Attributions

Bits and pieces of Nez were cherry-picked from various places around the internet. If you see something in Nez that looks familiar open an issue with the details so that we can properly attribute the code.

I want to extend a special thanks to three people and their repos listed below. The Monocle Engine and MonoGame.Extended allowed me to get up and running with MonoGame nearly instantly when I was first evaluating if it would be a good alternative to use for making games. libGDX scene2D UI was ported over to Nez to get a jump start on a UI as well. Nez uses a bunch of concepts and code from all three of these repos.

Maddy Thorson's fantastic Monocle Engine

Dylan Wilson's excellent MonoGame.Extended and his initial work on converted Farseer Physics Engine to a Portable Class Library. Farseer is Microsoft Permissive v1.1 licensed.

Nathan Sweet's libGDX Scene2D UI libGDX. Nez UI is based on libGDX Scene2D which is Apache licensed.

More Repositories

1

CharacterController2D

C#
1,032
star
2

TouchKit

Gestures and input handling made sane for Unity
C#
896
star
3

GoKit

Lightweight tween library for Unity
C#
583
star
4

RecyclerKit

Object pool manager for Unity
C#
363
star
5

TransitionKit

Modular, extensible transitions in scene and between scenes
C#
300
star
6

SpriteLightKit

Blended lighting system for Unity that works with standard Sprites
C#
227
star
7

StateKit

Dead simple, lightweight "states as objects" system
C#
220
star
8

ZestKit

Tween library for Unity. The best of GoKit and GoKitLite combined in an easy to use API
C#
156
star
9

Nez-Samples

Samples and demos of various Nez features
C#
148
star
10

zig-ecs

Zig
144
star
11

P31UnityAddOns

Mostly defunct. Features were added and components broken out in the *Kit repositories.
C#
142
star
12

zig-upaya

Zig-based framework for creating game tools and helper apps
Zig
124
star
13

MessageKit

Decoupled message sending system meant as a replacement for SendMessage and its variants.
C#
122
star
14

zig-gamekit

Companion repo for zig-renderkit for making 2D games
Zig
103
star
15

CameraKit2D

Framework for creating 2D camera systems
C#
95
star
16

zig-renderkit

Zig
54
star
17

zig-flecs

C
51
star
18

GoKitLite

A super duper lightweight tweening library for Unity
C#
51
star
19

SoundKit

C#
45
star
20

Unity-Ripgrep-Search-Tool

C#
42
star
21

P31TaskManager

General purpose task manager that provides a lot more control and power than a standard coroutine
C#
35
star
22

via

V 2D game library
V
29
star
23

UnityCgShaderTutorials

Source code for the Unity Cg Shaders tutorial series on YouTube: http://www.youtube.com/playlist?list=PLb8LPjN5zpx1tauZfNE1cMIIPy15UlJNZ
C#
27
star
24

V-C-Wrapper-Generator

Helper for generating Odin and V wrapper code from C source
C#
19
star
25

Simple-ECS-Sharp

C#
18
star
26

ecs-lua

A simple, hybrid ECS
Lua
17
star
27

zig-miniaudio

Zig
17
star
28

SpriteKit

DEFUNCT: Unity now has 2D tools built in. This is now not maintained.
C#
15
star
29

PaletteKit

Helpful editor classes for importing and displaying color palettes
JavaScript
12
star
30

LearningUnits

C#
10
star
31

Odin-Sublime-Text-Plugin

Python
9
star
32

ImGuiGL-Renderer

C#
9
star
33

zig-vulkan

C++
5
star
34

egui_curve_tool

Rust
4
star
35

zig-aya

Zig
4
star
36

App-Engine-Task-Manager

Python
3
star
37

Odin-Libs

C
3
star
38

v-temp-modules

V
3
star
39

zig-fmod

Zig
2
star
40

Hugo-Helper

macOS app for managing a Hugo website
C#
2
star
41

prime31.github.io

HTML
2
star
42

fips-flecs

fipsified version of the Flecs ECS
CMake
1
star