Thursday, 5 December 2024

Bricking Brick with SDL3

Decided to switch Brick Atelier to SDL3 from SDL2. One of the reasons was that SDL3 now has a native file dialog function that removes the need to include windows.h and use a weird hack to call the windows file dialog. SDL3 has changed quite a lot, both function and define names have changed. In Brick Atelier it was possibly harder to migrate, because it's using several event loops etc. But I got there in the end and the file dialog is working, too. It does require an event waiting loop and some funny programming, because it is a callback routine.

However the worst change in my mind was moving from int-based rectangles to SDL_FRect and also mouse coordinates are now float. I guess there is a technical reason for this because GPUs are using float coordinates presumably, but it has been a total chaos in int to float conversions. I am going to fix them all, because I don't like to leave that kind of type conversions, but it takes some time.

I can now compile Brick Atelier in linux I hope, because it no longer requires windows.h. I have not yet tried it, but it should work. Other than that I try to code some difficult features like moving the brushes in the brush pad and also rotation. Some of these features are surprisingly hard to implement, it's no wonder why there are so few drawing programs.

Christmas is getting close. I don't like it, but for family reasons I have to get presents and all that annoying stuff. Christmas is a resource hog, so much crap is produced. I try to figure out presents that are practical and have some kind of use. What I wish is world peace for Christmas.

Tuesday, 19 November 2024

Switching to SDL3 in midlife crisis

Started a new game project where I'm going to use SDL3 to learn it at the same time. This time the game is not going to be a roguelike, but something much simpler. It seems that SDL3 is more like SDL2 compared to switch from SDL1 to SDL2, but some things have changed. If I saw correctly SDL3 has a file dialog which is great news for Brick Atelier.

I think I have a midlife crisis, after all I'm 50. It's like depression with anabolic steroids, because no matter how much you would like to think things are going to get better, some things can't, it's game over. I did have depression when I was younger, although it was never diagnosed. The way I kind of got rid of it was funny, but it's a story for another day. I guess becoming depressed is a personality trait, but in my case I never went too far with the depression, even though I had all the reasons to do that.

To add insult to injury I got my first reading glasses this summer, or was it already in spring I don't remember. My eyesight is not that bad, I can still read text from monitor without glasses, it just looks like there is a outer glow effect in the fonts. But it sucks to have glasses when you always had a great eyesight. Yes, it could be worse, it always could.

The situation with Teemu is fine I guess, it's going to be the first one to be released at some time. As always the role-playing system mostly needs some work, at the moment it's really difficult to kill monsters, because hits don't remove enough hit points. There are lots of ways to fix that, but it's more difficult than you would think.

Wednesday, 17 January 2024

Double trouble

Teemu 1.3 is in testing phase mainly, not much to change in gameplay, although there are some things still unfinished. I wrote a python script which successfully compiles Teemu in both Linux and OSX, although in OSX I had to compile and setup SDL2 from the source code which was tedious, because the wiki doesn't really tell the proper setup information, which I found from a random youtube video as always.

After testing Teemu in OSX and Linux I learned after 15 years of using SDL2 that it has a double buffer drawing. For whatever reason my Windows 10 PC which is my main development computer the second buffer always had the same data as the first, so I never noticed it. This means that all my carefully crafter drawing routines has to go and replaced with routines that make sure the entire area of the screen is always redrawn every time.

Luckily Teemu has extremely simple graphics routines so there isn't that much to rewrite, but some things need more graphical approach since it will be slower to use text output to draw background stuff.

I know some may be wondering how the source code compiled in different platforms. It was quite hilarious, because there were no errors, only couple of warnings. Linux gcc found one extra warning (I used -Wall) and OSX found two other warnings. Not bad.

Tuesday, 4 July 2023

Brick Atelier 0.87 released

You can download it from here:

https://www.kriceland.fi/brick/

The release had some last minute issues like when I was trying to remove the console window from SDL. The solution is indeed change the project type to windows application and just use regular main function with SDL.h included, because it's taking care of that with a macro.

This release is not perfect, there are some bugs and missing features. Depending on the amount of feedback I possibly get (there may be none) it could be a motivation for faster release cycles, but we'll see. I don't expect a huge success for this project, because it doesn't have many of the basic features that other pixel software has.

I also feel like I don't have to focus on Brick Atelier for a moment and I can now maybe choose another project for release crunch.

The idea of class library I was talking about last time was a bad one. It's just because how C/C++ "works" in that area. Otherwise it would be a nice dream to have shared source code in multiple projects.

Monday, 19 June 2023

Class library

I've had this idea about creating a shared class library for my main projects. Today I just did it, but it was not what I expected... I started with Brick Atelier, because it's an "easy" project to fix if something goes wrong. The way you create a library and add it to the existing project (or solution) in Visual Studio is quite easy, but I already have something to think about.

Some classes in the planned library are using SDL2 which I guess is easy enough to add in the library, too. I'm just wondering is there any complications in the way sdl's .dll is used. Because if you create a static library, does it require SDL also to be statically linked? One way to find out that would be trying it, but I'm in the process of crunching Brick's next release version. Then again, I think SDL2 can be statically linked, it no longer has that restrictive open source license, I think.

It is possible to keep the class library free from SDL2, but it does require some changes and also there are lots of SDL2-using classes that could be included in a library. It was a bit of a surprise that I was only able to move two files (with couple of classes) in the class library... but if you just plan it more like a library it could be possible to externalize quite some lines of code.

Tuesday, 13 June 2023

What is wrong with Sweden?

This is the second and probably the last time I order from a swedish art supply webstore. My first time experience wasn't that cool, because they left out one item. However when I contacted them they offered me a discount for that lost item. It was a bit of a mystery how they didn't ship it, because the order was not large, but it could have slipped through the package which I think was poorly designed.

The second order arrived today and weirdly enough they had changed the type of package which didn't have any holes by design, but someone had still punched through the package! Luckily the items were covered by two layers of paper so nothing fell through this time. But you have to really try to damage it when it has a hole of that type. Sometimes you see stuff like that happening inside orders in Finland, but it's very rare. I would only guess the swedish package delivery is not that great, it's more like most countries in the world.

Anyway, I got some japanese Kuretake water colors and a brush which are hard core. They seem to be high quality stuff, but I have not tried out them. Now I have to paint something, even though I have a bad habit to get art supplies and never use them... I just like that stuff.

I try to get back to Teemu and make it my main focus. I have an idea how to handle the RPG system and I hope it works.

Thursday, 8 June 2023

It's so cold

The beginning of the summer has been unusually cold in Finland. This is a cold, almost arctic country, but we usually do have short but relatively "warm" (around +20C) summer compared to other seasons of the year. But it's certainly not here yet, today it's +9 and last night was even colder. It's raining, so the sun doesn't warm. It's quite brutal, because most people have already turned the heating off. I'm wearing my trustworthy norwegian wool socks I got as a Christmas present couple of years ago.

I'm working on Legend of Saladir, trying to fix stuff for a release. I still don't know what the original author is thinking about this, because I have not asked yet for permission to release the source code which is already remarkably different than the original one. The state of the source code is ok, but I really have to code a new inventory routine to replace the old one which I simply removed completely, because I could not refactor it. Sometimes it's better just rewrite it, if you know what the thing does.

I'm actually thinking about finding yet another roguelike project to work on.