Lua and ENet upgrades

Summary: In the next release of Knights I will be upgrading the versions of ENet (a networking library) and Lua that are used by Knights. I will also be removing some custom patches to Lua that were being used previously. This will have the following effects:

  • Users will have to upgrade their game client (because the new ENet version is incompatible with the old one).
  • The Lua code for mods might need to be updated.

Lua Change

I have updated the version of Lua used to the latest version, 5.4.6 (previously it was 5.1.4).

The previous versions of Knights also included a custom Lua patch (written by me) which added a new “&” operator to the language. This was used for merging tables, for example one could write code like the following:

i_wand_of_destruction = kts.ItemType(
  basic_wand & {
    melee_damage = 1000,
    melee_stun_time = rng_time_range(2, 3),
    melee_tile_damage = 1000
  }
)

This would make an ItemType that had all of the properties from the “basic_wand” table, together with the new properties shown.

Adding the “&” operator to Lua seemed like a good idea at the time — but it does cause problems, because it means I can’t easily upgrade to newer versions of Lua (as I would have to port my patch across to the new codebase every time).

So, from now on I am removing this patch, and the “&” table-merge operator will no longer be available.

Instead I have written a Lua function that does the same thing:

function table_merge(a, b)
    local result = {}
    for k, v in pairs(a) do
        result[k] = v
    end
    for k, v in pairs(b) do
        result[k] = v
    end
    return result
end

This function is available as “kts.table_merge”. Therefore the above “wand of destruction” code must now be written like this instead:

i_wand_of_destruction = kts.ItemType(
  kts.table_merge(
    basic_wand,
    {
      melee_damage = 1000,
      melee_stun_time = rng_time_range(2, 3),
      melee_tile_damage = 1000
    }
  }
)

This does make the code a little bit uglier I suppose, but it is not a big problem and I think this is a small price to pay, in exchange for making it much easier to do Lua upgrades in the future.

Of course, any mods that were using “&”, must now be modified (no pun intended) to use “kts.table_merge” instead, but this shouldn’t be too difficult.

ENet change

I have also taken the opportunity to upgrade ENet from version 1.2.5 to the latest available version (on Windows this will be 1.3.17, as this is the latest VCPKG package available; on Linux it will be whatever is installed on your local system, which will hopefully be reasonably up to date).

The main issue here is that ENet 1.3.x is incompatible with 1.2.x, so users running the older versions of Knights will not be able to connect to the new Knights server. They won’t even get any message telling them they need to upgrade; the connection will just fail completely.

To mitigate this, I’ve arranged for the “Connect to Server” screen to show a message like the following when players try to connect:

Screenshot showing error message asking the player to upgrade to the latest version of Knights.

Hopefully this will be enough to let players know what they have to do, and it won’t be a huge issue.

Knights 26 Released

A new version of Knights has been released!

This is basically just a maintenance release. I have fixed various issues with the codebase and brought the code up to date (e.g. upgrade to latest Visual Studio version, upgraded various libraries to new versions). There are no actual gameplay changes.

The release can be downloaded from: https://www.knightsgame.org.uk/download

I plan to do another release after this one with the following changes:

  • Fix the bugs that Knight_Rider has posted about recently (potion changes and staff damage when using super/strength).
  • Fix a bug I noticed with chat (pressing the keypad enter doesn’t seem to send a chat message, although pressing return on the main keyboard does).
  • More changes to upgrade the codebase (e.g. remove deprecated C++ features, upgrade to latest Lua version).

So stay tuned for that within the next few weeks 🙂

For more information about Knights, please visit http://www.knightsgame.org.uk/.

Knights now on GitHub

I’m pleased to announce that I have finally moved away from SVN and moved the Knights source code into Git.

The Knights source repository is now available at: https://github.com/sdthompson1/knights

I’m also, slowly, bringing the code more up to date — e.g. updating to the latest Visual Studio version for the Windows build, moving from SDL 1 to SDL 2, removing some outdated C++ constructs.

This process will continue over the next few weeks, but hopefully fairly soon, I will be able to make a new release of the game! (The first in many years.)

Lua doc updates

I did a bit more work on the Knights Lua documentation project today. The following functions have been added to the docs:

  • kts.AddMissile
  • kts.AddMonster
  • kts.AddMonsterGenerator
  • kts.CloseDoor
  • kts.Control
  • kts.IsDoorOpen
  • kts.LockDoor
  • kts.MonsterType
  • kts.OpenDoor
  • kts.OpenOrCloseDoor

There is still a lot to do, but this is a good start 🙂

For more information about Knights, please visit http://www.knightsgame.org.uk/.

A quick Update

Hello, I hope everyone had a good Easter.

I am conscious that I haven’t made any Knights updates for about 10 years now (where did that time go!), but I feel that the time has now come for me to start working on the game again!

For me the priorities for now are:

  1. I need to get Knights working on my computer again. Unfortunately the Knights Linux build doesn’t work currently (some Makefile changes are needed apparently) and I only have a Linux machine right now (so I’m unable to use the Windows installer, at the moment). So my intention is to figure out how to fix the Linux build and then make a new Knights release (the first for some years in fact).
  2. I am going to add a “Lua Docs” section to the website to replace the old Lua documentation that used to be on the Trac site (which was unfortunately lost some time ago).
  3. I would like to move the Knights source code from its current SVN repository onto GitHub.

After that, we can start thinking about what we want to do with the game next, in terms of new features or whatever. But the above should be a good starting point.

That’s it for now — I’ll post again fairly soon with an update on how it’s going.

For more information about Knights, please visit http://www.knightsgame.org.uk/.

Server move complete!

The Knights server move described in the previous post is complete, and the server is running at its new home without any (known) problems.

I have also enabled HTTPS support, so you can now access the home page at https://www.knightsgame.org.uk/. (For now, both HTTP and HTTPS are working, but I may turn off the old HTTP site, or redirect it, at some point.)

As always, if you spot any problems please let me know in the comments below, or by email to stephen (at) solarflare.org.uk.

Planned server move this weekend

Dear all,

First of all, I’m sorry for not updating this site very often these last few years. Basically I have been busy with my full-time job and “real life” and just haven’t had much time to work on indie game programming projects for a while. I do hope to get back to it sometime, but probably won’t be able to do too much for at least the next year or two, unfortunately.

Also, I hope everyone reading this has been staying safe during the pandemic.

The reason I’m writing today is that I’m going to be moving the Knights server (and my personal website) to a new hosting provider. (My existing provider has said they will be discontinuing VPS hosting at some point in the future, and also I can save a bit of money by moving to a cheaper company, so now seems like a good time to do this.) I notice there is a Knights game planned this Saturday so I’ll try to fit in the work either Saturday evening after the game has finished, or Sunday morning. That should give plenty of time to fix things if everything starts going wrong 🙂 (especially since Monday is a holiday here in the UK as well).

Of course I hope (and expect) that it will all go smoothly, but there might still be a little downtime, so basically what I want to say is, don’t panic if the site is inaccessible for a time, I will be working to get it back again as soon as possible!

Any concerns, drop a note below or email me at stephen (at) solarflare.org.uk.

Thanks to all Knights players for your support over the years!

Stephen

Bug tracker changes

We have quite a few issues on the Knights bug tracker now, so I’ve decided to tidy things up a bit by sorting them into categories. I’ve used the “Milestone” field to represent the categories, and have created new Milestones as follows:

  • 200 – Major Bugs
  • 300 – Minor Bugs
  • 400 – Improvements/New Features
  • 500 – Lua bugs
  • 600 – Lua improvements
  • 900 – Gameplay ideas/suggestions

(The numbers are just to make them sort in the order we want.)

The best way to see the results is to look at the Active Tickets by Milestone page.

I plan to start clearing some of the bugs over the next few days/weeks, then maybe we can move on to some of the more interesting stuff after that.

Knights update Oct 2015

I know things have been quiet around here lately. But recently there have been a few discussions about how to move forward with Knights development. So first of all I’d just like to make a list of some of the things that we’ve been discussing:

  1. There was talk of making a Steam version of Knights. My feeling with Steam is that you really just get one shot at it — at the initial launch, there is a lot of interest, but it dies down a lot afterwards. Therefore, it’s probably best to wait until we have a really polished version of the game (e.g. fix all the outstanding bugs) before contemplating a Steam release.
  2. There was also talk of porting to tablets (and also Mac) although I think similar comments apply.
  3. Some people complained that when a knight hits another knight from the side, the second knight is “stunned” (unable to move for a moment) which gives too big of an advantage to the first knight. To try to rectify this I made a mod that removes the stun effect, and put it on the forum. We tried this out a bit last weekend, the conclusion was that it works quite well but probably needs some more tweaking. So that one is “ongoing” 🙂
  4. One of the biggest problems with the game is that certain quests just get into a “stalemate” situation at times. This can happen with Duel to the Death and sometimes with Destroy Book with Wand. Unfortunately it’s not obvious how to solve this — this is something we’ll have to think about at some point in the future.
  5. Someone emailed me to complain that the knights just “glide” along smoothly, so they look as though they are floating through the air instead of walking. This is a reasonable point… although speaking personally it doesn’t really bother me that much (I wonder if anyone else is annoyed by this?).
  6. There are a few minor bugs / improvements we could do, including:
    • Sometimes sounds are heard throughout the dungeon, instead of only in one room as they ought to be.
    • Sometimes daggers/axes fly right through people without hitting them.
    • On Windows 10 on “high DPI displays” the display is upscaled making the text look blurry. (Need to make the app “DPI aware”.)
    • The official server should appear as knightsgame.org.uk instead of vps.solarflare.org.uk (just to make it look slightly more official).
    • Apparently the “password protected” mode for the server doesn’t work.
    • There should be sounds played when someone connects, and perhaps when they type a chat message as well. (Of course there should be an option to disable this if people don’t want it.)
    • Skull graphics sometimes point the wrong way (because they don’t rotate correctly).
    • The “my sword broke and turned into a dagger” bug.
    • The wand of teleport mod needs to be fixed to use the proper Lua “get random square” function. (Also maybe it should be made so that it only teleports one in two, or one in three hits.)
  7. Tinari also made some suggestions:
    • Perhaps poison should kill you slowly over 10 seconds or so instead of instantly. This would give you time to look for a healing potion (or take out another knight before you go!).
    • “Permanent magic” options e.g. a game mode where you always have quickness, or are always invisible, etc.
  8. It was mentioned that players sometimes just turn up to the server, see there are no games at the moment, then go away again (and don’t come back). Perhaps we need to advertise more strongly that there is a weekly game every Saturday and you should turn up to that if you want to play.
    • This is one area where Steam and/or tablet support would be useful, because users can easily be given notifications when their friends are playing Knights…

In summary I think the best way to go forward is probably to try to squash some of the minor bugs and add the smaller improvements (like sounds to identify when a knight joins, that sort of thing). These have the advantage of being fairly easy to fix, so it should be possible to make progress without needing to sink loads of time into it.

After that, we can consider some of the more interesting issues, such as game design changes that we may want to make.

As always, feel free to comment on any of this stuff below 🙂

For more information about Knights, please visit http://www.knightsgame.org.uk/.