Category: design

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

👾

👾

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.

 

Monetising a game

Monetising a game

bright city lightsThe celebrity game I’m building and I’ve been describing is free to play but servers cost money, so how does it make money?

First you have to understand there are two types of game currency. (Glitz dollars and Glitz Stars). Dollars are used in-game. It’s what your character needs to earn to survive, make rent etc.

Stars are worth about 10p or equivalent and can be bought and are spent on things like Chance Bags and character auctions. (See below)

So here are a few ways I’ve thought of.

  1. The mobile apps are free but will carry Ad-mob type adverts.
  2. Chance Bags. You can buy a set of cards that can be played to have Lady Luck affect you or mainly other players such as friends. These will be cost something like 10 Stars an provide 3-5 cards. The idea is to prevent players playing to win.
  3. Character Auctions. If a player has got a high-celebrity character then they can get something back by auctioning it in the in-game auction and they get 90% of the auction price. Celebrities drop a rank when they are sold by auction (they are advertised at the lower rank) and lose all accumulated properties (but the buyer does get some benefits).
  4. Sponsorship. Anyone can sponsor and this provides in-game gifts related to the sponsor and carrying their messages, logo and a link to a website. Plugging a new album? Gift it (in game ) to musicians by sponsoring. Also sponsors can sponsors major events, festivals etc in-game, Gifts can be given at film pre-launch parties to attendees etc.
  5. Watch a video and earn in-game Glitz dollars.
  6. Pay for advertising in-game. Players can do this. A phase two development is to allow celebs to buy in-game businesses such as Bands, film production, Bars, Hotels etc. That needs carefully thought though.
  7. Buy in-game gifts for other players.
  8. GlitzVille. This is the in-game magazine. This is produced by an editor who receives a tap  of news generated in-game and can pick and choose what to write about. It’s a modest cost per issue, only a few Glitz stars and the editor receives 75%.

As with all battle plans, this will change as the game grows and I may scrap some or come up with new ideas.

 

Trying to go schemaless

Trying to go schemaless

3.5" Floppy disks
Image by PublicDomainPictures from Pixabay

In my post SQL or NoSQL two days ago, I was dancing around the problem which is I am trying to avoid using a schema for the game’s database tables. NoSQL allows this, whereas a relational database of fixed schema tables (SQL) s more restrictive.

One reason for this is to make it easy to add new features without having to run an upgrade every time I want to add say a column in a table. I’m moving towards some key of key-value store.  This is not a real-time game but a more traditional data-processing engine which reads in a lot of data then process it and then writes out the altered data.

The data quantities are not really that big, a maximum of 10,000 players in one game using 10 KB each so maybe 100 MB of data so it could all be managed say by storing the data in JSON files rather than a database.

In the past I might have used a SQL database and I have used SQLite in a desktop application. It is fast, but if I can hold everything in RAM it will be faster still.  JSON does bulk up data a bit but nothing like as bad as XML which can be five-six times bigger.

Back when I programmed something comparable to this in 1989-1990, these (in the picture) were the standard media. Hard disks had not been around long and were quite expensive! These could hold a whopping 1.44 MB each.. CDs for data did n’t even exist then.