Negum.Core is a library which provides key classes and interfaces for a 2D fighting game engine.
It allows you to read and parse characters, stages, fonts, etc.
Negum.Core was build out of layers which communicate with each other.
Layer | Name | Description | File |
---|---|---|---|
X | Container | Used to create objects and store them in shared space. Can be customized to use 3rd party container. | NegumContainer |
1 | Configurations | Contains various configuration definitions describing files in directories by their types (AIR, SFF, DEF, ANIM, etc.). | IConfiguration |
1 | Readers | Readers are generally used to read File or Stream into appropriate output configuration or other type. | IReader |
2 | Managers | Managers are used to represent various file types and search through them to find values. | IManager |
3 | Loaders | Loaders are used to load all entities (characters, stages, fonts, etc.) from specified directory or for specified Engine. | ILoader |
3/4 | Engines | Engine represent everything what was read from specified root directory using IEngineProvider | IEngineProvider |
- Read files with extensions: cfg, def, sff (v1, v2, v2.1), air, cns, cmd, snd, act, fnt (v0, v2)
- Read fields from files
- Load all characters, stages, fonts, etc.
- Load characters and stages only from configuration files
- Load data from config directory
- Generate single object with all data from directory - IEngine
Easiest way to install Negum.Core library is via NuGet like so:
dotnet add package Negum.Core
Or check it directly Here
using Negum.Core.Containers; // We want to initialize and use NegumContainer class
using Negum.Core.Engines; // Contains main IEngine and IEngineProvider interfaces
// ...
// This step is optional !!!
// You can override default binding for NegumContainer and assign it to 3rd party Container
NegumContainer.Registerer = (lifetime, interfaceType, implementationType) => { }; // Used for registering new type
NegumContainer.Resolver = (typeToResolve) => null; // Used for resolving type
// ...
// Take main provider which is used to build IEngine object
IEngineProvider engineProvider = NegumContainer.Resolve<IEngineProvider>();
// Read data from root directory
// Root directory is a directory which contains: chars, data, font, stages, sound, etc.
// This initialization may be used multiple times for various directories
// Every time this method is used, new IEngine object will be returned
IEngine engine = await engineProvider.InitializeAsync("path_to_root_directory");
// ...
// As an example we can take a display name of the first character read from chars directory
string characterName = engine.Characters.FirstOrDefault().CharacterManager.Info.DisplayName;
// ...
Default usage of Negum.Core can be found in Negum.Game
It should not have any external dependencies except .NET libraries.