Releases: DaveGreen-Games/ShapeEngine
v2.0.0 Major Release
Originally this release was planned to be the 1.2 release. I just wanted to add / overhaul a few things and make a release but it grew into something much bigger. I realised a 2.0 release makes much more sense, escpecially because of the breaking changes that this update comes with.
Transform2D Overhaul
- Transform2D now has a scale value
- Transform2D now has a ScaledSize Getter (Size * Scale)
- Transform2D now has Radius & Length Getters (they use Width) for circles, segments, triangles, polylines & polygons
- Transform2D is now properly used in the collider / collision system
- CollisionObject has Transform2D and each collider has an Transform2D offset which are combined to form the CurTransform of the collider
- Examples were updated to reflect the new changes (EndlessCollisionSystem, AsteroidMiningExample, GameObjectHandlerExample, and BouncyCircles)
- Transform2D lerp functions added
Screen Texture 2.0
- Screen Texture has different modes to draw the texture to the screen now:
Stretch Mode
, the texture will always be the same size as the screenPixelation Mode
, the texture will always be the same aspect ratio as the screen but scaled down by a certain factor (0 - 1 range)Fixed Mode
, the texture will always stay at the same (specified) size and will be centered on the screen and upscaled to the closest dimension of the screen with black bars on the other dimension if necessary.Nearest Fixed Mode
, the texture will always be the same aspect ratio as the screen (no black bars) but will stay as close as possible to the fixed dimension.Anchor Mode
, a anchor position and stretch value can be specified to position the screen texture anywhere on the screen. This can be useful for splitscreen or minimaps.Custom Mode
, the user can control the size of texture, the mouse scaling and how the texture is drawn to the screen.
- Mouse Position Scaling works for all modes and the screen texture reports the scaled mouse position
- Shaders have moved to the screen texture. Now you can add any amount of shaders to be applied to the screen texture.
ShaderSupportType
enum was also added to specify if the screen texture should support no shaders, a single shaders, or any amount of shaders. - Camera has move to the screen texture as well. A screen texture can have a single camera that is used for the
DrawGame
pass. The game mouse position will be scaled by the camera if one is used. - There are 2 events for drawing now:
OnDrawGame
&OnDrawGameUI
OnDrawGame
is called before shaders are applied and the camera affects what area of the game world is drawnOnDrawGameUi
is called after shaders are applied and the camera has no effect on it. This is useful for ui elements because it will always be on top.
- Clear background system that allows for a fine control of when and how the texture is cleared. In most cases clearing every frame before drawing to the texture is necessary and a custom
BackgroundColor
can be specified for that. In some cases clearing should only happen in certain intervals or not at all and to allow that a function can be set in the screen texture to control that.
Random Number Generator
ShapeRandom
class removed.ShapeRandom
was a static class that used a staticRandomNumberGenerator
field and wrapped every single function. Maintaining this is tedious because any change in theRandomNumberGenerator
class that changes functions or function declaration results in duplicate work in theShapeRandom
class.RandomNumberGenerator
class renamed toRng
Rng
class now has a static Instance field that can be used likeShapeRandom
Improvements
- ShapeVec class ExpDecay & Pow Lerp improvements.
- Pool system improvements
- ShapeId system improvements
- Additional Segment constructor implemented
ScreenTexture TextureFilter
property added. (GameTexture/ScreenShaderBuffer now use Bilinear filtering by default)- Endless Space Example visual improvements.
WindowSize
inWindowSettings
now defaults to 960x540.SizeLerp*
functions added.- You can now cycle through various screen shaders in the examples project
ColorPalette
class added. A color palette holdsPaletteColors.
ColorSchemes
can be applied to color palettes to change the rgba colors of all contained palette colors.- ColorScheme class overhauled.
PaletteColor
classClone()
functions added.- New window handling system with dedicated functions for all
WindowDisplayStates
and aRestoreWindow()
function. GameWindow
&Game
classes now have staticCurrentInstance
* fields for easy static access to everything. There can only be oneGame
&GameWindow
class anyway and theGameWindow
constructor is internal, so it should be reasonably safe to use.GameWindow
classMouseOnScreen
system should work better now. This system tells you if the mouse cursor is on the screen of the window or not. Additionally, it takes care of showing/hiding the cursor when the mouse leaves the window or the window loses focus or the window is minimized.
Fixes
- I have adjusted the line thickness of all calls to raylib functions that draw outlines (multiplied line thickness by 2) to make the line thickness look consistent across all functions that use it.
- Game multishader bug fixed
- Endless Space Collision Example targeting of player guns with short detection range fixed.
GameWindow now callsInitWindow()
withWindowSettings.WindowMinSize
(ifInitWindow()
is called with 0,0 then auto iconify is disabled!)
New
LineDrawingInfo
Struct implementedDrawGappedOutline*
for all shapes implementedDrawLinesScaled*
for all shapes implementedPolarCoordinates
struct implementedControlNodeSlider
UI element implemented- Outline Drawing Functions for List implemented
- Pixelation shader added to examples.
FramebufferTransparent
member added toWindowSettings
because this flag needs to be set beforeInitWindow()
as well.WindowConfigFlags
struct added inGameWindow
class. (for detecting flag changes)- Locked Timestep physics update loop added. (Fixed physics frame rate can be set and the physics update will always run at the specified frame rate)
InputEventHandler
implemented. Listeners can subscribe to the handler to receive input event callbacks. The propagation of the event can be stopped. The listeners are sorted by priority. (Lower priority is handled first, more important)- New screen shaders added to examples
DrawCursorGame
,DrawCursorGameUi
,DrawCursorUi
virtual functions added to Game class. ReplacesICursor
system.- Fixed Update loop added. Can be enabled by setting a
FixedFramerate
bigger than 0. The fixed update loop has a fixed delta value independent of the current frame rate and delta time of the application and will callFixedUpdate()
to consume the delta time produced by the application. A fixed update loop can be very helpful for physics and collision because the delta time is predictable. If the fixed update loop is enabledHandleInput()
will be called every frame beforeFixedUpdate()
andInterpolateFixedUpdate()
will be called at the end of the frame with the fraction of application delta time left. WindowSettings``Topmost
&FullscreenAutoRestore
fields added.FullscreenAutoRestores
automatically exits fullscreen when window loses focus and restores fullscreen when window gains focus again.GameWindow
classSetWindowTopmost(bool topmost)
function added.There is now aFullscreen(int width, int height)
and aBorderlessFullscreen()
mode.- EndlessSpaceExample star parallax backgrounds added using the new
ScreenTexture
custom mode. The stars are drawn once to each screen texture (there are 5 parallax layers in the example right now) and based on the current camera position a certain rectangle of each screen texture is drawn to the screen. AnchorPoint
struct added. Is used for alignment or ui/rect anchor.
Deprecated/ Removed
DrawDotted*
functions for all shapes removed (replaced by gapped outline)ICursor
system removedIColorPalette
interface removed (replaced by newColorPalette
class)PrevDisplayStateInfo
struct removed.
Full Changelog: v0.1.2...v2.0.0
v1.0.0 Major Release
Initially, I just wanted to overhaul the input and audio system of Shape Engine. This turned into a year long complete rework. I think there is almost no area of Shape Engine that did not get changed or removed. I took some inspiration from other frameworks (Monogame mostly) on how to setup the basic framework or gameloop. I simplified it and made it more user friendly in general, and removed unnecessary steps.
One other big part was the new shape and collision system. Now Shape Engine supports a lot of shapes (Segment, Circle, Triangle, Rect, Quad, Polygon, Polyline) and collisions/ intersections work between all of them. The different shapes are all encapsulated in there own struct and I added a lot of helpful functions to them. You can intersect shapes and get all there intersection points with normals, or just overlap them, check if one shape contains the other, or even project shapes along a vector.
Reworking the UI system was really hard. I think it took me 3 iterations to get to the point where it is now. I used Godot’s Control Node system as inspiration for my system and works great now. It is simple enough and it still can do everything I need it to. The UI system now consists of three main parts:
- Control Node (a button for instance)
- Control Node Container (can contain any number of control nodes (even containers) and updates & draws them and can also neatly align them in various ways)
- Control Node Navigator (Navigates through all active & visible control nodes via input)
There is a lot more that has changed since the alpha version of Shape Engine (over 600 commits) and too much to write it down here but I think it gives you a good glance at the changes.
I think I got relatively close to my goal and once I use Shape Engine for my next game I will find out really quick what areas still need some work.
Changed / Overhauled
- Input System
- Audio System
- Savegame System
- Collision System
- Color System
- UI System
- Text & Font System
- Gameloop
- Drawing System
- Screen System
- Randomization System
New
- Pathfinding System
- Color Palettes
- Shapes
Shape Engine Alpha #3
This is the last release for the old version of Shape Engine. I worked on a pretty big overhaul of the entire engine and I wanted to release this state, so there is a stable (alpha) version until the overhaul is done.
Introduction
My custom-made engine based on the great Raylib Framework. The Main focus is being performant and only using draw functions instead of textures. I am using Shape Engine for my next game called Galaxy Unknown.
When using Shape Engine everything from Raylib is available as well. (Raylib Examples, Raylib Cheatsheet)
Shape Engine is available on Itch and it is a great way to support me ;)
Demo Showcase
The demo is included in this repository. The demo is just a simple asteroid shooter like game. It consist of a main menu and 1 level with the player ship and randomly spawning asteroids. The demo tries to show the most important aspects of Shape Engine´s usage, like how to play music in a playlist, playing and adding sounds, using the data/shader/level/ui system, and many more things! You can also download the executable of the demo on itch io to try it out without building it first!
Documentation
Right now there is no documentation. There is a complete Demo Game to see how everything works.
Dependencies
Shape Engine uses the following nuget packages:
- Raylib CsLo (c# Bindings for Raylib)
- Vortice.XInput (Gamepad Vibration)
- Newtonsoft.Json (Data Handler Json Serialization/Deserialization)
Limitations
- There is no physics system because I don´t need one and would´t know how to make one. There is complete collision system but the collision response is up to you. You can also use raylibs physics system.
- The UI system is functional but not finished yet.
- To use the data system Castle DB is recommended.
Shape Engine Alpha #2
The pooling class was overhauled. A layer system was introduced to area class to better separate game objects and be able to use a parallax effect.
Missing/ Not Working:
- ResourceManger LoadShader does not work correctly right now because Raylib-CsLo LoadShaderFromMemory function does not work correctly. I am waiting for a fix there.
- SimpleCollision.cs -> Dynamic collision checks are only implemented for circle, segment, and point colliders. If your ICollidable CollisionClass is a collider be aware to only use circle, segment, and point colliders.
- Because of a problem in Raylibs GetMonitorSize function the monitor handler has a hardcoded fix right now to set the monitor size to 1920 by 1080 if the monitor size is bigger than 2000x1250. Be aware of that. This problem is already fixed in raylib but it is not yet available in the cslo bindings.
Shape Engine Alpha #1
First Alpha Release for the Shape Engine.
Missing/ Not Working:
ResourceManger LoadShader does not work correctly right now because Raylib-CsLo LoadShaderFromMemory function does not work correctly. I am waiting for a fix there.
SimpleCollision.cs -> Dynamic collision checks are only implemented for circle, segment, and point colliders. If your ICollidable CollisionClass is a collider be aware to only use circle, segment, and point colliders.
Because of a problem in Raylibs GetMonitorSize function the monitor handler has a hardcoded fix right now to set the monitor size to 1920 by 1080 if the monitor size is bigger than 2000x1250. Be aware of that. This problem is already fixed in raylib but it is not yet available in the cslo bindings.