DEV Community

Cover image for Pycraft progress report #8
Tom Jebbo
Tom Jebbo

Posted on

Pycraft progress report #8

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

You can find the latest release of Pycraft (v0.9.3) here: https://github.com/PycraftDeveloper/Pycraft

You can find the latest developer preview of Pycraft (v0.9.4-2) here: https://github.com/PycraftDeveloper/Pycraft/tree/Pycraft-v0.9.4-2

You can find the latest feature preview for Pycraft (v0.9.5-0) here: https://github.com/PycraftDeveloper/Pycraft/tree/Pycraft-v0.9.5-0

You can also find the latest documentation for Pycraft here: https://python-pycraft.readthedocs.io/en/pycraft-v0.9.3/
although be aware there is a lot of changes occurring here.

January 3rd - 2022

Pycraft progress update time, unfortunately I've not managed to get round to updating the folks at Dev yet that's first on the agenda tomorrow, but I've been working hard on the new installer for Pycraft, no documentation writing today, and it's been a more productive day I feel, even though I know the documentation is productive, so here are a few images of the installer GUI (see below), I've almost finished the install section (there are also uninstall, update and modify sections to add, I'll be sharing the code with Pycraft in the next developer release, Pycraft v0.9.4-2.) the installer will be published to PYPI separately, so that you can easily download the installer and update it, it will also be added to the Pycraft repository with an update to the repo detailing how to use the project even through there are details of each section in the installer. The installer will first check for a local I stall of Pycraft, if that's not present then it will attempt to download the project from PyPi (and clean up any unnecessary files), and then move the project to the user's install location, from there the additional modules the project requires will be added, and then the options to add shortcuts to the projects as well as any additional steps I've missed, this is the most complex step, with the option to install beta versions/install a custom version, phew I think that's everything, with the way I write code, I'll get the code working then keep issuing updates and going over the code simplifying the process as I add new features, the documentation writer #1 was well over 125 lines long, then the documentation writer #2 is just over 79 lines long, and generally better.

Image description

Image description

Image description

Image description

January 4th - 2022

I've been working on the installer today, I've very nearly finished the install section of the installer (I can see this getting complicated), I will need about an hour tomorrow to finish that section, files can now be installed I'm just at the stage where I need to move the files to the directory the user has specified and then I'm about finished with that section, once I've finished the installer entirely, I'll be going back to the documentation (I might alternate a bit between the two) but I'll be going over the installer making some graphical changes too, once Pycraft v0.9.4 is released, I'll be going through and publishing the installer and Pycraft in different PyPi projects and adding the beta versions as well so they are available to download I've also been working on the resources for Pycraft, the grass texture and skybox image will be changing in Pycraft v0.9.5 to make way for the weather and daylight cycles and because I feel they are too 'harsh', especially the grass texture. And I've also continued my ongoing work on the music behind Pycraft but that's a long way off yet!

January 5th - 2022

For Pycraft today I've been working hard on the documentation, as well as the installer for Pycraft, and I've also been working on the music that will one day feature in Pycraft so for the documentation I've finished well over half of the game engine now, it's a lot of work that goes into the documentation and progress is slow, but with the way I'm writing it I'm speeding up the process considerably, but to more interesting progress I've also been working on the installer, not making much progress on the next stage (I've finished the install section I'm now onto the update section) but have instead worked on polishing rough edges on the work I've done and reduced the number of lines slightly Because it will be added to the documentation for Pycraft v0.9.4. In addition, I've added a GUI that asks for where you want to install Pycraft. In addition to all this I've been working on the music for the project for a much later version, a change will be made to the way music will be loaded, it will be streamed instead of loaded at once because the music will be longer than the sound files usually. This change hasn't been made yet, or will be made in Pycraft v0.9.5 but more likely in a later version in addition once the installer is complete an amount of time will be spent changing the structure of the PYPI files for Pycraft (which will be time consuming), so that the installer works, and the installer will need updating with every version of Pycraft I think too, but the installers performance won't be fully revealed until it’s released with Pycraft v0.9.4 which will be scary

January 6th - 2022

Today saw more work on the installer, there were a few issues with the background to some of the labels and elements in the tkinter window, those have been fixed and the window appearing unresponsive has also been rectified with a small animation in the sections where a lot of the work (installing/moving files) is done behind the scenes, and in addition there have been some huge changes behind the scenes and now the files that are downloaded are moved to the user's requested location which is asked for in a new menu, in the install sections current state, I would be close to being happy to release that section publicly, but the code added and changed today will need testing first, especially considering the more fragile nature of installing and moving around files. In addition, the moving of folders through the system has been a nightmare to program in, especially when we have to get the file path from the details of the pip command in addition to all that I've been working on the music.

January 7th - 2022

Today saw the release of a preview for the "forest theme" track with an image I was shared with from a colleague, I hope you like that! In addition there has been more work on the installer, there are ~15999 errors that can occur during the installation process with interacting with windows, and whilst most of those are very rare, I'm working on addressing some of the more prevalent ones (like trying to delete a file whilst it's open, or deleting a file that doesn't exist), and I'm going through some of the ones that are most common, and adding ways the program can try to fix this, as well as this I've been working on the graphics for the installer and integrating the installer into Pycraft during the install (they will install as separate PyPi projects, probably: Python-Pycraft and Pycraft-installer), and the last one installs the other, but they both need to be separate because they need to be installed and updated independently, and this won't replace the (.exe) files which I'm also working on a fix for, as well as a few others. The installer is a very complex and delicate program and I really want to make sure that everything is perfect because of how badly it could go wrong if it’s not done correctly (and the program will ask the first time it needs to use a "permission", like accessing the Internet or moving files, which you can deny too)

January 8th - 2022

Today saw a huge clean-up of the installer, I have condensed the project so it's over 100 lines smaller, added more subroutines to break the process down and reduce the size, and am now going through and making sure all variable names are appropriate. The install section of the installer is now complete, with the addition of the final finished section of the GUI, there is some small amount of additional work needed to record some settings, but that will be done tomorrow when I start integrating the installer into pycraft tomorrow, it’s a very complex project and I want to make sure that it is right the first time around. One more thing there is an issue with the colour of the background of some elements of the display appearing slightly pink, but I'm not too concerned about that, it'd be nice to get a fix for that but I'm not going to delay development for that, and I don't think there is an easy fix anyway the plan for tomorrow will be to finish that section of the installer, get the installer and pycraft v0.9.4-2 (the 3rd developer release) ready and aim for a release if I can, but then I need to spend some time getting the developer releases to PyPi and running tests on uploading new versions and so compiling the project to the (.exe) format, I will also be sharing my discord profile tomorrow if anyone wants to have a text chat if I can get through a good chunk of that work tomorrow also I've shared more music files to the GitHub repository, but will need to make some changes there because the README is getting a bit long, so I'll be breaking it down and adding some of the larger sections into their own file and create a table of contents.

January 9th - 2022

pycraft progress update time, today saw lots of testing of the new installer, and I'm very close to finishing it off, there is one small issue with attaching PIL (or pillow) to the installer, I'm debating whether to attach the files manually (which is a bit of a pain, and the solution I was originally planning to use) or attach wheels to the installer, so we don't have to download anything, this is because we load an image to the side of the GUI, but I will be deciding tomorrow what to do there. I've also been working on getting the installer onto PyPi, this won't happen for a while yet, there are more sections to make still before it goes online there, but I've also been working on the README and documentation as well, getting ready for a release of Pycraft v0.9.4-2 in the next few days, once the installer is finished, and the documentation written then we can move onto the next version of pycraft which will be much more exciting I've also created a Discord server for pycraft where we can communicate and collaborate and share ideas, feel free to post whenever and I'll be checking for any posts regularly, as well as posting progress there, that does not take away from the content here in any way I've also (lots was completed today) been working on the collision detection as well, and I'm very pleased with the progress made there, if the player is not near the item they can collide with, then the game will reach a glass ceiling at 12,000,000 FPS if there is any GPU that can push the project that far (a GTX 1050 can reach as high as 8,000 FPS at present, that's all I can remember off the top of my head), but if they are near the object that has collision detection enabled, the game will hit a glass ceiling at about 329,000 FPS, again that's a lot of headroom, especially considering that's when detecting collisions over a 30 million point object, although I must stress this is in a situation without a lot of the game mechanics but those are handles on the GPU, the way the game works is that it is very CPU bottlenecked, so if there is any CPU processing then it only runs on one core of the CPU unless it's multi-threaded, which no function in pycraft is at present, although there are additional threads the program uses in some situations, but the program can use all of the GPU. So a device will be very likely CPU bound, so we do as little processing on there as possible that is not in a thread, so that the GPU can really do the majority of the work but we do things like collision detection in separate threads, as we do almost all CPU based tasks, because if we did them in the main thread, then on a "typical" system the GPU would have to wait around for a long time whilst the CPU does processing which was partly the issue with the reduced performance in the old engine, in testing a Ryzen 3000 CPU could be paired with a GTX 760 and that would be a balanced system, that shows how bottlenecked the project is on the CPU, so there is a lot of CPU tasks we have to do in threads to make sure that it doesn't heavily slow the program down, but I'm very pleased with the performance of the game engine and more work there will occur in Pycraft v0.9.5, also I'd like to say that all of the images and sounds used in Pycraft are free and open source, they are of my own design unless they are specified in credits and you are welcome to use those in your own projects!

Thanks for reading folks!

Discussion (0)