A 2D modular cross-platform game engine built primarily for the Sony PSP using C++ and SDL3.
A 2D modular cross-platform game engine built primarily for the Sony PSP using C++ and SDL3.
you may have noticed that there hasn’t been a devlog for 4 days, and there are 2 reasons for that:
my logger class is literally just a wrapper around spdlog which is a very neat logging library, i made it a wrapper to have a nice API exposed to the user and for future-proofing.
spdlog came with some… considerations, and i decided ultimately it would be nicer to package up fmt & spdlog for the PSP and push them to the psp-packages repository
I had to scratch my head a little while patching the source code but in the end it worked out and I have logging working on the psp too!
honestly I don’t remember anything else I added so here’s an image of logging working on PPSSPP.
Log in to leave a comment
ok so remember last post where i was talking about how painful it is to use matrices? well i was kinda right but also i was kinda stupid. i’m wiser now. aka my smarter friend helped me fix it and now rotation works properly.
positive consequences that is, i added a camera component!
you can add this camera component to any node, pretend it has the height and width of the screen (technically, nodes cannot have a pixel width and height unless they have a sprite. Scale is a multiplier as a consequence to adding matrices, however as in most game engines the camera’s pixel width and height is the size of the screen!). The camera also has an origin point that is set to 0.5 by default as in most game engines, so have fun i guess?
so the game engine is now SDL3 (yes it still compiles to the PSP)! sdl3 is a lot better and it wasnt really that hard to port it because i barely used SDL in the first place, it was only used in graphics.cpp.
the engine builds to the web now with emscripten! very exciting as this means my usability rating will not be 2 stars…
it uses the calamity mod sprite from terraria because my friend thought it would be funny, anyways in the video the camera is spinning and zooming out at the same time. I don’t really have a “game” yet since no input/audio/file library but that is to come.
Next on the list is probably logging and error handling since i desperately need that (the engine segmentation faults if it tries to load a texture that doesnt exist when built natively lol)
So… I thought if i made a 2D game engine I wouldn’t have to deal with matrices (transformation matrices), but here we are!!!
remember that bug from like the second devlog? where the node was spinning around wrong? well, turns out to fix it you have to have matrices in the transform because yeah i guess you just do.
If by some weird coincidence you’re going through the same headache as me here is a good resource: matrices and transformations (godot)
nothing really, I wanted to start work on the camera but that requires (you guessed it) transformation matrices!!!
Technically attaching scripts to nodes isnt part of the framework, however, it is part of the project compiler (more on that later), so, I drafted up how the scripting system would look like!
You have a folder called “scripts” where you have .hpp files that look like the image attached. Basically just like unity’s scripting API, so it should be pretty simple to get used to! These “scripts” are just classes that extend the Script component which contains all of the base functions like update, start, etc…. Then, you just attach the script like a regular component and it just works!
This way, once you’ve set up the node tree and attached scripts you basically never have to touch main.cpp ever.
Basically a fancy way of saying “serialize and deserialize loaded nodes along with their corresponding components”. Exporting a node tree would just take every node under the root node and serialize it into a JSON file.
I’m currently working on a file access API used for loading and writing node trees when needed, that is, of course, cross platform (not sure about wasm yet though).
I’ve finally decided how this would be structured. I will have a project structure format (fancy name for json serialized node tree + script collection) that you pass into a standalone project compiler program to turn it into a compilable calamity framework C++ project.
The companion app (aka the engine itself) would be an editor made for the project structure format. This way, this one big project is split up into more handleable chunks that I can work on individually. I still have to create the standard project template: something that would compile to all platforms with no extra tinkering required (by tinkering i mean cmake stuff)
The app compiles cross-platform! 🔥🔥🔥 Turns out it seg faults when it tries to load a texture file that doesn’t exist.
I know nobody really bothers to install standalone apps when they vote for projects, so i will be attempting to make calamity engine compile with emscripten (which will be a big pain in the bum bum)
I will probably have to build the companion app with calamity engine so it will kinda be engine-ception, “playing” the game will just mean loading the scene node tree (i still have to figure out how to tie scripts to specific nodes 😬, the solution im thinking of right now is “if current scene is this, run this if this node exists” and i hope there’s a better way to do it perhaps)
Here it is running horribly on my phone through termux x11 (1 frame per sometimes)
Log in to leave a comment
Ordering will be done in the way that godot does it, aka, root node -> render -> renders children in order
I will implement a serializer & deserializer (optimally in JSON) to load node trees instantly, this would be used for scenes and prefabs
This would be a bit harder to achieve cross platform (did i mention i want the engine to be cross platform?), still i think json would be a good option.
I want to stray away from inbuilt kernel functions for the PSP as much as possible, since technically the engine can be compiled to PC since it only uses SDL2, however:
Log in to leave a comment
i have implemented a child-parent system where you can have a node be a child of another node and etc etc i think if you’re reading this you’ve used a game engine before.
Anyways my last devlog didn’t go into detail at all, so i’m going into detail in this one:
I want this game engine to be kind of like unity: The engine has a component system (for example, you can have a node and have a sprite component to render a sprite, or maybe you want a camera component or an audiolistener component, etc…)
right now im working on the basic framework (i still have audio and input and physics to implement) but after I’m done with that i want to have a desktop app that lets you generate a project with a level/scene designer and an individual node script system (that will be a pain to setup, but oh well, if it’s auto generated it shouldn’t be that hard). I guess there will be a certain layer of abstraction inbetween what you have in-editor and what the final compiled version is like, so perhaps errors will be hard to figure out among other output, but that’s a problem for future me!
have a video of realistic flappy bird 3d spinning along incorrectly with another flappy bird 3d
Log in to leave a comment