GameDev 2019 Week 16: Editor Improvements

Better Model Selection & Placement, Performance Improvements

05.05.2019 - 13:51
Monday 29.04

Over the weekend I let my Raspberry Pi Camera run for a longer period of time and I noticed a few things that could improve the overall performance. I added graphs to show the threshold and its adaptation over time, I lowered the target threshold for the adaption, so it's a bit more forgiving to wind and I increased the frequency of threshold updates. I let if run on most days of the week and it has improved a bit, there are still too many wind images, but the most effective change would be some kind of lighting invariance, because when there are small clouds covering and uncovering the sun, it is detected as a change, I need to look into that. But, it is time to get back into game dev and to get back into things I created a model in Blender to be used in other maps.

Tuesday 30.04

For some of the plans going forward I need or at least want a different map. One of the most important features of my map editor, the selection and placement of models, was quite bad in my opinion. There was only a dropdown list with all the model names and you basically had to select everyone and hover it over the map to see what it looks like. Granted there weren't that many models and I made all of the by myself, so I knew how they looked, but as time goes on and more models are added it would get pretty messy and my dropdowns cannot scroll, so once there were more models than the height of the screen if would be game over anyway ;)
I added a completely new model selection window. The models are now large buttons with an image of them on it inside a scrollable container. The selected model is also shown with its image and the model options are below the container. When I created my model template system in my engine I intended to have the ability for preview textures and the variables were there but I had never implemented the creation of these textures. So I had to fill it in and I also added preview Images, because just a texture with the model wouldn't look good on a button, because it wouldn't have any hover effects. So instead I use preview images and create the button textures with hover effects from them. I also had to add a grid layout for the container, so I wouldn't need to calculate each buttons position individually. And finally I added a vertical position setting for the text on buttons, so I was able to align the text at the bottom.

Wednesday 01.05

Having all the models in the container is nice, but again, once there are a lot of model it gets confusing. So I added a dropdown and a seach box above the container, as you can see in the image. Implementing the search box functionality was quite easy, all I had to do is find all model names which match the input and only show the buttons of those models. The grid layout is implemented in a way, that it ignores all invisible components, so just reapplying the layout produces a nice search result with only the matched components in the container. The model categories are a bit more complicated, because I need to know which model belongs to which categories. I had to add a list to the editor which stores that information and I also changed the asset list file, which has a list of models, that can be loaded all at once. It can now also store a list of categories for each model and when it is loaded the model gets associated with these categories. When a category is selected the container checks the category list and only shows the models in the category. I also fixed a through scrolling bug in the container, e.g. the camera also zoomed when scrolling, and added a scroll speed option so it can be scrolled a bit faster. In the evening I went on a bit of a model making spree and made three models.

Thursday 02.05

The model categories are set in the asset list files, but once the models are loaded into the editor and the editor project is saved and then reloaded, the categories would get lost. So I had to save the model categories in the editor project files too, so they can be restored when the project is loaded again.
Another feature in the editor that was particularly annoying was the editing of models after they were placed. It was only possible to alter the values in the window that popped up. As a first improvement I added hotkeys for all transforms, e.g. s for scale, r to rotate and g to translate ( blender uses g, and I don't want to learn new hotkeys ^^ ).

Backface Culling

Backface culling basically removes the backsides of all triangles, a triangle is only rendered when the camera looks at its frontside and if the camera rotates to the back of the triangle it is invisible. If a model is closed, all the frontsides of its triangles are facing outside, so culling the backface is fine, because it can never be seen anyway. However, some models have planar elements to them, like the leaves of a palm tree for example. In that case, looking from below or even from a semi low side angle, you would see the underside or the backside of the leave. If backface culling would be enabled for the palm, the leaves would be invisible from that angle, which would be rather weird. So far I had backface culling disabled for all models, so it wouldn't case a problem for planar model elements. However, enabling backface culling is a significant performance boost and I would like it for the none planar models. Therefore I added a new option to the editor to toggle the backface culling per model, like it is also possible to toggle the shadow casting per model. And as expected the performance greatly increases when there are a lot of closed models with backface culling enabled. And yet another change to the project saving and loading because that value also needs to be saved. And unlike the model categories it also needs to be exported, so I also had to change the map exporter to support per model backface culling.

Friday 03.05 & Saturday 04.05

I started to expriment with water texture creation, because I want to improve the look of the water. I need a texture, a normal map and a dudv map that all fit with one another. I tried sine based pattern, which have the advantage of being very easily tileable due to the periodicness of the sine function, but they didn't really produce the result I was looking for. Then I started to look into some noise based solutions, but I haven't got any good results yet.

by Christian - 05.05.2019 - 13:51


Social Media:  © 2020 All rights reservedCookiesImpressum generated in 7 ms