A little bit of what I've been working on
Happy New Year everyone! Since I posted this on twitter in summer I've been willing to sit a little bit and write a small post talking about all the things I have been coding during the past year and a bit further
My contribution for this year was Kaijuu Feeder. I was happy with the result and would have loved working a litte bit more on it. Sadly I don't have time for that
I love working on ZGB and still have great plans for the future but I just dedicate it a few weeks along the year
Z3D is a 3d cross platform engine available for Nintendo DS, Windows, Wii, Android, IOS and Nintendo 3ds. It hasn't been relased yet because is not as much user friendly as I'd like it to be. Because of that in mid 2018, tired of all the issues caused by 3ds max, I started working on an editor inspired by (not gonna lie to you) Unity3d. I work with Unity3d on my daily basis so at some point I thought it would be great to have an editor like it for homebrew games (or at least try to do it). Here is the list of features I have implemented so far
The Unity team have been kind enough to write a few docs here and there showing how its implementation works
- https://blogs.unity3d.com/2015/12/22/going-deep-with-imgui-and-editor-customization
- https://docs.unity3d.com/Manual/gui-Basics.html
There are also a few open source alternatives that are worth taking a look at
- DearIMGUI
- Nuklear
In the end I decided to create my custom solution for several reasons:
- The way events are handled in both solution is different from how Unity handles them
- Performance can be better, you don't need to draw all the editor windows every frame
- Lack of some features like dockable windows (which still seems to be a WIP) and customization options
- Although very portable I'd need to invest time to get them working on some platforms that I support (like the Wii or the DS). If I create my custom solution with the code I already have I won't have that problem. I am planning to add more platforms in the future and I don't want to have a 3rd party library avoiding me to do so
- I felt skilled enough to try and create my own library and I wanted to give it a try
You can of course say that there is no point on reinventing the wheel but, hey! I am building a game engine from scratch here so maybe it's a little bit late for that :P. I have already implemented:
- Labels
- Buttons
- Checkboxes
- Combo boxes / enum combo boxes, thanks to Reflectpp enum combo boxes are handled automatically given an enum tye
- Textfields
- Color picker
- Scroll bars
- Trees
- Views, which are capable of handling views within views and automatically display scroll bars when needed
- AsssetField
C++ does not support reflection. Again, there are a few solutions available. A quick search in google will show you some popular options
- https://preshing.com/20180116/a-primitive-reflection-system-in-cpp-part-1/
- https://github.com/rttrorg/rttr
- http://pfultz2.com/blog/2012/07/31/reflection-in-under-100-lines/
- http://donw.io/post/reflection-cpp-1/
some of them are pretty cool, but again I didn't fully like them because:
- since my engine will work on legacy platforms I wanted a solution that worked on c++ 98 (not c++11 and definitely not c++17)
- I wanted a solution that required the minimun steps from the user. Having to declare a var and then add its reflecion info in the cpp are 2 steps, and I know it can be done with just one
- I wanted to have all that Unity offers on its editor: inheritance, composition, vectors, enums, strings
In the end I came up with a library called Reflectpp, and decided to make it open source. It is available on github
- Scene: lets me navigate through all the objects
- Game: shows how the game is going to look like
- Hierarchy: shows a list of all the objects available and how they are parented
- Resources: shows a list of all the resources available in the current build
- Inspector: displays the information (using reflection) of the current selected object
For these windows I had to spend a lot of time working on some features like
- Translate
- Rotate
- Scale
Again, I needed to do this in a way that resulted easy for the final user. Take a look at how any of my materials are displayed with and without custom inspector
- given a path, load the asset in that path and if it has already been loaded increase its internal reference count. The asset manager must avoid loading the same asset twice
- given an asset, return the path where this asset was loaded from. This is very useful in the inspector Window when the user clicks on an AssetField and you see a bounce animation in the resources Window showing where it came from
The AssetManager works with Assets. so far I have created Assets for:
- Textures
- Meshes
- Materials
- Fonts
- Sounds, this two will be easy to update
- Animations, the way they are handled right now makes it hard to share information between duplicated nodes. Animation retargeting works pretty well though
- Prefabs, this is probably where most work needs to be done. I'd love to have nested prefabs too
- Scenes... still need to check if I need a separate asset for scenes instead of using prefabs for them (like Godot does)
But the work with the asset manager won't be finished when I have all this. I also need to work on
- Adding assets to the project: right now I have a text file with the list of assets and the export options for the different platforms. This works, but is very primitive. I like how Unity handles it, automatically adding all the content contained into the project folder but then stripping unused content from the build
- Uniquelly identifying assets for serialization. Unity uses UUIDs for this and meta files for each file added into the project. Also there is the concept of file ids for assets contained within assets (for example a component inside a prefab)
- Automatically updating loaded assets when the content on disk has changed
There is a lot of stuff to be done but since it's my hobby I will continue working on it. I just wanted to write a quick post showing you all the things I have been working on and also let you know that I am still alive and kicking even though is getting hard to find time to dedicate to all this :)
ZGB
This year we celebrated the ZGB Jam 2 and released 8 new games (see myprevious post). I am still working on the engine and am very happy with how it has evolved over the years. A total of new 13 games were released during 2019 and there are at least a couple more games in development that I am aware of. Working on an engine is cool but getting people to use it on their own is really satisfyingMy contribution for this year was Kaijuu Feeder. I was happy with the result and would have loved working a litte bit more on it. Sadly I don't have time for that
I love working on ZGB and still have great plans for the future but I just dedicate it a few weeks along the year
Z3D
Most of my spare time is dedicated to Z3D, the 3d engine that I used to create Whack Mania, Rokoban and Jumping Jack (and other title that I have decided not to release yet) Because the last thing I published with the engine was the Wii ports back in 2016 it really makes sense to think that I have abandoned the project... so let's recap a little bitZ3D is a 3d cross platform engine available for Nintendo DS, Windows, Wii, Android, IOS and Nintendo 3ds. It hasn't been relased yet because is not as much user friendly as I'd like it to be. Because of that in mid 2018, tired of all the issues caused by 3ds max, I started working on an editor inspired by (not gonna lie to you) Unity3d. I work with Unity3d on my daily basis so at some point I thought it would be great to have an editor like it for homebrew games (or at least try to do it). Here is the list of features I have implemented so far
ZIMGUI
Prior to Unity3d I never heard before of Immediate mode GUIs. As a programmer I grew up with editors like Borland C++ Buider, Visual Studio, NetBeans, Eclipse and some others all of them using what is known as Retained GUIs. Although easy to use, for small tools nothing beats IMGUI. People not very skilled are capable of writing complex tools for Unity3d. Try to build a C++ UI using Visual Studio, try to maintain that! IMGUI lacks performance (as if working with Eclipse didn't) but since it is designed for editor tools (you can use it on games, but... don't do it) it is perfectly acceptableThe Unity team have been kind enough to write a few docs here and there showing how its implementation works
- https://blogs.unity3d.com/2015/12/22/going-deep-with-imgui-and-editor-customization
- https://docs.unity3d.com/Manual/gui-Basics.html
There are also a few open source alternatives that are worth taking a look at
- DearIMGUI
- Nuklear
In the end I decided to create my custom solution for several reasons:
- The way events are handled in both solution is different from how Unity handles them
- Performance can be better, you don't need to draw all the editor windows every frame
- Lack of some features like dockable windows (which still seems to be a WIP) and customization options
- Although very portable I'd need to invest time to get them working on some platforms that I support (like the Wii or the DS). If I create my custom solution with the code I already have I won't have that problem. I am planning to add more platforms in the future and I don't want to have a 3rd party library avoiding me to do so
- I felt skilled enough to try and create my own library and I wanted to give it a try
You can of course say that there is no point on reinventing the wheel but, hey! I am building a game engine from scratch here so maybe it's a little bit late for that :P. I have already implemented:
- Labels
- Buttons
- Checkboxes
- Combo boxes / enum combo boxes, thanks to Reflectpp enum combo boxes are handled automatically given an enum tye
- Textfields
- Color picker
- Scroll bars
- Trees
- Views, which are capable of handling views within views and automatically display scroll bars when needed
- AsssetField
REFLECTION
There is something I love from Unity and that's its easiness of use. One of its strongest points is how easy it is to configure components parameters in the editor. This is achieved using reflection available in C#, and it's automatic, the user doesn't need to create any custom inspector (although he can if he wants to)C++ does not support reflection. Again, there are a few solutions available. A quick search in google will show you some popular options
- https://preshing.com/20180116/a-primitive-reflection-system-in-cpp-part-1/
- https://github.com/rttrorg/rttr
- http://pfultz2.com/blog/2012/07/31/reflection-in-under-100-lines/
- http://donw.io/post/reflection-cpp-1/
some of them are pretty cool, but again I didn't fully like them because:
- since my engine will work on legacy platforms I wanted a solution that worked on c++ 98 (not c++11 and definitely not c++17)
- I wanted a solution that required the minimun steps from the user. Having to declare a var and then add its reflecion info in the cpp are 2 steps, and I know it can be done with just one
- I wanted to have all that Unity offers on its editor: inheritance, composition, vectors, enums, strings
In the end I came up with a library called Reflectpp, and decided to make it open source. It is available on github
ZEDITOR
With both ZIMGUI and Reflectpp I could start working on the editor. Just like Unity and other engines like Godot I loved the idea of the editor being implemented with the engine itself, that way porting it to MacOS or Linux when the time comes will be much easier. In this editor I have started working on the next windows:- Scene: lets me navigate through all the objects
- Game: shows how the game is going to look like
- Hierarchy: shows a list of all the objects available and how they are parented
- Resources: shows a list of all the resources available in the current build
- Inspector: displays the information (using reflection) of the current selected object
How the editor looks right now (click to enlarge) |
Handles
Besides ZIMGUI I needed another system to manipulate 3d objects. It also works as immediate mode but in this case it lets me manipulate 3d objects in space. I have gizmos for:- Translate
- Rotate
- Scale
Custom inspectors
Automatic inspectors are ok for small components but when I started serializing my materials info I realized I needed to be able to create some custom inspectors. In the future I'd like to add also custom editors and custom propertiesAgain, I needed to do this in a way that resulted easy for the final user. Take a look at how any of my materials are displayed with and without custom inspector
The Asset manager
The last thing I've been working on is an asset manager. The asset manager mantains a database of assets for the project and must be capable of- given a path, load the asset in that path and if it has already been loaded increase its internal reference count. The asset manager must avoid loading the same asset twice
- given an asset, return the path where this asset was loaded from. This is very useful in the inspector Window when the user clicks on an AssetField and you see a bounce animation in the resources Window showing where it came from
The AssetManager works with Assets. so far I have created Assets for:
- Textures
- Meshes
- Materials
TO DO
And this is more or less what I've been working on. There is still a lot of work to do before releasing anything. During the next months I'll continue working on the AssetManager, adding more assets:- Fonts
- Sounds, this two will be easy to update
- Animations, the way they are handled right now makes it hard to share information between duplicated nodes. Animation retargeting works pretty well though
- Prefabs, this is probably where most work needs to be done. I'd love to have nested prefabs too
- Scenes... still need to check if I need a separate asset for scenes instead of using prefabs for them (like Godot does)
But the work with the asset manager won't be finished when I have all this. I also need to work on
- Adding assets to the project: right now I have a text file with the list of assets and the export options for the different platforms. This works, but is very primitive. I like how Unity handles it, automatically adding all the content contained into the project folder but then stripping unused content from the build
- Uniquelly identifying assets for serialization. Unity uses UUIDs for this and meta files for each file added into the project. Also there is the concept of file ids for assets contained within assets (for example a component inside a prefab)
- Automatically updating loaded assets when the content on disk has changed
There is a lot of stuff to be done but since it's my hobby I will continue working on it. I just wanted to write a quick post showing you all the things I have been working on and also let you know that I am still alive and kicking even though is getting hard to find time to dedicate to all this :)
Labels: C++, devkitpro, engine, Game Boy, gameboy, Godot, homebrew, IMGUI, nintendo 3ds, nintendo ds, Reflection, Unity, unity3d, wii, zgb, ZGBJAM
1 Comments:
Don't let this blog die
By Sergio, at August 11, 2023 1:54 AM
Post a Comment
<< Home