Pycraft progress report!
Tags: python, gamedev, opensource, programming
Published: 2022-11-14 18:53:23

Hello there everyone!

It’s been another busy week in Pycraft so this is an excellent time to review all of the progress we have made in – and also out – of Pycraft!

To start with we have finished the next article for Pycraft, this article was originally indented to focus on the settings menu changes, but also now looks at the full restructuring of Pycraft. As such it is almost two articles in one, and longer as a result and we have spent the last few weeks writing that up. This article, although now finished, hasn’t been released yet as we want to try and reduce the gap between that release and the release of Pycraft v9.5.5.

Having now finished the article for Pycraft we can focus our attention back to testing Pycraft, this is a huge task. Normally when we test a developer release, we focus on testing the features we have added and changed, and then do more of a generalised testing stage before the final release, however, so much has changed in Pycraft that we are rigorously testing everything. We want to make sure that the changes we have made in this update are appropriate and functioning as we will be building off these features in future updates to Pycraft.

Because of this we are making sure to be as thorough and rigorous in our testing as possible and that does unfortunately mean that this is taking some time, however we want to make sure that when we release this update to developers it is as stable as possible. Additionally, over the last few weeks we have been improving the use and quality of docstrings in Pycraft, our goal is to give every class, procedure and function its own unique docstring. This information will be added to documentation coming early in the new year. Every subroutine must have its function, inputs, keyword arguments and outputs listed as well as their data types and a description of that that variable does in the function. Shown below is an example of the structure of how we are adding in docstrings to Pycraft, this is for a simple adding function (this isn’t a function in Pycraft):


`This function adds up the two arguments given and has the option to print the result to the console.`
`Args:`
`- number_one (float): The number that the second argument gets added to.`
`- number_two (float): The number that gets added to the first parameter.`
                
`Keyword Args:`
`- output_to_console (bool): Controls if the result should be returned to the caller and also outputted to the console, if ‘True’ is given, data will be outputted to the console. The default option here is ‘False’.`

`Output:`
`- (float): The sum of the two arguments given.`

So, this week we have been improving the application and quality of the docstrings like the one shown above, as we try and make Pycraft more assessable to developers. We have also been extensively testing Pycraft v9.5.5 and look forward to releasing it in early December, provided that nothing major pops up between then and now!

In addition to this we have been shared some prototypes for the UI design of the save and load games functionality for Pycraft from another developer of Pycraft. They have been attached below this article and in the first image you can see the ‘instances’ UI this screen allows you to have two different instances of the game saved, so – and we expect this to be the most common application – you could have a normal and a challenging mode world which you can switch between (more on that later). The names for each ‘instance’ are not fixed and can be renamed, although for demonstration purposes we have left them at default.

When you click on the instance you want to load it opens to another UI that allows you to choose which save you want to load. This follows the same design principles (which we talk about in the next article for Pycraft). The number of saves and autosaves varies depending on which mode you’re in (normal or challenging):

In normal mode, you can have 3 saves and 4 autosaves.
In challenging mode, you can have 2 saves and 3 autosaves.

Each save or autosave will contain the identifier of the save at the top, then below that the time and date the save was made and finally the in-game location that the save was made in, so that you can easily identify which one to load. There isn’t currently an image preview to go along with the save although it's something we may add in future.

Now we have talked about this ‘challenging’ mode a lot, but what does it mean? So, by default the game will load in normal mode, which has the default game mechanics and behaviour. However, when creating the ‘game instance’ you have the option to increase the difficulty to ‘challenging’. This cannot be adjusted after you create that instance, without deleting your instance and making a new one. The ‘challenging’ mode changes some game mechanics to make the game harder, for example increasing the base health and strength of mobs, weakening the protection given from armour, lowering the value of in game currency (so an item that may by default cost 16 units may now cost 24 units or something to that extent), reducing the value of food in game. Challenging mode will not affect the mechanics of bosses or add or remove any features of default mode but may modify them.

This concept of having saves in game is coming relatively soon, in Pycraft v9.5.7, before the benchmarking overhaul which is Pycraft v9.5.8.

Attached below are some visual highlights from the last week of development!


![The 'instances' screen to Pycraft, where you can choose between two different instances of the game](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xt7vt7pwz5tyw8z9qh0l.png)


![The UI for choosing which save/auto-save to load](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tdqu96hthakuwxioaz1k.png)

![The 'instances' screen to Pycraft, where you can choose between two different instances of the game with the bottom one being the more challenging mode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gj28rklbw92590mmh48y.png)