Friday 29 September 2017

Teemu ARRP Diary 8/3

Working on 'cave' level theme I noticed the list of rooms is not cleared when I re-create the level. It's very strange, because the routine to clear rooms sometimes work, but not always. The problem I guess here is the way I have made portals a "static" part of each level, but I think it's possible to change them. Portals come from World class where they are determined for each level, but they could be copied back to a level instance when it's re-created. When static portals are removed I could then simply delete the level instance and make a new one, rather than trying to clear parts of it.

Cave theme was also changed in a way that 'regular dungeon rooms' are now protected, so their tiles can't be destroyed by paths or caverns which seems like a better solution. Still I try to keep things simple just to proceed to next thing whatever it is.

I think my code is "clean" so to speak, but one thing that could be improved is the way I'm naming variables in member functions. They are probably often too short and not descriptive enough. I have mixed feelings about long variable names, but other than loop variables could be longer I think.

Sunday 24 September 2017

Teemu ARRP Diary 7/3

The null bug was in Get -routine of terrain tile. You would think it's hard to make a mistake in such a small routine, but it is. I was checking the index with 0 when it should have been -1 (out of level). That's why the first (top left) tile was null, but when the debug routine was not using Get_Terrain() it didn't catch it. I tracked it back from look routine which was showing the tile as 'null tile'.

The low level routines work I guess, masks are added to searching (Place class). I'm going through level themes one by one and there are issues with room generation etc. I think there are only two themes that need more work than just simple fixing. I try to keep things simple and work through themes first on terrain level, then second run adding objects and finally creatures.

A kind of "problem" that I run into all the time is that it's "possible" to make things in smarter way, but it just takes way more time than making things work using less sophisticated code. It's important to ask yourself what do you want to achieve in gameplay context and how to do it. If it's really complex stuff then it may be easier to create a complex system for it (in a long run). But if it's not then it's faster and easier to bash some random code and try to keep it bug free at least. Creating a sophisticated engine for anything is incredibly difficult and I think it takes a certain kind of mindset and skills to succeed in creating a coherent game engine that can process everything the game requires.

Thursday 21 September 2017

Teemu ARRP Diary 6/3

The null tile or object is still a bit of a mystery, because I don't know what it is. Not even with a debug routine I made just to inspect tile's contents. The look routine is actually seeing it as null terrain, but the debug routine shows it's a real terrain tile. So I have to check out how the look routine is determining it's a null terrain.

Doorplace search is not working currently. The reason is that the search routine fails without mask data. To fix that I'm going to rewrite the search with mask tiles. But for that I need room masks that indicate the facing of the room, so each four main directions get a mask type. I've find this useful in Kaduria, because once you have set the direction to a wall it's easy to find it later.

I'm in a process of rewriting the room creation itself, because room has to use a special routine to determine the facing directions while it's creating the room.

Wednesday 20 September 2017

Teemu ARRP Diary 5/3

Mask routines are now ready, but they aren't possibly yet used. The routine checking for object creation is including a check for mask. Anyway, level creation works the usual way, but there is a strange bug which has to be fixed before doing anything else. It's creating a null tile at the top left corner of every level. To find out more what it is in first place I really need to write a debug routine to show the contents of a tile.

I wrote a new debug routine to collect "togglers" which have value of true or false. The scope of this project is so small, that there are only two togglers at the moment: FOV and mask map tile, which is a routine that shows the mask tile using a color data assigned to it. That way you can make sure the mask map is correctly created.

The null tile bug can be related to place searching. I could make that better to spot by adding a debug id (for example a piece of text) to each call. You can then spot which routine called the search for list of tiles.

Tuesday 19 September 2017

Teemu ARRP Diary 4/3

The mask data was moved to Terrain_Tile which is a tile of the terrain map in base class of Level hierarchy. It was just much better that way than storing mask data to Display_Map, because it started to get weird with access to Display_Map instance from Level class. Now the data is pretty much where is belongs. It takes more memory, but that's not an issue, because levels spend quite small amount of memory. The data is reset when the save game is loaded, but it's also not a problem, because the mask data is useful only when creating the level.

Today I could try to finish all the routines which actually use mask data. Sometimes using mask is a lot easier than finding out particular terrain tiles, but sometimes you need to find specific type of tiles to create some stuff on them. That's why both systems need to work together. The mask is set using default values for terrain and later when creating rooms etc. it's written over with new values. I find one of the hardest parts of level generation is the way you decide what can be created on a single tile, with often complex rules and special cases.

Sunday 17 September 2017

Teemu ARRP Diary 3/3

Today I didn't get much done. I noticed that there are some problems with generation routines, because a mask data of tiles don't work. Mask value for tile is useful feature which I'm going to implement for Teemu the same way I have in Kaduria. The mask system has two types of masks, a regular type for terrain tiles and room mask which is a number given to a room or other similar type of area.

It's sometimes useful to assign mask values to tiles that aren't that tile's default type. For example in situation where you want to exclude a part of level from creation. Room masks are also useful, because then you can create stuff in a specific room, and when you have assigned only tiles of that room to a mask id it's easy to find tiles of that room later during the generation process.

I didn't have time to program that feature yet, but I'm planning to put that into Display_Map class which is re-created for each level when you enter it. That way I don't have to store mask values in each level which could be useful in some cases, but I think in this game it would just waste some memory.

Teemu ARRP Diary 2/3

It's already sunday, but I partied so hard that I forgot to report my progress. I confirmed that loading from text data works and it can also remove unwanted spaces etc. The parser is only about 20 lines of C++ code, but it can only get and store pieces of text. However it could be interesting to make it more complex, because I have been thinking about using external data.

Next I wanted to fix re-making of level for testing. The problem was and is that for some reason I have a "static" list for stairs which are copied to each level instance. That's why I can't just delete the level instance and make a new one, which would be the best solution. So I spent some time writing some routines that clear some things from each level class from the hierarchy. It probably works ok, other than the first level size will be always same. This could be changed, but some level themes should keep the size, because there are multiple layers of that same level. The lighthouse for example, it has multiple levels with the same base level stored in World class. There is also a bug related to that, because when you go at the top level it's a copy of the beach. This means you could change something in the beach and it wouldn't show in top level. Copying terrain tiles to top level every time the player enters there could be easy, but game objects are more difficult, because if they are copies it could create some interesting problems. That's why the interaction must be limited when you are on top of the lighthouse.

Friday 15 September 2017

Teemu ARRP Diary 1/3

This weekend is ARRP, annual roguelike release party. I'm not going to be releasing Teemu 1.3 just yet, but in the spirit of the party I'm going to program Teemu for these three days and see what happens. Today I have cleaned up some namespace issues and I have a plan to write a text parser for external text data (from a file).

The parser a big deal, because I haven't used external data other than pixel based data for tiles. But it makes a lot of sense to create text based raw data which is then parsed into form that the program can use. I already have that functionality, but when the "raw" data is inside the source code it creates a duplicate of that data. It's not a problem with text data as resource, but it would be neat to use external text data, also for the reason that changing that data doesn't require building the project.

The gameview is also a big mess, but it should be easy to fix. In any case I have learned to concentrate on one problem at a time and today it could be the text parser.

Sunday 10 September 2017

Recover from rage quit

After problems with gdb not catching simple crashes of a program I went back to Visual Studio. Microsoft had already released 2017 version (I had 2015). I like the installer of 2017, you can select only those parts you need, from programming languages to technology pieces. With regular C++ I also installed Linux tools, because it made me giggle. I don't know what they are, but I guess there were some talk about Windows trying to emulate the linux style command line workflow. It would be cool if it was possible to build projects just like in linux, but I doubt it.

The double account issue was also fixed, I went to msdn forums to ask about it and there is a special console for Visual Studio where you can reset the account. Seems like that another account went away, it could have been some kind of glitch and no one in reality was able to create an actual account to download my source code. Which is a fear I have, because VS has all that connectivity to clouds and team systems. I have obviously turned those features off.

Teemu's level system is more or less ready, but I realized there is no need to store object handles to level's map, because they are not owned by it. I could just make one "global" map and use it, that way a big amount of data would be removed from save game and memory. That map already exists in form of gameview class which has dynamic stuff like fov and lighting. Other than that the "map tile as object" broke some things from level generation. For example shallow water is no longer created. I hope it's fixed by itself when I go back to map that has only raw data and no objects.