A week of holiday

In this period of time i’ve been abroad on a brief holiday, at work busy or doing daily life stuff that kept me away from coding.

I’ve been to stockholm, and while there , i decided my next dev step:
I will start by looking on how to create a heightmap of an isle, and then use that heightmap as a population density map to build the city.

I am still far from beginning the gameplay, but i think that the gameplay in Killer will be given in great part by the environment, therefore what the player will be able to do will work only if the world he is in is decent.

And surely for the moment, the world is far from decent.

In this week, the 7drl challenge started and endend, in the first days i’ve noticed a lot of good startings and good ideas that i liked.
Now,after a few days almost away from the web, i have no idea on what happened, and need to keep up again.


Time to sleep…



Think before developing

This small pause is to understand where i want to bring the project,and what to develop next.

I’m thinking about:

  1. building a bigger map
  2. handling the keyboard in a different way than common RLs

Building a bigger map

The first map test has been a big success for me, this is obviously the absolute first step of a longer path.

My final goal is to load a population density map + other maps , and build a town from it.
Something like this:

Density Map

Density Map

Useless to say that to be “realistic” the town mustn’t be 400 tiles wide.
And that’s a problem. I don’t want to hold in memory 4 gazillions of tiles, and at this moment a solution isn’t in view.

Therefore, before going forward with random map generations, and something similar, i decided to stop and think.

The keyboard “problem”

One of the things i don’t like about RLs is the enormous amount of “uncontrolled freedom” . wait before throwing things at me.

What i mean is: the fact that you have tons of actions / interactions is absolutely great. One of the enormous PROs in playing a RL.

The fact that you have to learn 30 keys to play is not.
It is nowaday common key binding , but to a newbie , the “common” keybinding is not easy enough.

I liked very much the Sil approach to the whole game: it has a very well done pdf manual, a tutorial where you can learn the basics. And that contributes to lower the difficulty curve, by almost erasing “key learning” experience.

This said, i’d like to create ,in the future , another approach to this “problem”: i want to generate the “common” keyobard binding , and offer also a contextual interaction list: let’s say you are near an enemy, the list could contain something like throw item,attack .

Near a merchant the list could be buy,sell.. and the same goes for the inventory:a common interaction with a certain item could be “drop,drink/eat, throw”, for another one “wield/equip, drop,use with…” .

If anyone reading this is the developer of a roguelike: please steal this idea.
I’m sure that many games i’ve tried got me bored because of the steepness of learning the keys,and i don’t want to lose fun games just for that.

Now, back to thinking.

Handling the maps and the camera


, , ,

In these days quite a lot of things happened in the development area.


While chatting with the user Trefall , many things were cleared, the first one is that the names i’m using are totally wrong.

So Viewport is wrong, the problem is that i have no idea on how to name it. for the moment


In the last post i was writing about the map generation, and handling the map.

In my case, i want the player to be in a large environment,not a dungeon-like system, not because i don’t like that, but simply because my objective would be to model a city with the correct proportions.

One of the problem of this approach is the map size: i cannot load a full map in memory.
After the usual chatting time, the correct approach was decided: i had to create a viewport.

Act I – The map

I wanted to see something on the screen: what i was doing.
One of the things i developed , thanks to my friend Jak , was a fac-simile of a town: with some random “streets”.

This is very far from a decent map. But for the test purposes i have in mind it’s more than enough.

I had a map to show.

First random map

First random map

This isn’t based on anything, simply split the map in halves and decides randomly if creating a street horizontally or vertically.
Random “noise” could be added to move the streets from the exact middle point.

But for now it’s ok as it is.

Act II – The viewport

A viewport is a thing that handles the camera and the maps close to the player.
addendum: viewport is a wrong name.

A camera (or screen) is a thing that shows the player the exact amount of tiles that the window permits.
So if the window is 20×20 chars, the camera(or screen) is an object which selects and  shows 20×20 tiles, given a starting x,y coordinate.

My viewport will keep in memory 9 maps, disposed as a keypad , and the player is in the middle one ( the 5).

7 8 9
4 5 6
1 2 3

When the player moves east,for example, 3 new maps are loaded and added to the right side, while the 3 leftmost (1,4,7) maps are unloaded.

This had a lot of consequence: every map must be “positioned” in a coherent world-system coords ( in opposition to local-map coords ) , therefore joining the map means that the next one must be positioned with the correct coords.

This also means that, if the player, from the center travels N-E , at a certain point, the camera will have to load tiles from the maps 5,6,8 and 9.

This caused me some troubles.
The viewport must handle this stuff too, therefore i lost a lot of time on thinking how to “join” the maps.

Solution: I didn’t.

Having the way to transform global coords to local map coords, i had my engine simply iterate all the tiles needed by the camera.
I’m not fully satisfied with this approach: for each tile i have to find in which map it is by doing divisions, and therefore this is not the best for optimization purposes.

After thinking about it i used the general purpose strategy of “who cares. I’ll check it if i’ll need it”.

Act III – Moving the camera

Thanks to the keyboard handler i developed a couple of weeks ago, moving the camera has been a task of no more than 5 minutes: with everything set up, the camera moves.

For now it’s been tested just with the middle map, but i’ll soon be loading all 9 random maps and check if everything works.

More stuff to do!

Urban map


, ,

The first attempt

In these days i’ve made a lot of research on different topics, one of these has been “how to generate an urban map”.

As always,the chat has been an invaluable resource, proving once again that confrontation and sharing ideas is more rewarding than googling stuff.

This time i must thank the user srd| which pointed me to a very useful pdf ( here ) .

Before that, i was trying thinking on how to develop a simple network, on paper.
Using a wife-dependant-random-number-generator i modeled a simple L-System.

I started with a single segment (a,b) and 3 different possible productions:

  1. apply to the segment a random midpoint displacement
  2. from the central point of the segment, create a new segment,perpendicular to the first
  3. create a block which shares one of the sides with the original segment.

After a few iterations i got a decent road map ( and by decent i mean “it’s not realistic, but it’s not crap either” ).

At the end of the drawing process i noticed some “artifacts” like:

  • points lie too close to each other
  • a point lies very close to a line, but doesn’t touch it

This was easily adjustable by applying some “correction algorithms” to the generated map (like “join the points”,”move the end of the segment on the line”).

So i came to the conclusion that to generate a decent map the steps must be basically something like the following:

  1. From a starting input iterate a certain amount of times the possible productions
  2. when the iterations are complete apply the correction patterns to “clean” the map.

After reading the pdf that srd| linked, i understand that a better solution is to feed population density maps  and other statistical data maps to the algorithm ,so that the productions may have more data to crunch.

I am almost sure i don’t need a so realistic map.

My first try has been followed by some hours of cursing to try to create the algorithm and drawing it in SDL, just to check if something decent came out.

this was my excellent result:

Advanced urban map generation

Advanced urban map generation

I think that i’ll skip the sdl test and put this topic on one side to re-take it in some week.

The map object

While discussing maps and related topics on the chat ,i came to another conclusion : my very very simple map system must be refined.

At the moment the map keeps one layer of tiles, which each handles colors of background and foreground, character to display ,etc.

I need to further develop this system.

My next steps will be adding multi layers map (at the moment i think a background layer,an effect layer, a “solid objects” layer, and npcs ) and to create standard Tiles to avoid the handling of the graphical stuff inside the Tile object.

Tools – Progress Bar

Today i thought that i will need a progress bar that works in some way, so i decided to build another ui – widget.

At the moment it’s not customizable (colors, characters to use ,etc ). The only customizable thing now is the bar width.
But now i’m not in need of more than this.

Also: that’s more than enough now.

Progress bars

Progress bars

Well, it works, i can use it to show values different than 100 (like hps for example).

And that’s it.

Yesterday i went to dinner with a friend who’s also in the roguelike “environment” ,and we discussed a lot about my “killer” project (wich i havent written anything on this blog yet).
I am almost sure that to achieve my final objective, i must first create some smaller milestone which can be used as a test environment for the final project.

The way is longer than initially thought.