Wednesday, 25 January 2017

Blown away by Visual Basic

I've been in a stuck phase with my regular projects so I thought it could be funny to write a roguelike (what else?) using Visual Basic, you know, as a joke.

The current version of VB is something I did not expect. It's no longer that old, dumb language where you wrote code for Windows forms. It's a cool programming language built on top of a procedural past, but somehow seamlessly includes modern features (class being possibly the most important). Everything seems to work smoothly so you start to wonder why C++ can't be like this.

The only strange thing is how VB is managing resources. The reference/value system is automatic, some things are always references and others are value types. I guess it works somehow.

There is a problem with Windows console project which is that it's really slow. I think debug mode has something to do with it, but it should be faster. However I've found out that when you set the color of a character it's possibly the slowest thing you can do, so when you draw the level you can set the color (character and/or background) only when it changes.

The syntax of VB is quite verbose which I like personally. It's easy to write code that doesn't really need comments to understand what it is. The language doesn't seem to have ambiquity that C++ has. For example Sub never returns anything, but Function always does.

Saturday, 31 December 2016

Incomprehensible ruins

The wall class works fine in the task it was created for, but I did try some experimental stuff by creating walls starting from even coordinates (to avoid wall created next to each other). This is how it looks after filling the level (which for testing purposes is just the lighthouse beach).


Let's point out that it doesn't look that great as a maze and also I think it could create closed areas, I guess. But maybe it could be something useful when creating ruins with larger grid. Only some walls would remain from what once was a great civilization.

The plan for now is go through each level theme and add whatever they require. I think it's a good plan. Testing for level scale (now that levels can have different sizes) has been fun, when you see how the generation routine fails to work in both too small or large levels. Teemu is also a nice project in a way that there is almost certainly something you can add to level themes to make them just a bit more interesting.

Tuesday, 27 December 2016

Wall object and an idea

We all know rooms are an important part of a roguelike experience, but what about just walls? I was thinking how to create a smaller room inside a room and in the process broke down a room to individual walls with a starting point, direction and length. Also with optional door placed somewhere along the way.

Then as usual for roguelike developers I had an idea. What would happen if the wall object was created with checking if the door is in valid location (empty space on both sides) and then you would just create a lot of walls, possibly even with a backtrace routine to clean a wall that fails to create properly (wall object is such a small part that it could save the previous tiles under it).

I guess it's just going to create some kind of boring maze. But it's probably an idea I'm going to test when I get the actual work done with rooms. Who knows it could be an alternative option to the current maze routine which seems to have similar problems as it's quite boring. It's difficult to make interesting labyrinths with "strong" algorithms.

Thursday, 22 December 2016

Scalable level themes

I'm working on level themes now that levels can be resized. Detailed version: Each level is created as an empty version (not yet randomly constructed) in the world structure. At first I thought remaking level would be as simple as deleting an instance of level class and creating a new one. However that was not an option, because stairs structure (connections) are stored per level when the world structure is created. So, I had two ways to handle remake. Either tweak world structure or create routines to clean the level class and then remake it. Cleaning the level class was easier than I thought and also I was able to use cleaning and reset routines in constructor and destructor safely.

First and obvious test for the scalable themes was the island where the player first lands when starting the game. I went for conservative 60 to 100 tiles size which seems scale quite nicely, although bigger levels start to reveal the primitiveness of the island creation routine. The island is constructed from couple of ellipses randomly on top of each other to make them look less "ellipsy". Then I had an idea to really test the creation and punched in 500 tiles size. This is what happened:

The main island is still working as a structure, but the north island goes bananas. I have no idea why it does that, maybe I could take a closer look at the routine. It is a bug that doesn't appear on smaller map sizes. Also, 60 tiles seems to be a minimum size to fit everything required on both of the islands. It would also break in smaller sizes than that. I guess it will be an interesting journey to check out all different themes to see how they work on both ends of the scale. I'm a friend of small levels, because from tactical and navigation point it doesn't bring anything useful when you make bigger levels. If anything they can look boring and become tedious to explore.

Sunday, 18 December 2016

Creating a RPG system

Teemu is finally moving from a simple HP only stat to an actual RPG system. It's going to be really simple and fitting the theme of Teemu which is quite wacky game in a non-serious way. The system is not directly based on any other systems that I know, but it's similar to many systems where 'stuff' is derived from couple of basic stats.

To help visualize the results of basic stats I have programmed debug functions to show what happens to things like hit points when you change the basic stat values. Stats for creatures start from the monster family data, then possibly adding special monster data. The by-product of stats is that you can introduce player characater classes at the same cost, so it's going to be fun I think.

Creating a RPG system is not easy in my opinion. Even a simple system like this requires a lot of balancing which mainly comes from playing the game and actually watching what happens, rather than trying to figure out a theoretic model for the system. I guess it could be possible, but it may be too difficult to program for what it is. The rest is left for random factor which can hold a lot of weight for the game designer.

Other than that I have started to change the static level size data to dynamic sizes with each level of theme having different size. Levels of a theme were always the same size in previous version which is not that bad, considering that in most old roguelikes levels were fixed to one size. I think many theme generation routines can already handle scaling quite nicely, but it's still early to know it.

It could be also nice to change the automap in a way that you wouldn't know the size of level by checking out the automap size itself. It could be then possible to add a number of secret places on edges of the level without the player never knowing for sure they exist.

I have a good feeling about development of Teemu and it really doesn't require that much work to get to the next release version. I know what I have to do which is also making it easier. The hardest part is sit down and through it.

Friday, 23 September 2016

SDL2 in OSX with CodeLite

If you are searching for information about things in the title I'm sorry, you wont find anything helpful in this entry. It looks like no one ever set up a SDL2 project on OSX using CodeLite. This far I have managed to install CodeLite. Then there were missing "developer tools" which can be installed typing gcc in terminal. OSX will detect if gcc is missing and asks to install developers tools.

I have SDL2 installed, it's in the Library as something called "framework". For some reason I can compile a large project with number of SDL2/SDL.h references, but the linker fails which I guess means something, but what. OSX can't work things the simple way. As far as I can understand you can't show the compiler and linker where SDL2 files are, it has to be done with "framework". I just don't know how, there is no such information on the internet. Yes, call the internet, I'm asking for that information.

Although, even if I can't run the project I can prepare the source code for OSX simply by making sure it compiles. But I'm going to continue the painstaking research about SDL2 + CodeLite + OSX and if succeeding pass that to my cv when I'm applying to fucking NASA. They will immediately hire me, because it's harder than rocket science.

Wednesday, 14 September 2016

Updates

I think my PC survived the notorious Anniversary Update of Windows 10. In fact I updated it manually, because the older version started to have that annoying 50% cpu updater loop problem. I hope Microsoft would just fix that problem, because it seems to come back on regular basis. It's a bug that prevents the Windows updater from updating and it was introduced I think after Microsoft first released Windows 10.

Also updated Teemu from VS2010 to 2015. It was surprisingly easy, I just had to copy SDL2 stuff to VS directories. It's the way I have always setup SDL, just copy include and lib stuff to the compiler's directories.

VS2015 is not that bad. It's a little bit slower than 2010, but it has more modern C++ compiler and I think W4 warning level works nicely, although it doesn't seem to catch all similar code for warnings which is weird. At first it was annoying to adjust "space rules", because there are lot of them for no good reason. It should have been an optional feature for those who wants that kind of stuff, not something you have to turn off one rule at a time.

I'm again trying to proceed in Teemu and it's possible if I try to keep the current technical implementation and concentrate on the game design.