Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Teemu

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
It's a roguelike/adventure game. I play it myself, so it's really not that bad. Unlike most roguelikes this one has no known bugs.

(old broken link removed)
 
Last edited:

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
The first version was released I think in 2008 so it's like ten years ago. Since then I've slowly developed it and recently work more or less to release a new version. The game is a pirate-theme ascii "adventure" game with procedural generated world, much like in roguelikes.

Since last release I've moved on to more strict OOP-style C++ programming, but also made some "strange" decisions like modules with more than one class in a source file. It's something we are not told to do, because there should be only one class in a file, but I think making collections of classes in a related "module" makes the management of the source code easier somehow.

The content side has also seen some dramatic changes. I've re-programmed almost all level generation routines and added some new ones. In the previous versions levels didn't scale very well to different sizes, but now they do. The main goal however for this version is the RPG system which is going to be a custom one not closely based on any existing systems.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
I'm in a bit of crisis with OOP, because it does seem like it always blows up in large projects. In a perfect world you would write much more generic data type classes to work with stuff, you know, but in reality there are lots of duplicate classes and also lots of getters in the way I'm programming. Maybe you would have to be good at programming for OOP to work well?
 

levgre

Novice
Joined
Sep 27, 2017
Messages
55
You can probably use factory patterns and such so you don't need lots of classes for say each weapon. Generic code creating more specific instances. I personally just throw lots of classes in the same file, although maybe I'll refracture that later. I'm learning Unity and C# and making a decent sized project at the same time, so rather than studying how to always do code the right way I tend to just get something working. It can also help when you do something the "wrong" way, then you later you can understand why the "right" way is preferable.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
I don't have a class for each weapon, it's not that bad. I think one problem is trying to use static data-driven style with classes. I've began to suspect that it would work better with procedural style. Also, my data-driven code is quite poor itself, because it's not full data-driven but using code-based decisions (switch and if -code) with static data. I now believe that data-driven style should have a full set of static data in some kind of script data form rather than in raw C++ data.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
The current count for source files is 194 in total, about 95 .cpp files. In some cases making a module out of several classes is natural, but sometimes it's best to leave some classes in one file. You could in theory put stuff like "dungeon generation features" in one large file, but it would then create files with quite large number of lines. My limit is 1000 lines in a .cpp file, it's still manageable. This refactoring has been surprisingly slow, because nothing else is really happening than re-arranging source code in bigger files. And I'm only somewhere in halfway.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
The current module/cpp count is 80. It could be lower, but I don't want to put in any work that is not required. The refactoring of object storage system and inventory is almost complete. It was quite a big change, because the previous system didn't support multiple items per tile. It's crazy how much there is still to do, but I guess this is the last 10%.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
There is a 'G' command to go to nearest item, it's quite useful and sort of light-weight travel thing. The routine is using floodfill to find the destination. Floodfill is really simple, but not the fastest way to pathfind. However I had a bug in the code where I was going through the list of directions in the path in reverse order. Doesn't sound that exciting, but the routine was somehow working if there was nothing between the item and the player character. I guess the path was a mirror(?) and it did work in those cases, but at that time it was a mystery. With that fix I also limited the seed value to (direct) distance * 2. There can be situations where you are next to a fenced garden and you can see the item inside the closed area, but the pathfinding fails, because you can't walk there. If you didn't limit the distance then the flood fill will search the whole level which is quite slow. Actually I think it searches until the seed limit which is 100000.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
I'm probably refactoring this more than I should, but I want to get the source code "better" for release as well. I've taken a step back with modular style, because not everything has to belong in some imaginary module, but often you get nice groups of related classes in one file which I think makes maintaining easier. There is one line of description in each header file (all headers have pairs except main.cpp doesn't have a header pair). Almost no one is doing that, but it's so useful, because you can find out much easier what is the role of that module/file/class and can search for 'Module' to get them all. They look something like this (these are the modules I've already described):

Module 'game' is the setup of a game and gameplay loop.
Module 'hiscore' is a list of highest scores.
Module 'reason' is death/victory types of the player character.
Module 'universe' is global locations and resources of a game world.
Module 'world' is the structure and list of levels in the game world.
Module 'stairs' is a stairs/portal game object type.
Module 'blueprint is static pieces of terrain features.
Module 'cornu' creates rooms, corridors etc. one after another.
Module 'digger' is a maze generator.
Module 'drunkard' is a cavern system with drunken walk algorithm.
Module 'factory' is a centralized generation of dynamic objects.
Module 'pathways' is path type formations and pathfinders.
Module 'spawner' is a collection of game objects to create in specific places.
Module 'score' is the score of player character.
Module 'swash' is player character's data.
Module 'physics' for collision, damage etc.
Module 'band' is generic container classes.
Module 'storage' is file and directory routines.
Module 'lexicon' is generic text handling.
Module 'teemu' is the entry point of the program.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
I had an idea for "more" open world style, but it was not a good one. When the game has adventure structure trying to make it more open world just breaks everything. This detour took more time than I thought, but I'm now back in track to plan where key items are placed in the game world. I find it actually quite hard to create chain of connections between items and places, because when you have more than one connection you need to figure out in which order you place the items. And if you add anything, even one new important item it has to have a place in the game world.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
(Github link removed, the source code is no longer there.)
 
Last edited:

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
Visual Studio github plugin broke project files. Well, at least it didn't change anything in the source code, but obviously I rage quit that plugin and the future of source code in git is not clear. If it's that hard to keep reliable I'm really not that keen on using git in the first place. Maybe it's good enough to somehow stuff files in github when the 1.3 is actually ready to release.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
I think the release is closer now than ever. There isn't a lot to do and the difficulties I have with RPG system could be just in my mind. I never thought it would take this long, but anything is possible in roguelike development. In programming I feel like I've jumped over an invisible wall and finally realized how to code OOP in the way it's designed. It does really help, even though many things in game development come from pure design and not from programming itself.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
The release is still not close, but there is something mildly interesting happening. I'm programming a shop feature and trying to figure out how to implement the shopkeeper. In games like Nethack you go in the shop and pick up items you want to buy, but I'm thinking about a "closed" shop with items on ground and when you buy an item the shopkeeper is going to get that for you. There is no current AI code in Teemu and honestly I have no idea how I'm going to do this, but I guess there is at least something new to try. Most of the work in this project is just boring game content stuff you need to churn so, yeah. There is "mood" for creatures so it's some kind of "AI", maybe just add "fetch item" mood for shopkeeper. Could it work?
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
Weird stuff happening. I'm actually planning something, but there is no other way to handle the growing number of quest/special items. This part of the game is more like adventure game, because you have to figure out in which order and where you get the items. Also, the shop is making things harder, because you also have to distribute money somewhere and in this game money is a rare item, it works more like in Zelda games where getting a required amount of rupees is not that easy.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
I've been breaking down files with procedural functions to create modules that make more sense, like 'apply' for item actions and 'plunder' for picking up items, looting containers etc. The way I have changed my programming is that I try to make classes simpler and move any kind of "action" outside classes. They could be other classes but I like using procedures, because then you don't have to create instances. I think my problem was that I thought class had to operate everything inside it, but in reality it's just not very practical, because the interactions with other classes.

This project is "close" to release, but will still take months I guess.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
The "flowchart" plan of RPG system is something I've been using with Kaduria as well and it seems to work when trying to figure out how different parts work together. Teemu's RPG system is quite simple, but skills and classes seem to increase the complexity to a next level. Skills have also other uses than combat result.

teemurpg.png
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
There is one strange warning that Visual Studio generates. It says "unreachable code" after the first line of this piece, but it is some kind of false positive, because the code inside that while loop is reached and it seems to work just fine. I think VS is seeing something strange about that while loop.

Code:
    //loop over on feature list until all connections are made
   while (feature_list.empty()==false)
   {
       for (vector<Feature>::iterator i=feature_list.begin(); i!=feature_list.end(); ++i)
       {
           feat=(*i).Search_New_Connection(my_level, &area, spot);

           //remove the feature if it doesn't have space
           if (feat==-1)
           {
               //create left-over connections before removing it
               (*i).Create_Connections(my_level);
               feature_list.erase(i);
               break;
           }
           else
           {
               //break when new item is added
               Pop_Feature(spot, area, feat);
               break;
           }
       }
   }
 
Joined
Jan 14, 2018
Messages
50,754
Codex Year of the Donut
There is one strange warning that Visual Studio generates. It says "unreachable code" after the first line of this piece, but it is some kind of false positive, because the code inside that while loop is reached and it seems to work just fine. I think VS is seeing something strange about that while loop.

Code:
    //loop over on feature list until all connections are made
   while (feature_list.empty()==false)
   {
       for (vector<Feature>::iterator i=feature_list.begin(); i!=feature_list.end(); ++i)
       {
           feat=(*i).Search_New_Connection(my_level, &area, spot);

           //remove the feature if it doesn't have space
           if (feat==-1)
           {
               //create left-over connections before removing it
               (*i).Create_Connections(my_level);
               feature_list.erase(i);
               break;
           }
           else
           {
               //break when new item is added
               Pop_Feature(spot, area, feat);
               break;
           }
       }
   }
the static analysis is detecting that feature_list is always empty.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
I guess it can be empty if the initial routine doesn't find places for features. I did some changes and it no longer complains. First I changed the .empty to .size which does the same thing. Then I realized that you don't need that for-loop, because it always breaks in both cases. It's kind of funny how this routine works if you start to think about it, but it just does. Also, changed Pop_Feature to Add, because it's adding a new feature actually.

Code:
    int amt_of_branches=0;
   while (feature_list.size()>0)
   {
       vector<Feature>::iterator i=feature_list.begin();
       feat=(*i).Search_New_Connection(my_level, &area, spot);

       //no new places found from this feature
       if (feat==-1)
       {
           //create left-over connections to the last feature before removing it
           (*i).Create_Connections(my_level);
           feature_list.erase(i);
       }
       else
       {
           //or add a new feature
           Add_Feature(spot, area, feat);
           amt_of_branches++;
       }
   }
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
The current version has item stacks (also on the ground) so I thought it would be nice to be able to drop only some items from the inventory when you have them stacked. I think it has a bug:

teemu1.png
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,275
I've been working on the automap. It's working mostly, but the artwork seems to take some time. Just as an example I noticed the automap doesn't show doors so it took 35 minutes to draw a door frame and write couple of lines of code to get the door data from the level map. It's so tedious to draw tiles. Funnily the automap tiles look better than the actual tiles, but it fits the theme.
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom