DEV Community

Cover image for Pycraft Progress Report
Tom Jebbo
Tom Jebbo

Posted on

Pycraft Progress Report

This is transferred roughly weekly from my Twitter profile (here: https://twitter.com/PycraftDev) to here on Dev! This is for the week 04/04/2022 - 10/04/2022.

April the 04th – 2022

Hello everyone, today I've been making my first steps in Pycraft v0.9.5's release, starting with a series of minor changes and improvements to the game as a whole, I've added animations to all the major in game transitions, between menus mainly but also, I've made an array of bug fixes and minor improvements too. This section of the update, Pycraft v0.9.5-1 was accelerated by work done during the work in the installer section. I've also prototyped a range of additional features that will hopefully make Development quicker. I'd like to say I've found a minor logic error in the home screen of Pycraft v0.9.4 that doesn't render the game unplayable but does cause some messages on the home screen to be displayed more times than necessary, downloading Pycraft from GitHub’s branch ignores this issue as that has been corrected, but (.exe) and PyPi. Releases will not be changed as its going to take longer to fix that (where it is fixable) than it will be to finish the next preview for Pycraft so don't think it's worthwhile to correct (although has been corrected in later versions of Pycraft), it doesn't render the Game unplayable!

April the 05th - 2022

Today I've been working on the final feature for Pycraft v0.9.5-1, this is the joystick/controller support, there where issues with the tool tips and guide on using the controller, and using it in the project was functional Just, but now it's much Better, it now forgets the mouse control we saw in Pycraft v0.9.4 which was really terrible when you start to move the mouse whilst locked to using the controller, and instead hides the mouse and allows you to navigate the display without a mouse, for now only the Home screen has this feature, bit it's easy to add (although moderately time consuming), and will arrive to every GUI in Pycraft that needs it, and will support it in future. This will also finally fix the issues with scrolling on the home screen, and tool tips have Also been improved. Aside from this I've also added in transition effects between the different sections of the project and although this is a small update it improves features and makes a big aesthetic change and is just one part of this large update. This will also have Additional customisability when the settings menu is refreshed!

April the 06th - 2022

Today on Pycraft I've been working on the settings UI, adding in controller support there, it's one of the most complex sections, of the project currently, with the main and game engine section being more complex so took a lot of time I've done about 5 hours of work today and need maybe another hour and a half to finish it, now I've got the basics in though, it's much quicker to add in support, and the more I work on the settings menu the more I look forward to the update when I redesign it Because there are a lot of sections of code in Pycraft that could be customised and have sections commented out until I update the settings menu, I've got a good plan on how that will look, I'll share some early designs later in development. Once the settings menu is Finished, I've got some support to add to the inventory, credits, benchmark, map, achievements and character customisation, but they need little, if any work being done on them, with the next longest being the inventory and map sections.

April the 07th - 2022

Today I have something really exciting to share, but first I'd like to start by saying that the settings menu, as well as the character customer, credits and achievements sections have all been modified to add better controller support And this is much improved from the old implementation, with more changes coming in Pycraft v0.10 when the settings menu is scheduled for an update, this leaves the benchmark, inventory and map sections to do, all being well they could be finished and tested by Mid-week next, allowing additional time for anything unforeseen (although again I do not make any promises).
But now to the interesting news, I've managed to find a way to work out the collisions system, to start with I'd like to take you through the whole process Very briefly. So, python is a great language, it's versatile, easy to learn and much more, but it's unfortunately slow in comparison to for example C. This has led to a significant problem, OpenGL handles model loading and a lot of the mathematics and physics But doesn't deal with Collision So initially we started by taking the (.obj) file and converted every vertex into a coordinate in 3D space, then we would iterate over this with every refresh and with a bit of inelegant maths find the right y level for the character For now the mathematics is irrelevant (and will be continued in a later update), but this was really slow, cutting the FPS from 60 to about 2, so then we decided to run the collisions in a thread, this meant that the number of checks didn't increase in frequency But the game wasn't waiting around for the collision detection engine, this improved performance somewhat to about 20 FPS, this is what we saw for a while in early versions of Pycraft, but now testing and more complex algorithms have improved performance significantly Particularly with the game engine change, by adding in a cache of positions near to the player for faster access, then (from today) compiling the entire process into assembly/low level instructions that run much faster, and potentially (currently untested) On the GPU and also in parallel with mathematics optimisations has, in testing meant that the game can run at about 1500 FPS maximum, and the collisions runs at about 3,000 FPS processing 26,000,000 individual pieces of data (worst case scenario) so we are much faster Now, and of course improvements like running the entire collision detection engine in a separate process and only when the character changes position too helps to improve performance, but this is really positive and good because this is coming very soon to Pycraft v0.9.5.

April the 08th - 2022

Pycraft progress update time, the achievements, credits, character customisation, benchmark, settings and home screen have all been now changed to add better support for controllers, this is one of the final changes that will be made of this type Outside of when new features are added for different GUIs. This leaves the inventory and map sections still to do, they aren’t as complex as the settings menu was, but will still be challenging, but I think that I'll have at least 1 finished by tomorrow night and be a good way towards the second one too. Additionally today I've changed the adaptive mode functionality in Pycraft, it now will slowly increase the FPS the game is running at, over every GUI in real time, providing that the CPU/GPU are not too heavily Utilised, additionally we have now seen the implementation of some proposed features for the benchmark section, we can measure Pycraft’s approximate CPU usage as a process and can also adjust the FPS depending on how much in the way of resources are available It starts at the FPS determined in the benchmark as a good place to start, then will dynamically adjust in game. I'd like to say, this will be changed when the settings menu is refreshed, then there will be a power saving mode, average, and performance mode and each will change what stages to increase and lower frame rates and how aggressively to do that, currently the default is the "average" setting. (I'm very pleased with how this feature is working, especially with Nvidia GPU integration (with potentially AMD GPU support coming at a later date)) I've also now shared the news of the release of Pycraft v0.9.4 on dev and Discord, I wanted to wait a few days to make sure there were no starting issues that needed to be corrected before sharing the news more broadly.

April the 09th - 2022

Pycraft progress update time, today I've added in controller support for Pycraft, although I've not yet started on the map section because I've got a busy day tomorrow, a business trip to Birmingham for Monday morning, I'm going tomorrow Afternoon before the busy morning traffic on the Monday, as a result I'll have tomorrow for Pycraft, which I'll be spending making final touches to other features in Pycraft and removing some of the structure I use for developing Pycraft, so then from Monday afternoon When I get back, I can get Pycraft v0.9.5-1 released as soon as possible, then it’s time to start work on the medium article! Today, because the inventory was changed by about 3pm, and I didn't want to leave a feature half-finished when I go, so instead Removed the frame rate limit temporarily on the game engine, ran many tests and have seen what methods I can do, from trying to run the game on the GPU only, to a JIT compiler @numba_jit and even trying out Nuitka to compile the project into C, most of the Attempts were unsuccessful, it did give me a look into where performance is lost and how it compares to other projects in ModernGL, and how I can make the project quicker, most of this won't be seen by the end user, and there will not be a dedicated release for this, but We are always reviewing this to see how we can improve performance.

April the 10th – 2022

Pycraft progress today was limited, I've made some tweaks to the joystick implementation and fixed some features, I've added an additional thread that focuses on the install or remove of a controller, and its detection because for some reason PyJoystick doesn't detect controller installing or removing very well, it does in other implementations in other programs, but not in Pycraft. I'd like to point out though that PyJoystick is an amazing module for controllers and very performant to, so now the Project will display when a controller is added or removed, and if the user is using a controller at the time it switches to accept mouse inputs if there are no controllers available, although I’d like to add that I don't have multiple controllers to test that But it does now switch automatically to at least one input if none is available, this was added in a previous update but has never really worked, but this is much better now! I'm also looking into performance loss in the game engine to see if there is anything that needs improving.

Thanks for reading folks!

Discussion (0)