Tuesday, 20 March 2018

Follow The Prowler on Github

The procedural style project I've been talking about is The Prowler (project name). I decided to put it on Github:


Although it feels like I entered a rabbit's hole when introducing myself to Git. The process is automated in Visual Studio, but one thing I've not managed to figure out is how to remove .sln and .vcxproj files from the repository. When I look it seems I wrote vxproj to .gitignore, so there is one error. But .sln is in it and VS still wants to include it in the repository. There doesn't seem to be possibility to remove project files from VS project (which does sound a bit weird) same way as you would 'exclude' a file from the project (not in the project, but still exists as a file).

I guess it's ok to include project files for those who use Visual Studio, but if I study git for 34 years it could be possible to learn how to remove those files. It sure feels that nothing comes easy when talking about git, an open source... thing.

Now I begin to understand why open source developers never get anything done. They are just wondering all the time how to do something simple and trying to figure out the exact proper sequence of commands to use.

Wednesday, 14 March 2018

Modules with procedures

Experiences so far from a procedural C++ game project have been somewhat interesting. It's divided into modules which at the moment are Datatype, File, Function (for generic functions), Gui and the main module. Most of the code is in the Gui as you would expect. What I have learned is that procedural code seems to be "shorter" than writing classes, but it looks strangely messy. Maybe it's just that I don't quite know how to write clean looking procedural code.

Another interesting part is the Datatype class where I made a decision to use inheritance which may sound weird in this context. I'm using as much inheritance as I can, for example Rectangle class inherits from both Point and Size classes. And I have a feeling this is how I should have done this in the first place in my other projects as well. Using inheritance in this kind of limited context is easy and doesn't seem to have any problems this far. I had to name generic "Set" functions for Point to "Locate" and for Size "Resize" which is I guess better way to describe them. Using inheritance avoids repeating type of data and code for datatypes.

The graphics engine which is less than 300 lines of code in Gui can already display everything it needs: background tiles and letters with different colors. The next step could be the division of screen to three areas: gameview, message window and stats window.

Sunday, 11 March 2018

My 7DRL plans

I think there is 7DRL season going on at the moment, I'm not sure. While I'm working on my main three projects it could be "fun" to write a smaller game. The problem you have with larger projects is that they become less and less manageable which is something that just happens. For a reason.

I do have a fun plan for this "7DRL" project in which I'm trying to write C++ with procedural style (also known as C) but with some classes where they are the most logical solution. The code is going to be more "modular" as more functions can be stacked in one file, rather than C++ style two files per class.

I wouldn't do this without a great idea for gameplay which I have had for couple of years. For simplicity I'm going to use ASCII graphics with SDL2, similar to what I have in Teemu. In fact I'm probably going to use Teemu's GUI (+fonts) and change it to procedural style.

Another reason I'm doing this is that I really need some time off from my large projects.

Sunday, 18 February 2018

Language design: class

With my limited intelligence I had an idea to start designing my own programming language. There are some examples of the syntax in Roguetemple forums 'My language' thread that has had zero interest. I don't know, I'm pretty stoked about programming languages.

When it comes to really important stuff in a language it's how to manage data with functions and/or classes (or something else). My current understanding about class is that it's a nice theoretic idea which most often simply breaks in real life situations. That's why we have those getters and setters and the class can be exposed or it's not going to be neatly modular piece of code. Also in my experience inheritance is way harder than people think at first.

Functional style has different way to handle data which also is highly theoretic when you think about so called pure functions. In reality most functions are what experts call procedures in that they change whatever data is input to them.

My vast experience tells that both classes and functions have their problems and also both work better in different situations. The obvious question when designing a new language of course is there a way to solve those problems in some way? Or do they even need to be fixed, maybe they simply always exist no matter how you try to prevent them. It's like removing pointers from Java, did that actually fix anything important? Sometimes languages try to prevent the dumbness of programmers and they take it maybe a bit too far.

I've thought about one way to relieve data handling with something called resource block which is a collection of data that can be optionally limited to some classes. This data is like static data in C++ that it's initialized when the program is started, but it could be possible to change it. I'm using that kind of data in my C++ projects all the time, but there isn't any kind of built-in way to handle that data in C++, you have to use namespaces to hide it etc. By the way, I don't think I'm going to have namespace in my language, because I think it's fixing a problem that should not be a problem in the first place.

Monday, 5 February 2018

Code::Blocks 17.12

There is a new major version of Code::Blocks after a substantial amount of time passed from the previous version. It had only one small problem when I ticked off wxSmith plugin during install then ThreadSearch and lib finder didn't work (for whatever reason), but you can fix that without reinstall by removing those .dll files from the plugin directory.

In Windows we have a weird situation with C++ IDEs that there are only two of them: Visual Studio and Code::Blocks. There are others, but they are not that good. I've learned to use both VS and C::B at the same time for my projects. I think it's useful, because both compilers (VC and gcc) find different kind of issues from C++ code which makes it more portable and standards compliant. VC is much more loose about some rules, so it's good to double-check with gcc.

Since Bill Gates left Microsoft the company has been in trouble with Windows, because it's developed by morons, so the same fear is cast over development of Visual Studio. I think VS actually has some problems already, mainly it's becoming quite sluggish and slow in editor UI side. The best thing about VS is the debugger, I think many people agree me on that. It just works, unlike gdb. However I like C::B because it's faster in many things like loading projects and the editor UI is sharp. Since I don't use debugger that much I'm often using C::B.

I think the management window and projects tab could be better with split to headers and source files (for virtual folders also). It would be nice to somehow tag files (and folders) with different colors or other ways for various reasons like showing unfinished files with red color etc. Then you could show/hide files with those rules. I actually suggested this to the developers some while ago, but they didn't get it. Or as typical open source developers they just refuse to listen any feedback and ideas.

Thursday, 1 February 2018

The daily maze news

The maze routine itself works, but it has to match in the rest of level creation. The way I accidentally solved it in the labyrinth level (the only level using maze for now) was make the maze routine "continue" from itself, the tiles it has created in previous "hives". A hive is one instance of maze diggers which are the corridors of the maze left by replicating diggers.

Sometimes it happens that everything runs into a dead end, usually a digger winding on itself. The fix for that is create hives until X number of tiles created. I found out that the number of available wall tiles divided by 3 gives a good result. The reason for that only roughly 50% of maze area is floors, the rest of it is walls. Not a surprise there. But if you divide it only by 2 it seems that the routine can't fulfill the requirement of mazes to create and runs into an endless loop.

There are some questionable things in this method where I'm first creating couple of rooms and then shooting mazes from walls of those rooms. Most important question: are rooms always connected by mazes? For number of test runs it seems to be true, but I have a feeling it could fail in some rare situations. If it happens it's still possible to check each room for connections and create them later with manual style, but I'd rather wish the maze routine work in reliable way.

Sunday, 21 January 2018


The structure generation of Cornucopia is ready, but still needs some tweaks like room types and interior generation. Maybe the smallest room size could be 5x5 rather than 4x4, because smaller rooms tend to squeeze themselves into strings of rooms which don't always look that great.

The green rectangles are yards. It's a feature that can come after a room (as the yard of the room) or as first feature. I think it's a rare, well, feature in roguelikes to have yards in the dungeon.

After those tests I added two different room types randomly to make it more colorful and it does work quite nicely, when you have more room types than just one. At the moment there are only three features: room, yard and corridor, but I think it already looks nice. The interior is more important than the "shape" of the feature anyways.

This routine is probably going to replace 'small room' routine used in various level themes and I like the idea of "layered" generation starting from basic dungeon and then adding stuff like this.

If there is one thing that bugs me it's that backyard in bottom right corner of the screenshot. It doesn't seem to have a door connection which could be some kind of rarely occurring bug. So maybe it would be wise to create important stuff like stairs only to the basic cave area.