Category: design

More thoughts on the design of Rogue like

More thoughts on the design of Rogue like

Unicorn hackSometimes I walk up around 3:00 AM and my mind is abuzz with things like this. Last night was one such night. The first thought was I should stop calling it a Roguelike. There’s a certain set of conventions with those and I don’t want to be limited by that.

For instance here’s an article about things you should or shouldn’t do in designing Roguelikes.

The game (for the next Ebook) is not going to be an all singing all dancing version but will be an MVP in the parlance. That’s Minimum Viable Product,

So if I’m going to divert away from the ‘standard’ then it needs a name. Something evocative like Dungeon Trawler but shorter more catchy.  So I’m going with V.O.R. (Vaults of Ruin) or maybe just Vor,

So onto design aspects. Here’s a list of the features:

  • 10-15 different Monster types with differing melee, range weapons and magic. Can have packs of them, not just one. There is only one player. Should be fun!
  • Simple set of castable spells using a Mana value. It is used up casting spells but regenerates slowly as you move. It can be replenished quicker by consuming potions.
  • No food or water but the character has an energy rating. This is depleted by movement and fighting. Rest or sleep oe rating food replenishes it but I don’t want it to be a major thing. I’m not having deep dungeons with 25 or more levels, but 12 levels maximum.
  • Weapons are sword, dagger or bow. Can switch between them.
  • A few powerful magical treasures.
  • Turn based not real-time. Asteroids is real-time but movement will be restricted to so many squares for you and monsters. You probably won’t be able to outrun the faster moving monsters.
  • Limited visibility can make things interesting. It means the game has to calculate what squares are visible each move.

I was tempted to do away with grid movement; for instance in the Asteroids game, they can move at any angle and velocity and are not tied to a grid. But that might be a bit too complicated so movement will be grid limited and Up/Down, Left/Right and maybe diagonal.

The screenshot is from an open source (.NET Core/C#) web rogue game called Unicornhack.

 

 

Now this is interesting – Interactive Fiction

Now this is interesting – Interactive Fiction

Choicve of Games Interactive FictionIt’s not really a thing done in C, although you could do. I came across a site that offers commercial Interactive Fiction. As they put it “text-based, multiple-choice games. ” and “By using text, we can interact with the imagination in different ways from a graphics-based game. We can also allow game designers to quickly and inexpensively produce games in comparison with graphics-based games.”.

Their games aren’t free but aren’t that expensive either typically $5-$8 or thereabouts and you can get them on mobile as well as via Steam. A recent game they’ve just launched has 1.2 million words of text (that includes the game scripts) which is phenomenal considering that most novels are 50,000-90,000 words.  Their games use their own open source scripting language called ChoiceScript which is a very simple programming language.  You can read their online manual (over three web pages) which should take maybe 20 minutes long. You can also play some of their games partly or fully free on the web.

The games are put together through a series of scripts. There’s also a free IDE for creating the scripts from a 3rd party. If you think writing a book is hard then writing an IF (Interactive Fiction) game must be like that but on steroids.

Games like the 1.2 million words one have multiple paths through with different plot lines which aids replayability. This isn’t anything like the Fighting Fantasy books (Name drop: I worked on a football game for Ian Livingstone in the mid 90s) because ChoiceScript has variables. This means that characteristics can improve over time and you can make decisions using <. >, <=, >=,==,!= just like in C etc. It doesn’t have arrays (there seems to have been some attempt at adding them in 2015 but I suspect it didn’t work) but there are subroutines and Goto which lets you create a structure.

You can add graphics but the games I’ve looked at don’t use them much if at all. The pictures are painted with words and this company have a very wide variety of games on sales including RPG, superheroes, science fiction, mysteries, war and pirates amongst others. The game mechanics are multiple-choice questions which doesn’t sound very glamorous but its like reading a book; your mind fleshes out the backdrop. The original Colossal Cave Adventure game is an example of Interactive Fiction and not coincidentally the Awards for Interactive Fiction are called the XYZZY Awards.

As the saying goes “Everyone has a novel in them”. IF is one way to bring it out…

 

A different way of generating a dungeon level

A different way of generating a dungeon level

Dungeon
Image by Artie_Navarre from Pixabay

I talked previously on how I generated dungeon levels by splatting down squares and circles of random sizes and then linked them together by corridors.

But another way that might make levels look not quite so procedurally generated is to first compile a catalogue of dungeon rooms.  These are “hand drawn” in a master text file, perhaps something like this:

*****|****
*        *
=        *
*        =
*        *
*****|****

Where * marks the walls,| a possible location of a vertical running corridor and = the same for horizontal running corridor. Each entry in the catalogue has a size (vertical, horizontal) e.g. (6, 11) for the room above and the generator program has to find space for this and then see which of the four doors it can connect to.

You can decide if you want a dead end room or one with more doorways. Any unused doorways are just replaced with a * for wall. Single door rooms might have a secret door that the player has to first discover and unlock/open.

When the generator starts, it reads in the master file, builds a list of rooms and then starts using them to generate levels.

The advantage of the catalogue method is that you are free to create as many room sizes and shapes as you wish and they don’t have to be rectangular or square. Yes the level is procedurally generated but using this methods makes it look less so. You can have very small rooms (2 x 2 anyone?)  or massive hallways with lots of columns.

My other side project continues

My other side project continues

Smartphone
Image by Gerd Altmann from Pixabay

This is the social mobile multiplayer game I have mentioned before. The initial game creation program is mostly working. I say mostly because I will still be adding to it. It does however create all of the game data in about 30 seconds for a game that can hold up to 10,000 players. It then creates the output files which are read by the mobile apps. These apps have yet to be created but I’ve decided to do some early testing using non-mobile apps that I’m working on.

What I want to do is prototype the mobile app, not particularly visually but functionally. To this end I’m creating a C# client desktop app that does everything that the mobile app will do. It can read the data (directly rather than via a webserver) and let me create new orders and upload them back to the server (or in this case my development PC).

This client will be crude and not great looking but lets me test that data is coming and going correctly. I use JSON for everything, as a data transfer format as well as storing all game data at rest as opposed to a database. It lets me hold all game data in dictionaries (with a bit of tweaking it is possible to save/load lists of objects to JSON. After loading I convert them to Dictionaries using an Id field.

                var bytes = File.ReadAllText(Lib.PeopleFilename);
                var list = new List();                
                list = JsonSerializer.Deserialize<List>(bytes);
                persons = list.ToDictionary(x => x.Id);

It works and is quick. The downside of using a Dictionary is that it occupies more bytes per element than a List. How many? Well it’s never easy to figure. .NET does not really encourage discovering how things are implemented. This GitHub project by developer Ludovit Scholtz shows the memory used by various .NET Generic Collection Types (HashTable,  Dictionary, ConcurrentDictionary, HashSet, ConcurrentBag, Queue and ConcurrentQueue) with various string lengths in a TestObject which as string, an int and a DateTimeOffset.

Storing a million objects in a Dictionary <int,TestObject> with a null string occupies 48,222,240 bytes so roughly 48 bytes per entry. I believe a List is closer to 20 bytes overhead per element. So for slightly more than double the memory use, using a Dictionary gives a tangible performance yield.

,

So I’ve decided- graphics it is for the roguelike

So I’ve decided- graphics it is for the roguelike

Dawnlike on OpenGameart
Dawnlike on OpenGameArt.org

I did a quick search for free rogue graphics yesterday and found an astonishing quantity of rogue type graphics in sizes varying from 8 x 8 (pixels), 10 x 10, 16 x 16, 32 x 32 and 64 x 64. I haven’t quantified these sizes exactly but the 16 x 16 ones seems to be the most frequent and so that’s what I’ll pick.  This post on Reddit provided links to many free (and some paid), most on the OpenGameArt website.

As a programmer sorting out graphics, it can be a very time consuming thing to do, so expect to spend a lot of time on it. You’ve got to satisfy yourself that you have enough graphics.  Not just for terrain (e.g. dungeons and cities) but also for monsters. There are artists who will draw you more on sites like fiverr.com but that’s all cost.  If you can draw or recolour then that’s a major plus.

Recolouring is another problem. With game graphics, you ideally want them all from the same source or else you’ll have the problem of mismatched sets. Nothing jars visually more than mixing graphics with different palettes. I’m no artist but even I can tell when something works and when it doesn’t.

Also there’s the question of perspective. The Dawnlike graphics are a sort of mix of from above but with a slant so you see front walls. Whereas something like the Kenney rogue game pack is front on. So you have to decide which you are going to go with.

My ideal game would be one of my favourites- Ultima 3. This is probably because its the only Ultima that I have played right through to the end and finished it! It was also the first. It took me about three months of one hour’s play a night. And I took copious notes. But as you can see its a bit more than a rouge like game! Those screenshots are from a CBM-64 which had a 320 x 200 screen (the image below is a composite of nine screens) borrowed from https://imgur.com/gallery/UvrzmBt. You can of course get the PC version sof Ultima III (and I and II) from gog.com.  (Note these are straight links not affiate. I receive nothing from them). I did buy Ultima I-VI from gog.com.

Ultima 3 screens

Rogue like – do you use graphics or text?

Rogue like – do you use graphics or text?

Rogue games search The original rogue used graphics. This was back in the era of terminals and home computers and graphics could be quite limited. So there’s a tradition of using text. However if you do a google image search for rogue game like I did here, you can see that while many of them are text there are a couple that are graphics.

So the question is do you use graphics or text?

Text has the advantage that its just there. All you have to do is choose the appropriate character.

Plus if you use Unicode (always a bit of a pain in C but doable) then you have access to hundreds of thousands of different characters. Like this one:

👾. Which is actually these

&#128126;

&#x1F47E;

More information about this one from here.

Graphics on the other hand can be a lot more colourful but you have to get them drawn, or acquire them from somewhere like kenney.nl. So not an easy one to decide. If I had the resources I’d use graphics, but I’ll keep to the tradition of using Text.

A tip. When you have a question like “What characters are used in rogue” just try it. There is so much information on the web that there’s a good chance that someone will have done it. I’m finding this more and more and sure enough, I found this on Reddit. How would you have ever found that out before the web existed?

An interesting game system – Fiasco

An interesting game system – Fiasco

Fiascao game coverAs well as games programming, I like game design and one of the best ways to practise this arcane art is to look at other people’s ideas and borrow/pinch/steal/be inspired by them.

The image is here is from a game Fiasco by a designer called Jason Morningstar of bullypulpitgames.com. It’s such a different game (they call it a weird game)  and you can see what it’s about on their Fiasco page as well as look at the various downloads.

Why I like it is because it gives you a flavour of tv shows with complex plot lines like Fargo. There are several ‘players’ involved and you’re never quite sure how things are going to turn out; there’s not what you would call a hero. You don’t get that in many computer games so anything that can advance the art is very welcome.

OF course turning it into a computer game would present some challenges. But I’d play it!

 

Thoughts on generating a dungeon level

Thoughts on generating a dungeon level

Dungeon Map
Map 19 from Paratime Designs Free B & W maps.

In my previous post, stage 1 of creating a RPG was “A Dungeon level generator. Create rooms and link them by corridors.“. Being quite retentive, I dug out my source code from the Quest dungeon generator. It was written in Turbo Pascal back in 1989-1990 and is about 1200 lines long.

The principle was slap down a few random sized rooms (both rectangular and circular in the original) then draw corridors from fixed points in the rooms with up to eight points in a room. Something like the map shown from Paratime Design.

You can go to town in the number of ways of generating a dungeon. When I was 16 i once spent a couple of weeks of my summer off-school time drawing a dungeon on an A2 piece of paper. It had something like 2000 rooms which is quite insane. I wished I’d kept it now; my magnum opus!

Another way I’d considered is draw a grid on the area. My original dungeon area was 150 x 150 points in size. Mind you Turbo Pascal was 16-bit software and no data structure could be bigger than 65536 bytes so the limit would have been 256 x 256.  If you draw a grid say at 8 x 8 intervals then when you put a rectangular room  down the intersection with the grid provides door points.  My original rooms were either small (6-18) or large (10-40) points.

Once the rooms were in place, corridors were drawn until all rooms were linkable. Corridors were drawn out from a door point until they hit another corridor or door point. By building up a list of rooms connected to other rooms, and removing duplicate corridors (rooms directly linked to another room more than once), a minimum dungeon level was built.

After that traps, treasures and monsters were added and an entry point in and out of each level to the one above or below. If you are feeling fancy then you can add a special room or two on each level such as temples, arenas and such like.

If you are short of imagination you could buy the D&D Dungeon Master’s Guide 5th Edition. Appendix A has a very comprehensive guide to creating a random dungeon and stocking it with traps, obstacles, furnishings and monsters.

The joys of setting up a server

The joys of setting up a server

Virtualmin install script runningThis is for my MMO game. I need a backend server, so yesterday I signed up for a vps service. I picked Ubuntu 20.04 LTS which I’ve used before and received the login details. I use Putty to log in via SSH and WinSCP for browsing, copying files.  Installing Apache2 is actually very easy. Likewise PHP. I didn’t install MySQL which might have been a mistake, so I had a LAP system (Linux, Apache, PHP) rather than LAMP.

What I did do sensibly was pay for a backup snapshot service.  When I logged in first I did an sudo apt update then upgrade. Then I took a snapshot.

And I needed it. My exact configuration was Apache 2.4 with PHP 7.4. Apache worked when I tested it but PHP didn’t. Well from the command line the PHP command worked and I could see the version but it didn’t work with Apache.  I created a PHP script with phpinfo in it but instead when I browsed to it, it downloaded the script rather than ran it.

This is usually the case that httpd.conf needs some AddType statements only there isn’t an httpd.conf anymore in Apache 2.4. I did locate a mime.conf but adding AddType into that and restarting Apache made no difference. I eventually wasted about three hours on it yesterday. However in my searches I came across mention of Virtualmin and so today I restored to the snapshot and ran the Virtualmin open source script. Luckily Ubuntu 20.04 LTS was one of the supported distros and Virtualmin installed without a hitch. It’s very impressive. The screenshot is of virtualmin installing. Thankfully all the bars on the right were green…

Back about 12 years ago when I first started experimenting with Linux and websites, i came across Webmin and used it extensively. Virtualmin installed both WebMin and Usermin. It has changed substantially in the time since I last used it. It surprised me a little because for years Ubuntu and Webmin didn’t seem to get on and Ubuntu recommended not to install it.

Anyway I now have a server that runs PHP. The backend will be running .NET Core once installed, but it’s just as easy to use Apache and PHP for receiving order files (from mobile). PHP is just to simplify getting those files onto and off the server.

Godot and IO games

Godot and IO games

Agar.io homepageI occasionally answer (often in a somewhat ascerbic tone) questions on Quora.com, not just programming though that;’s the bulk of my answers.  Feel free to follow me there! One question today was asking whether it was better to deveIop IO games on Web or mobile first.

I’d never really looked at this category- what is an IO Game? Very loosely, its the replacement for Flash games, and unlike those, it can run on mobile or cross-platform. A typical development system for such games is Godot, an open source cross-platform development system. The main language is GDScript based loosely on Python but any programming languages that has GDNative bindings (so C++, C#, Rust, Nim, D and any others I don’t know about. ).

You get games like the multiplayer game agar.io which has an entry on Wikipedia and is cited as an example of an IO game.