Friday, August 31, 2012

Really basic level generation

Level generation is, in my opinion, one of, if not the most important element of a Roguelike. Different methods of level generation produce levels that feel very different, ranging from box stamping to more organic tunnelling methods. To take advantage of this I want my game to use several different methods to generate the level, giving different areas different feeling that go with their theme.

This is my first, very basic attempt at level generation. All it does is stamp boxes into a grid map randomly, with no logic. It then tries to create corridors to connect up all of the room, simply by tunnelling through from one box until it reaches another. After that it cycles through the tile and creates doors in places where there are two tile between walls.

It doesn't do the interesting things yet, like place mob, item, treasure etc. Also I'm planning on using a tile editor programme to create a load of bespoke rooms with interesting layout which will then be randomly place. Still, I'm quietly happy with it so far and I'm hoping I can add to it and make something that can create genuinely cool dungeon layouts..

Give it a play, though be warned that it's all brute force computing, completely non optimized, so if you choose a huge map with lots of small boxes it may take a long time to finish. (the text on the top left is actually a button)


Thursday, August 30, 2012

Why I'm cutting random out of my game's combat.


Roguelikes are built on the good old random numbers generator. It runs from the level generation all the way to the combat and loot. The levels are randomly generated, the monsters are randomly spawned and then when you fight them the damage and whether you hit or miss is often worked out by the equivalent of rolling a dice.

My view is that some of the randomness is really cool, and it's a large part of what make Roguelikes so interesting. It means every game is different and you'll never have the same encounter twice and it can add uncertainty to combat. I just think that for casual gamers it can be a negative experience especially when the dice roll against them several time in a row.

To give some examples:

  • In DCSS (Dungeon Crawl Stone Soup) every time you cast a spell you have a chance of spell failure, which you can reduce by increasing your skill levels or increase by wearing armour. It's obviously calculated using a random number generator. I had a slightly promising venom mage and he had a spell called Mephistic cloud, which produces a cloud of gas that confuses and damages enemies in an area. Due to it's difficulty and my skill level it had a failure rate of about 10%, so nine times out of ten I should have been able to cast correctly. Except the very nature of random numbers means that you'll always have spells where they go against you. In this case I came up against a group of orcs bunched up. It should have been fairly easy to have confused them then taken them out one by one with a different spell, except instead I miscast Mephistic cloud 3 times in a row. It meant they managed to reach me and a fighting retreat led to my death. What are the chances of that? 0.1%, in case you were wondering.
  • In Dungeons of Dredmor you can enchant your items on an square called the anvil of Krong. There's a 70% chance of a positive enchantment and 30% of a negative curse. I had a game where I had my items cursed 4 times in a row, making what was a fantastic item useless. You actually get an achievement for just 3 times.


In both cases it felt like my whole run was ruined by forces beyond my control. This isn't a fun experience and I think it's something that could really put off a casual player, or even someone who's simply new to the game. Don't get me wrong, I play table top games and I've lost them based on rolls of the dice. It's just it's one thing rolling triple ones in Risk and having a laugh with your friends at your bad luck. It's a whole other thing playing a single player game against a computer where you can't see the dice so you have a sneaking thought that maybe the computer just took offence at something you did in your last run.

This is why I'm removing most negative random effects from my games combat, and from the game in general

I still want there to be some randomness, so you players don't always know how an encounter will play out before it's happened, I'm just going to mostly keep it to cool 'lottery' abilities that help the player, with only a few minor negative effects that can happen against them. This means no spell failure, no missing your attack 5 times in a row, no enemies resisting you spells completely. I want the players to know that if they try something it will either work or not, and if it does how much effect it can have. If an enemy has a high resistance you'll just do less damage to them, but it will be broadly predictable with no wild fluctuations of fortune.

It also needs to be recognised that players remember the times where the dice went against them as 'the game screwed me', whilst when the rolls go in their favour they either take it for granted or think it's cool. I'm still going to keep some random stuff that work in the favour of the player, just not the other way round. The npcs aren't going to ragequit after the player crits them twice in a row whilst dodging their attack. Thie same can't be said of the other way around.

Friday, August 17, 2012

Warm toilet seats at the Centro Forum, Camden

I have a  memory of reading 'Boy', by Roald Dahl and there being a practise in in the posh boarding school he went to of the younger boys being forced to sit on the toilet seats to warm them up for the old boys. Well that's not needed here at the Centro Forum, part of the Centro Buldings group in Camden.

I really like the company I'm working for at the moment. The people are great and the work is interesting, even if it is AS2 (in 2012, I know!). However the office building is nothing short of a disgrace. Five floors with one incredibly slow lift that break down with worrying frequency. Four of those floors are occupied by tech companies, including the one I'm working for now. There are four toilets, 2 for the men, 2 for the very few women (fun fact, the room I'm in has about 40 mens and no women. tech companies, ya know), with 2 cubicles in each men's plus urinals.

The toilets have always been fairly inadequate and squalid, and it was a frequent occurrence to have to wait in the dingy, cramp toilets for a cubicle to become free. This became even worse earlier this year as there were a string of plumbing problems, leading to overflows, blocked and overflowing toilets and more queues.

I'm guessing, largely due to this the management started on refurbishing the toilets at the beginning of July. They closed one of the mens and one of the womens and began ripping them up, leaving only one toilet apiece for each sex. Cue queues.

Cue waiting outside the cubicle in July heat for someone to finish because you know that coming back later is pointless and it will be exactly the same. Cue coming in to sweaty, warm toilet seats and bundles of hand towels overspilling the bin because of the sheer amount of people using a toilet meant for a fraction usage. You even had people talking about going to the gym or  a restaurant at lunch because they need a shit.

This was supposed to last two week, then they would start on the other toilets. Instead it took them over a month.

They opened the new toilets at the start of August, and yes, they're much nicer. Dyson airblade dryer (there's something very amusing about watching people who don't know how to use these try to try their hands), huge extractor fans and a lighter decor. Yes, they did have a leak that closed them for a day almost immediately but that just seemed par for the course.

We're all now praying there won't be further breakdowns because they've close the other set of toilets to redo them. The new ones are being used almost continuously and there permanently someone stationed out the cubicles waiting to get in. The new toilet is more pleasant as a place to stand a read the web on your mobile while you wait but I don't think this is how it's meant to be.

The sad thing is that even when the other toilet is finished, and even if they've fixed the plumbing issue, the toilets will still be sadly inadequate for the numbers who work here, and the lift will need replacing at some point. this building just isn't fit for purpose.

Tuesday, August 14, 2012

Who's turn is it anyway?

I'm building a reasonably traditional Roguelike so it's going to be turn based. That sounds straightforward but there are different ways that turn based can go.

Different models


Player then mobs

This is probably the easiest way to go. The player takes their turn, be it movement or action, then the mobs or npcs take their turn.

Pros


  • This has the huge advantage that it's very straight forward for the player and easy to keep track of.
  • It makes AI pathfinding easier since the mobs always know where the player is when they move.
  • It gives the player an advantage over the mobs, since if they player can kill the mob in his turn, the mob won't have a turn to react, because it will be dead.

Cons

  • Difficult to simulate different speed of movement or attack, since it's very binary. Adding extra actions in a turn is hugely powerful and potentially game changing, as Baldur's gate/Icewind Dale players will remember when their fighters got multiple attacks per round.
  • If the player moves next to a mob one square away, since it's the mobs turn next the player will be attack with no chance to defend. This happens in Dredmor and it's very annoying. If a mob is one square away I find myself hitting space to wait a turn and let the mob come to me, which feels like cheesing.

Movement then action

First everyone moves, then they perform their actions.

Pros

  • Again fairly straightforward for the player.
  • Feels fairer than players then mobs.

Cons

  • Again can't simulate different speeds easily.
  • Slightly more complicated. Mobs don't where the player will be until he moves, so needs some logic. Ditto for players chasing a fleeing mob.
  • Possible for a character to make and action and die on the same turn.

Character speed based

The best example of this kind of system would probably be Final Fantasy. Imagine each character has an individual timer, and they can only perform and action when that timer finishes, then with each action it resets. Different characters have slower or faster timers to make different characters feel faster or slower.

Pros

  • The most flexible and the most 'realistic'. It means that you can have faster characters moving faster and attacking more often.
  • More avenues to build your character in different ways. Do you want a fast character and to use a kiting strategy or maybe a slow attack speed high damage build.
  • You could have different actions take different amounts of time, which could be part of their balance. For example spell which take longer to cast but are much more powerful.
  • Actually could be easier for pathfinding since instead of everyone moving at the same time there is a definite list of who moves when and only one character will move at a time.

Cons

  • A bit more difficult to understand for newer players, and even for for seasoned player might be more difficult to plan around. This could maybe be compensated for by having most characters in similar attack speed at the start and to ease the players into the concept.
  • Much more complex to implement, especially with many different mobs, all with potentially different speeds.
  • Balancing would be more difficult as speed is just another factor to consider. I dislike how in any turn based game with haste, haste always becomes the number one must have spell.
  • It slightly breaks the whole turn based thing. If a player can take more than one action a turn is each action a turn? What should I call it? What if I want to make a scoring element turn based?

My intentions

I would love to do the speed based. It just opens up so many different options for builds and abilities. I'm just worried that it's another layer of complexity on top of what is already a very complex project.

In the end I'm going to experiment with the movement then actions model, which feels nicer to me than player then mob. I'll see if I can get it to work well, then if I get problems I can fall back on the player then mob model.

Thursday, August 09, 2012

Features and creep



Given my time and resource limitations I’m going to have to try to be strict with myself as to what I’m trying to accomplish and what features I’m going to try to include.

One of the reasons my previous attempt at a roguelike stalled early on was because I tried to do too much. I was trying (and failing) to play Adom and I was really impressed by the open world feel of it, so also influenced by games like Baldur’s gate and Morrowind I tried to make an open world/dungeon crawling sandbox. Cue lots of bloated design documents and a model/data object directory with over one hundred different objects. It’s didn’t go very far.

To avoid this fate I’m going to try to keep a tight rein on the list of features I can support.

This is a list of some of the features I want to include in the game.
  • An easy to use, casual friendly interface. Gameplay should also be simple enough, at least initially for players who have never played a roguelike to understand and enjoy the game. This is the number one, non-negotiable feature.
  • A tutorial to get new users into the game.
  • No open world. It will be a pure dungeon crawling game, though I would like there to be some route branching.
  • Levels will be randomly generated, but I want to use several different methods to give different levels different feels.
  • Traps, chests, teleporters, switches, keys.
  • Auto explore. This could be a biggy, but I believe it will make a huge difference, especially in a mobile game.
  • Multiple different play styles and build paths possible, even if they’re just variations on the standard rogue/wizard/warrior builds.
  • Abilities that can reposition or add status effects to characters, to add tactical choice.
  • Card based abilities/stat system.
  • Tile based art. I’m thinking more DCSS than dredmor. I don’t have the time/funds to have animation but it has to be more immediate and intuitive than asci.
  • Cool items and equipment with different stats and abilities that make the players make a choice – no best items. Also some abilities target tiles with traps/status effect/dots etc. 
  • Only basic potions and scrolls – mostly ‘oh shit’ crutches.
  • Enough different monsters to be interesting and varied.
  • Monsters that don't either just come up to you and hit you, or stand back and shoot you.
  • Different damage types, with corresponding resistances and themes.
  • Must have some pathfinding, since it will be in effect mouse controlled.
  • Some kind of online scoreboard system.
  • No religions/races etc - another thing to balance and I'm already so low on time.
  • No crafting.
  • I would love to have multiple languages, so I'm going to try to build it in a way that would make this possible at some point without too much pain. I'm not planning on have more than English in my initial build though.
Actually, looking at all this, I'm clearly crazy. I probably can spend 2-3 months on this full time before I'm going to have to start whoring myself out for freelance work, and this is a list that I wouldn't feel comfortable promising a client given double that time. When you add to the fact that I haven't done much mobile work before and time for testing/balancing etc I'm going to have to cut this all down drastically.

I think what I'll do it carry on with my spare time planning and groundwork so that when my contract finishes and I start on it full time I have a running start, then see how I'm doing 4-6 weeks in. Then I can make some difficult choices and try cut it down to something I can actually finish. 

I hope.

Sunday, August 05, 2012

What kind of Roguelike am I trying to make?

And who is my target audience?

In my 'what is a Roguelike?' post I briefly wrote about the different types of Roguelikes there are. More or less I am aiming to make a fairly traditional Roguelike. A turn based dungeon crawling rpg with experience and character progression.

In terms of how hardcore and complicated it is my decision was probably made as soon as I decided I wanted to make it easily portable to mobile. Making a game playable on mobile means no keyboard commands and much smaller screen space for information, feedback and controls. This means for it to function the game needs to be relatively simple, and that pretty much rules out a super-complex hardcore Roguelike, which to be honest is probably a good thing anyway since I don't think I would have the time or resources to build something like that anyway.

This all lead to the fact that I'm looking to make a decidedly casual Roguelike. By this I don't mean something dumb or with no depth - it's definitely got to have more to it than your standard bump to attack 7 day rogue. I just mean that you have to be able to play it without reading a manual, and all the stats and information you need to be able to understand it need to be accessible within one click, or two clicks if it's not core information.

I also want there to be more instant gratification, from items and increase in power, than in most Roguelikes. I want players to think 'Wow loot!' and 'Ding!, level up!' and for it to be exciting and really cool, something that doesn't happen so much in a lot of traditional Roguelikes, which tend to have flatter power progression. This is great for getting people initially hooked on your game but could have implications later on for the longevity of the game. We'll see how it goes.

So, the answer is that I'm making a casual, small to mideium size, high power curve Roguelike without the complex systems seen in many games, and with a simple, easy to use interface.

This will almost certainly alienate some hardcore players who are looking for something deeper, but the success of casual Roguelikes like Dredmor, 100 Rogues and Cardinal Quest show that there are enough casual players to make up for it. As long as you make something good.

The answer to who my target audience is, is someone who enjoys classic Roguelikes but who sometimes finds them often overly obscure and difficult to play. Someone who loves games like BG, FF and Diablo, plus fast paced combat and strategy focused games like League of Legends and DOTA. Basically, my target audience is me, and if I can make a game that I enjoy I'll be happy, and I'm sure lots of other people will enjoy it too.

Wednesday, August 01, 2012

Why I'm doing it in Flash


I'm planning on creating the whole game using Adobe Flash, with the mobile versions being publish with Air. I may even do a downloadable desktop version, also using air.

I would be lying if I didn't admit that a major reason I'm using Flash is because I'm a professional Flash developer, so AS3 is a language I'm completely comfortable with. I know that I can build complex engines with it and I know it can take it.

The other reason is that I'm using Flash, and a reason why I personally think Flash it one of the best choices for building apps, is that I can produce an android, ios, web and desktop version with the same unified codebase. I'll obviously have to do some different UIs for the mobile vs the normal size version, but hopefully nothing too onerous as long as I enforce some strict apis. For me this is a huge deal. Even if I spent the time learning objective C or java, like lots of people have suggested I should 'for when Flash dies' there's no way I'd be able to do multiple versions in different languages. Flash means that for the main game elements I can develop for the flash version then just rebuild the other version without having to worry about getting all the changes carried over, because there will only be one codebase.

The only thing that remotely worries me about doing the game in Flash is the saving the game aspect. In theory it should be easy - I can use sharedObject, which should be able to save whole complex data objects. In practise in a previous project I've found sharedObject to not be %100 reliable. I managed to fix that issue by converting everything to primitive data type before the save, then back again, but it's not something I want to do if I can help it, and I'm hoping the issue has been fixed (it was infrequent enough it may have just been one flash player build.)

I briefly toyed with the idea of learning, then doing the it using HaXeNME, but in the end I decided I'm probably already biting off more than I can chew, so best not compound it by adding in a new language, especially one that's so niche and new. If I run into problems I'd be worried about finding answered, and anyway I don't see myself getting more work on the basis of knowing it.