Jump to content

  • Log In with Google      Sign In   
  • Create Account

arka80's Journal

Let's make a Survival RPG

Posted by , 20 May 2016 - - - - - - · 676 views
rpg, survival, prototype, c++ and 2 more...

So I’m coding a survival rpg (uh, seriously? pretty original…). Well, at the beginning I didn’t know of the survival element, only pretty focused on the rpg thing. But then I started to think to the story (I always need one), and it comes out a plot with you being tossed in this island, sentenced to exile for a crime you did not commit. Ok, but why an exile and not a simple death sentence? Because you are not a simple man. You are the prince, denounced by another (evil) member of the royal family. For jealousy, maybe (Moorcock?). So, you are a prince, and therefore you received a good education, can use a sword and so on. Maybe magical powers too. But you have none. No weapons, no food, no water, no dresses. The exile sentence is a royal-member-acceptable death sentence. By starvation… whence the survival element. I think that in the later game you will left the island to take your revenge, but that’s completely another story.


I (as you, I suppose) started and never finished a lot of projects. This is not the point, because every time I learned something new and improved my skills as a developer. Probabily this will never be a complete game too, I’m ok with that. I only want to try, and put things in order to go as far as I can.


With this in mind, I produced a very simple design document, a thing I always do. Usually I start a new google doc, put everything comes to my mind on the sheet (like a brainstorm) and end with a checklist of features and rules. Then, I procede defining (and hopefully making) small prototypes, adding a couple of major features at time.


The first prototype, named A (I’m original, just said…), will include:

  • map exploration (island surface, no caves)
  • first bunch of life stats (hunger, thirst, stamina, the kind of survival things) that decrease according to the type of terrain I’m moving on
  • death and game over
I'm close to finish this first prototype, and here's a screenshot in its full programmer art glory:
Posted Image



I’m using SFML (C++) and Tiled for the maps. Graphical-roguelike visual style, turn based. Long life to RPGs!

Playing with OpenGL

Posted by , 31 July 2015 - - - - - - · 560 views
study, experiments, opengl
I've done a lot of experiments in the last months. Tried a couple of prototypes for a 2d rpg in sfml, sketched some game design ideas, studied a bit of directx11 in opposition to my old love, opengl. Tried to learn something more in the shaders universe. Or just to understand a bit of them.

I did not put anything of this in the journal, don't like to announce any vaporware thing passing through my mind.

But I also realized that I was lurking a lot on the other's journals, and that my last entry was more than two months ago! So I decided to share what I'm doing right now. Just for the pleasure of sharing itself.

Since I realized how I prefer opengl syntax over directx one, I switched back to it. I'm creating a scene using modern opengl, core profile, shaders and all the stuff. I think this is the fourth or fifth iteration in this process (maybe more), but the good thing is that this time I have a really light codebase for loading/rendering and it seems I understood something.

Since I'm in love with rpgs, my scene is very fantasy-oriented. A cave. An hypothetical first map for an hypothetical game, in which you have to escape from a cell and find your way out through the small cave. All of this trying to achieve a low poly, flat shaded style.
I think it needs some more stalactites and pillars and details.

I'm also loving the process of thinking in terms of game design (modeling the map thinking at players movements, actions and fun, putting a feature only if it's needed for the (hypothetical Posted Image ) gameplay: a little challenge here, something to find over there, and so on).

Oh, I also grabbed Blender again and tried to model something. Models in the screenshot are mine.


Posted Image

Playing with terrains

Posted by , 22 May 2015 - - - - - - · 708 views
rpg, 2d, terrain, sfml
The need

I thought for a bit to a method to render tiled maps (terrains) in a way that seems less... well, less tiled actually.

The brainstorming/idea

First idea was to have smaller tiles and different images for each terrain type: so instead of having one grass image for grass terrain, have a dozen of grass images (with little color differences) and then pick a random one each time.

I liked the idea and second thought was: I will end with a lot of tiles... how to handle them? If before I had 24x24 tiles, now I have 9 8x8 tiles for each original 24x24. There are a lot of tiles to cycle in when rendering. More over, I don't want to manually fill a map with all those things.

Next thought was the need to merge between different terrains. This is something I always struggle with, since I'm not an artist and can't produce decents transition tiles. But if I reduce a tile to a grid of tiles (the 9 8x8 tiles said before) I can look for nearby terrain type and use some piece of other terrains instead of the current one. For example, if I have a grass tile under a water tile I can render one of the first row grass subtiles with a water one.

The only problem remains the prolification of tiles (x9, actually). I experimented that the render loop suffers a lot with something like this:
for(int r=0; r<100; ++r)
   for(int c=0; c<100; ++c)
      RenderTileAt(r, c);
and I don't feel to complain the poor cpu for this.

So the only solution seemed to be prerender chunks of map into bigger textures, and the use them in the loop.

The implementation

So I did it.

First I edited a really simple map with tiled (40x40 tiles), that could be a single area for a bigger world map.
I used 3 terrains: swamp, dirt and grass. This is the result as exported image (and this is also like all my precedent project's maps looked like):
Posted Image

A swampy area with a kind of a road and some grass.

Then I coded something that parse the tmx (well, I already had from prev projects), pick every tile and build a texture with the same map using 8x8 tiles instead of 24x24 (using a second atlas with 8 terrains for each terrain).

Result is this:

Posted Image

A little more interesting, but still no transitions. Look at the road, so straight!
Last, I applyed the auto transition method, and the result is this:

Posted Image

I'm pretty happy with it, even if I chose terrible colorsPosted Image

Age of Rogues: Planning

Posted by , 02 December 2014 - - - - - - · 1,033 views

So, prototype has been done and I received a few favorable comments about it, now it's time to decide what to do next, and I decided I want to make a game out of it. A real game, with a decent level of polish, if possible.

I ran the prototype and made a list of all the things I would like to change in order to release a 0.1 version:
  • Major refactor: nothing user can see, but latest iterations of the prototype have made the code a mess!
  • Original art: I always thought that players deserve to find original art in a game. Games with ripped graphics are like songs made out of samples from other songs. Age of Rogues will born with original programmer art.
  • Better look for dialogs: seriously, they need...
  • Use of mouse: this implies the use of buttons and icons, not only keyboard shortcuts (that will remain)
  • Actual maps generators: at the moment world map is an empty grassy plain, areas are grass with trees tossed here and there, and dungeons are the same but with rocks. I want at least a world map with consistent mountains, hills and forests, and an area map that reflects the real world's tile terrain. Generators are a thing that I will improve at every release, but I really need to start somewhere.
  • Monsters in dungeons.
  • Obelisks in dungeons.
  • Titlescreen
  • Background music. A single track of original music (I am a sort of musician, luckily).
At least, these are the elements that make me think at a game.

I'm spending a bit of time making the art (and finding a consistent style), but with gameplay and contents already made I don't have the usual bad feeling of being wasting time. I opted for a cuboid-pixel art, keeping the same palette of the free tileset I used.

Below is how the "choose your character" screen looks like at the moment (yes, clouds are moving). Bye!

Posted Image

Age of Rogues WIP: Day 8 - Prototype completed!

Posted by , 20 November 2014 - - - - - - · 1,674 views
rpg, roguelike, ageofrogues and 2 more...
Mission accomplished! Posted Image

Prototype of this game is finished, and this is yet a very great success for me.

As last feature I introduced dungeons (not really a roguelike without them Posted Image). Dungeons are not the ultra-deep things seen in other roguelikes: they serve the sole purpose to hide once more obelisks, giving the (design-) chance to put the most advanced ones in really dangerous places.

Posted Image

At the moment, dungeons are implemented as a submap of an area. There's one level only, and the entrance is the exit too (you go there not to find the exit, but obelisks, and you know where to go to back to the area map). I didn't spent a single minute in implementing an algorithm for their generation: they follow the same rules used for external areas, but with dirty terrain as default and rocks as barriers. I just wanted something to enter in, wander around, grab things and exit.

A feature of dungeons is that they use the character's dark-field-of-view stat in order to uncover explored tiles (instead of the field-of-view stat for the area map). This stat starts at 0: that means that you can't see anything around you if you enter a dungeon at the beginning of the game. You need to be equipped with torches, and you get torches as soon as you find the Fire obelisk (which must be placed NOT in dungeons...).

So, this part of this adventure has come to an end, and I'm pretty proud of what I have done. Now I want to play a bit with this toy and maybe polish a minimum to have something to release. With an early alpha (or late-prototype) I can think to run a page on indiedb and start an actual development.

But not now. Now I need an holiday. Posted Image

I put here the prototype exe as it is, for those interested in. "As it is" means that it lacks almost every kind of "user friendly" feature. A lot of things are there for the sake of test only: for example, dungeon entries are always in the first column of tiles, at (x=0, y=25) to make entry test easy.
Enough apologies, enjoy!

Age of Rogues WIP: Day 7

Posted by , 13 November 2014 - - - - - - · 613 views
ageofrogues, roguelike, design and 2 more...
Another update, with several improvements, new contents and a couple of things with heavy impact on gameplay. Let's proceed with order:

Content milestone reached
The prototype's goal for content creation was to have 3 social obelisks (in order to complete a collection) and a Scientific one. I added Social Organization: Tribe (social obelisk) and Agriculture (scientific). With Fire and Stone Tools of the previous entry I can say I reached the goal, but this is not the only one...

Tribe gives me the opportunity to add a character to the options of the player, the Chieftain (the Tribe obelisks actually unlocks the Chieftain). So I had to code the lock/unlock system for evolute characters. You can see all characters in the list from the beginning, but can choose only the unlocked. A picture:

Posted Image

With the Chieftain I reached the second goal: to have three playable characters, one of which locked at the beginning.
Chieftain has the power of found new villages, and is pretty good at fight. He has also a wider field of view, which is getting a lot of importance in this "release" because of a major change in the mechanics, which is next point.

Gameplay mechanics changed
Exploration: when in world map, you can move only starting from an explored tile (area). Before, an area was setted "explored" simply going into the first time. Now this is not enough. You have to actually explore a certain amount of tiles before area is considered explored (61% at the moment). A tile in the area map is considered explored when reached by your field of view. Logical consequence is that the wider the field of view of the character, the better.

Cost of new characters: It's clear that you need more than a character to actually explore an area. You need at first harvesters because of their power of gather plants and thus food. But they're weak, and map is filled with beasts, so they die quickly. You then pick hunters to clear a bit the area, and finish with harvesters again to pick all the food (and obelisks if any!).
I found this fun, but a bit ripetitive because of the absence of a real challenge. So I thought: what if every new character born with a cost? You have to keep more attention to your character's life.
Cost is not per character (which can seems logic: high cost for evolute characters). Instead, it simply grows after every new character. It starts from 0 and increase of X every time a new character born.
See again the picture above: here I was using X=10, so that was the 14th character.
First time I played with this new mechanic I lost (gameover!), because I started to loose villages for starvation.

To end with, not a real mechanic but an improvement: persistance of area map data. It's lack was quite a bug, or a not yet implemented feature, but now it's there and works as expected. Characters shares explorations and area maps are not regenerated every time you enter in, which brings at situations in which you can have the most of them uncovered, like in the picture below.

Posted Image

I left only one big feature before I can consider the prototype finished: dungeons!

Age of Rogues WIP: Day 6

Posted by , 06 November 2014 - - - - - - · 892 views
ageofrogues, roguelike and 2 more...
It took me almost a week to put together 8 hours of coding, but I ended up with the core mechanic done: obelisks!

While coding obelisks, I had in my mind Sean Bean's Boromir whispering "one does not simply hardcode a feature like obelisks!"... he was right. Obelisks and their discover change almost every game stat, starting from the various characters ones. I coded only two of the four intended for the prototype, but soon I realized that I simply cannot hardcode their impact on the world. I need something structured, with a minimal level of architecture.

So I did it. Obelisks data is stored in the form of list of structs and I have a couple of static functions that handle them and modify the world. Game only know about their code, keeping a vector<int> of the founded obelisks codes, and some switches do the rest.

I had to manage some new art. Even if I chose to use non-original tilesets, I had to browse a bit to find something suitable, and I ended up modifying something and creating some other images. All these things took some time to get done.

Two obelisks implemented so far: Stone Tools (on the Scientific [green] area) and Fire (on the Social [blue] area). Everytime you find an obelisk in the map (and bump into) a dialog shows a brief description of the technology and a list of game benefits, as you can see in the picture below:
Posted Image

A critical design point
Finding obelisks expand your chances to win the game in many ways: Stone Tools, for example, gives a chance to Hunters to start kill something, so that Hunter becomes an interesting character. Obelisks are grouped by the maximum distance from the village they can be found. This is a critical design point.
Stone Tools is meant to be found at 1 tile from a village, so that harvesters can find it, given that it is a basic tech you absolutely need. Rarest techs will be far from villages or deep into dungeons, and only advanced characters can reach them. MaxDistanceFromVillage is one of the Obelisk struct member, and one of the most important. Probably here is where the whole design will take place.

When an obelisks is found, all obelisks of the same type are removed from the map, and one of the circles on the corner is filled with the icon of the tech, as you can see below.

Posted Image

I started to actually play the game and, well, it is quite fun even with the great number of obelisks in each area. They will be a lot more rare in the game!

Age of Rogues WIP: Day 5

Posted by , 28 October 2014 - - - - - - · 656 views
rpg, roguelike, ageofrogues and 2 more...
Some updates here: you can now grab things from the ground. Currently, you can grab mushrooms (if you have the ability "gather plants") and pieces of meat (if you have the ability "hunt for meat" and you manage to kill something, which is a big if).
Grabbing food increases the food counter, of course.

Along with this, I fixed some bugs of minor importance and implemented a basic field of view. Since it is basically an exploration game, I think a proper field of view is mandatory. You cannot simply see all the map that can fit in the window. You have to move around and explore, with dangerous things hidden close to you.

In the real game this would be a good bresenham implementation, but for the sake of the prototype it is a simple "show every tile within a range of x tiles from me". Even so, it adds a lot to the gameplay! You have to explore almost the entire map to search for those obelisks (which do not exist at the moment...)!

Posted Image

Oh... I also managed the multi-village. Before there was only one village in the world, and every character born in that place. Now world is generated with some villages, and everytime a character born a village is picked. This bring to situations in which characters start to share world tiles they explored, like in the picture below, in which a new character is born in the village to the north and can see the piece of map discovered by its predecessor. World map tiles follow this rule, area map tiles don't.

Posted Image

The real game will be about uncover the world map generation after generation, with advanced classes that can move far away from the village of born. This thing of the range of movement brings a lot to the gameplay: for example harvesters can move 1 world tile from the village, while hunters can move 2. Hunters are stronger and tougher than harvesters, so it seems a good idea to choose them at the start of the game. But soon you understand that are they are not strong enough for the beasts out there, and they cannot grab mushrooms, so global food quickly decreases, and world loose villages. You'd better choose harvesters to (carefully) explore nearby areas, collect food from plants and hope to find first obelisks to upgrade your units. This put also some rules for the map generator when it comes to disseminate obelisks, and it is beauty to see that every aspect seems to be connected.

This is the first time I prototype something instead of starting writing the actual game (and fail). Good experience so far.

Age of Rogues WIP: Day 4

Posted by , 24 October 2014 - - - - - - · 693 views
rpg, roguelike, design, prototype and 1 more...
I could name this entry "Monsters & Items" and stop writing. But I will not. I like to explain. I found that keep these records is a really useful mental help, since it gives me close milestones and act as a sort of progressive brainstorming. Cool. Posted Image

Posted Image

Stats & Skills

Implemented factories methods to create instances of monsters and items (food at the moment) to put on map. This is where character abilities come to an actual use.
Character struct has gained some new attributes too, like an array of skills and stats values. I forced myself to keep this simple, putting only what is needed at the moment. Since I have monsters now, I have to manage their AI and a kind of combat system, and therefore I'm in need of, at least, hitpoints and attack/defense/damage values. These have become my character's stats.
As for the skills, I made the same. I have two character classes: one that is able to recognise and grab plants, and one that is able to fight things and obtain meat to eat. I don't want to bind these skills to the classname (if you are an "harvester" you can grab plants), so I translate that into a skill system (if you have the skill "gather plants", you can do it). These lead to a more flexible design, in which advanced classes can do more than one special action, and (better) I don't have to hardcode things. In effect, I'm trying to put all in a data-driven way as soon as possible.

Living monsters: AI and combat system

As said, I implemented a basic AI for monsters too. They stay at their position until you enter in a certain range. At this point they start to chase you. If you go far enough from them they stop chasing. Obviusly, if they come to bump into you, they attack. You can attack also. I have implemented the melee combat system too. Nothing fancy: everyone has an attack and a defense value. For every point of attack a d6 is rolled and the sum is made. Same for defense value of the defender. If attack > defense, attacker hits and fixed damage is done. This way I don't have a fixed random range with some bonus, like in the d20 system, and I feel I can change things later.
Again, at this point also I had to remember myself that I was working at the prototype: stop thinking at putting a visual effect for wounds, please. I plotted in the bottom status bar character's stats: you can see your hitpoints decreasing over there.

This bring to the fact that there's also another way to die, obviusly Posted Image. So up to now you can die for starvation and wounds.

If you kill something and you have the right skill, that thing become a piece of meat in the map. You can't grab things yet, but this will be matter for tomorrow.

Posted Image

Here you are the Hunter and have killed a snake, that has become a piece of meat.

Map is filled with mushrooms too, but are strange things at you eyes,

and you don't want to have nothing to do with them.

Stats are oversized to let me test that snake is killable... initial hunter's stat are not that powerful!

Age of Rogues WIP: Day 3

Posted by , 22 October 2014 - - - - - - · 648 views
rpg, roguelike, ageofrogues and 2 more...
Focus of this session of work was to define the gameover condition and manage the death and reborn of the character. Mission accomplished, even if in a very rough state.

There are two ways for die: one needed, which doesn't end the game, and one to avoid, as it's the real, classic, game over: you lost.

The good way is when your current character dies. It can (and must) happens for a lot of reasons: at the moment the only one is the lack of food. There's a good reason for this, which I'll explain soon.
When you die the good way, you reborn in another area of the world map (currently in another village) and you can choose which class your character will play (see screenshot below)

Posted Image

The bad way to die has to do with the concept of the world being your real character: so when the world dies? In gameplay terms, it dies when humanity reaches extinction. Every roguelike/rpg has the concept of hitpoints: when they drop to 0 you die. Well, hitpoints in this case are the number of villages (human outposts) out there. At 0 humanity has to be considered extinguished. When this happens there's nothing more to do: game over.

About food

Food is not the micromanagement thing that affects many roguelikes. I was simply in need of a consumable resource to give both the feel of time passing and the possibility for the world to loose a village. So, if villages are the hitpoints of the world, the consumable resources are the hitpoints of villages. When they drop under a certain amount the current character's village dies (and character too) and you are a step closer to the end.
Not only, consumable resources give me the opportunity to have to accumulate something, which is a very good (fun) game mechanic, imho. It gives a nerdy satisfaction to see that number growing Posted Image .

Every epoch will have its consumable resource, it will not always be food: in a most advanced society this could be gold (money), or energy. A financial/economic crisis will be a real disaster in an evolute society.

Next screenshot shows these aspects: you have two indicators on the high status bar, with the consumable (food in stone age) and the villages.

Posted Image

Lastly, here is a screenshot of the tragic moment in which you are so close to your death for starvation (unfortunately for you, world generator puts no food on map at the moment, so...):

Posted Image

No fighting classes can become really useful if they give the opportunity to increase the consumable resources, and going in the wilderness (which must be really dangerous) with a poor harvester can be deadly fun Posted Image .

Now that I have the game beating you, I can start working on how to survive in such hostile place.

October 2016 »

23 242526272829

Recent Comments