Changing AA lead to a crash

Alpha 5 has a bug that is responsible for almost half of its crashreports:

aa_crash

Stack trace of the crash

For reasons, Windows does not allow to change windows pixel format more than once (something about it being more complicated than destroy and recreate the window). These are rules of the game and this is fine. How does it affect Knights Province? Well, changing AA mode required to recreate OpenGL context, which in turn, required to reset the pixel format, which, when performed on the same window, caused an error. Unluckily, due to being non-modal, displaying that error dialog caused the underlying window to repaint itself, which triggered OpenGL context recreation once again (since it was missing) .. And now the code started to repeat itself, causing less-than-informative EInvalidPointer exception, since some things should not be used twice, especially in such manner.

The bug did not reveal itself before, because the only change that required recreation of OpenGL context was toggling the game fullscreen. Fullscreen toggle is special, because it recreates the window behind the scenes, thus always providing new “material” for which new pixel format could be set. AA is another such change added in Alpha 5.

I was able to recreate and fix a crash that was happening on changing AA (anti-aliasing) mode, if that change was made without toggling fullscreen mode. Hopefully that is the crash that was plaguing Alpha 5 for the players that have sent me their crashreports. Thank you guys for sending them in, they helped a lot!

Alpha 6 is around the corner, bugfix will be there. Hopefully without many more new bugs 😉

P.S. For now, workaround for this crash is – when you want to toggle AA, always toggle fullscreen mode alongside.

Posted in How things work | 10 Comments

Warriors got icons

Spent today’s morning making missing icons for warriors:

everyone-got-icons

Citizen icons got tweaked a bit too. Shoulders got wider and pose became bit more self-confident.

Posted in Artwork, Live progress | 2 Comments

Experimenting with terrain

Been experimenting with new terrain types and transitions yesterday:

2016-02-22 terraced mountains

2016-02-23 experimenting with terrain types

Not sure if they will stay like so though. I plan to update terrain rendering in next versions (to add support for textures among other things).

Posted in Live progress | Leave a comment

Reorganized menus

Posted in Live progress, Video | 3 Comments

Inventarization

Let’s list some links!

Facebook group where I post links to new articles in the blog and sometimes new screens. Subscribe to get latest news!
Google+ group was more active in early days, now it’s mostly empty.
Twitch channel where I stream around twice a month. Come and say “Hi!” sometime.
Recently I have created Knights Province IndeiDB page. Let’s see how it works out.
Youtube channel where I have put together playlist of Knights Province videos I made.

And of course forums where I post and reply:

English: https://www.knightsandmerchants.net/forum/viewforum.php?f=35
Russian: https://kamclub.ru/forum/50
Polish: https://www.knights.sztab.com/forum/viewforum.php?f=17
German: https://knightsandmerchants.de/include.php?path=forum/main.php
I don’t speak Polish or German, so if you post there, please provide translation (as Google Translate often is not enough).

Did I forget anything, where else Knights Province should be present?

Posted in Sidenotes, Site | Leave a comment

Two towns that AI has built

Here’s an example of how AIs build their towns:

2016-02 AI town

AI town

And here’s how winning AI town looks (note the minimap):

2016-02 AI town

Posted in Live progress | 2 Comments

Neat OOP magic

When something comes out too complicated and does not work as it should, being riddled with entangled cross-references – move it into a new class and break all the logic into smaller chunks .. and then magic happens – it all comes our neat and modular and it WORKS! 🙂

Yes, I spent a day figuring out how to rig Skirmish mode setup .. and it works well now! 🙂

Posted in Sidenotes | 1 Comment

Okay, shadows!

Okay, shadows! Those funny dark patches behind objects that sun seems to create 🙂

shadow-blur

One of those “spot 10 differences” pictures

Unlike real world, where sun adds lit areas on surfaces (yep, shadows are places where sun did not create illumination), in virtual world it is the other way round – shadows are added on to surfaces. And done so dynamically!

Being real-time strategy, it implies that Knights Province needs real-time shadows, right? Well, there are basically two approaches to dynamic shadows in games:

  • Stencil shadows
  • Shadow map

Continue reading

Posted in How things work | 11 Comments

AI improvements

Been restoring AI functionality and improving it.

Here’s results of 2 AIs skirmish:

2016-01-24-ai-got-more-dang

Posted in Live progress | 4 Comments

Alpha 5.2

Thanks everyone for crashreports!

Two big bugs fixed and now Alpha 5.2 is out: Knights Province Alpha 5.2

P.S. Still trying to isolate and fix “Exception in script: ‘Integer overflow’ in procedure ‘CHECKVICTORY'” exception happening in mission script..

Posted in Downloads, Live progress | 10 Comments