Feb 282013
 
No Gravatar

I've been an occasional, but eager, dungeons and dragons player for many years. However I did not get the full view of what being dungeon master truly entails until recently, when I agreed to become DM of a new campaign I launched with some friends. It was hard work – so many rules, dice rolls, modifiers and class-bonuses, if you don't have a lot of experience, they are a nightmare to all keep track off.

Now of course, I'm a programmer, programmers never do a difficult thing twice if we can get a computer to do it for us. Some googling turned up quite a few useful tools for tabletop gaming and DM-ing but none of what I really wanted – something that I could run on a netbook at the table, to ensure things like combat went correctly, ensure all the rules and modifiers were applied – but would not get in the way of storytelling. It shouldn't even require that you use computer dice. 

So, I set out to write one. EZDM is written in python, using json files for all data – json stores the rules, the character sheets, the modifiers – everything. The current system contains all the data needed for DM-ing an AD&D 2E game – I have no plans to add others but if anybody wants to it should be quite simple provided you can operate a text editor and do a quick study of the JSON format (and also adjust the code as a few bits of the stuff are code-wise, this may change in future).

 

The system's data needs are cut down by it's very core design of "not getting in the way" – so nothing is enforced more than absolutely required.  So for example the DM can choose to create custom modifiers for an attack on top of (or instead off) what the program knows about to account for things that came out of the story. The system can use either automated or manual dice with equal ease as well.

EZDM provides a simple character sheet creator, these don't store all the data about a character (things like inventories remain on the paper-copies), but it does store everything needed to operate combat sequences correctly, including multi-turn spell-casting and interruptions for example. By simply creating sheets for all your players and whatever monsters you have planned, you can have ever combat go exactly as it should.

 

There is a specialized viewer for the character sheets included to let you quickly glance at them, and the character sheet maker also works well for editing sheets if you aren't comfortable editing json by hand.

The next tool is a tool to grant XP to characters, this will automatically add the proper XP and level characters up when they reach the correct points for their class – it will then ensure they get the right number of hit-dice added to their hitpoints and finally remind you to check the DM-guide for updates to their other abilities (I may add these in a future version so they can be displayed, and possibly even stored).

The final tool is the quickcombat tool, which works in a very simple linear manner. You load up all the characters (and monsters) involved in the combat, choosing which ones to use automatic and which ones to use manual dice for. The system then handles initiative rolls and lets the combat commence, each character in turn chooses to attack, cast, flee or heal. Remember that this is a tool for dungeon masters, so players must not use it, with the heal option a dungeon master can account for things like a player drinking a healing potion during the fight – tell it the dice type to roll and the system will restore the rolled HP back to the character. The flee option is completely without rules, the DM simply informs the system of whether the flight is successful or not, if it is the character is removed from combat (If is it not, the DM will probably give a "attack from rear" modifier to the next person who attacks him). Casting simply asks the number of turns (and correctly accounts for spells that take rounds rather than turns) and the target of the spell (characters can target themselves) and then reminds the DM on each turn that the character is still casting, until the cast is zero at which the "complete spell" option becomes available. Choose this and it will roll for spell success based on the characters correctly calculated spell failure rate. Then the DM can choose from three basic spell effects: healing spells (which operate exactly like the heal option but heals the target, whether or not that's the caster), damage spells (which asks the maximum damage and rolls it – and also handles the target's saving throw against spells (and then subtracts the right highpoints if all goes well). 

Finally the attack option, when choosing to attack the DM can immediately choose which specific modifiers apply to this turns. Has the enemy turned his back ? Has the attacker reached higher ground ? You can add any of the standard DM guide modifiers automatically, or create a custom modifier (with just the number) to account for anything else which will affect the attacker's chance to hit and is created by story rather than a specific rule (like I said, this is a DM helper tool, not a replacement for DM-ing properly). Then it will do an attack roll, calculate the attacker's thac0 and the defenders AC – including all appropriate modifiers and work out if the attack succeeds. If it does, it will likewise handle damage rolls and possible saving throws (including saves against death).

All this can be done in the console, or with a GUI – and you can choose :D 

The program is now version 0.0.5, and this is the first stable public release of a program I have been working on extensively for weeks. At this stage I am not aware of any remaining bugs in the extant features. It is released under GPLv3 as free and open source software for anybody who can use it, or would like to help improve it. It has been mentioned to me that this code could easily be used as the basis of a computerized RPG and I do have some rather fun ideas in that regard but more on that later. The next major feature is a map-editor/viewer which will store maps as smart JSON files with object refferences, the code for that is fully written in my brain but needs to be coded and tested  and I didn't want to further hold up the public release of the current program while working on that.

The program should work fine under windows but as I have no windows machines I cannot package it for that, if somebody feels up to doing so – please respond to the issue on GITHUB. For GNU/Linux users, you can grab and install the sources directly from github or for ubuntu/debian/mint users there is a regularly updated PPA you can grab it from. If somebody helps build packages for other distros, that would be great.

Feb 082011
 
No Gravatar

Those who recently updated to the new WordPress 3.0.5 and also upgraded to the latest Constructor theme may have discovered that suddenly their wp-admin system started throwing an error 500. This is due to a bug in the new constructor (at least with the latest wordpress – I  suspect a fix would have  been out already if it had been present in earlier releases).

 

Luckilly it's quite easy to fix. Using FTP or shell or whatever method you have, go into your wordpress directory and then edit this file:

wp-content/themes/constructor/libs/Constructor/Admin.php

Go to line 31 which reads:

session_start();

Replace it with this:

//session_start ();

echo "";

What does that do ? The two slashes removes the session_start method (which is the cause of our problem here). However said line is in a big if statement and getting it all nicely out without breaking syntax would be tricky – easier to just replace it with the echo ""; line – which is simply a line that tells php to print absolutely nothing to the screen (the equivalent of a valid "don't do anything" command – but it keeps the syntax structures good and makes for the easiest way to implement the quick fix (especially for somebody who can't program.

The change is obviously related to php sessions – which works fine in all my other code including wordpress itself, so it seems to be either a bug with the latest wordpress and constructor – or the latest constructor and ligHTTPD. Either way, this quick work-around will get your admin screen working again until a proper fix is available.  

Apr 082009
 
No Gravatar
Framstag: Nobody finds comments in my code.
Framstag: That is, because nobody's looking for
Framstag: comments, since, nobody (except me) writes them
silentcoder: my code is commented in hieroglyphic ascii art
silentcoder: {
silentcoder:    __
silentcoder:   /   \
silentcoder: / | | | | >
silentcoder:  <___________/ 
silentcoder: }
Framstag: Looks like those Dr. Who thingies
silentcoder: roughly translated: modify this 
silentcoder: function and the Daleks will get you
Framstag: I can't believe, that those comments work
Oct 292008
 
No Gravatar

Today I posed this message to several of the LUG’s in South Africa. I am reposting it here without edits.

Hi Everybody,
Sorry for the cross-post, I promise it’s a once-off but this is a bit of a special circumstance.
In the grand tradition of GNU and later the Linux kernel, I am beginning with a mail to announce
my intentions, and a request for anybody who shares my vision to help out.
The interest in my CLUG talk about distribution creation some time ago left me thinking that
perhaps there are enough people out there (particularly here in South Africa) who may feel up to
the fun and work of helping to create something special. Having spent 5 years creating a
successful commercial distribution, I believe I have the skills for such a project to be workable, though this one is meant to be very different as you’ll see.

Starting in the next weeks I want to create a GNU/Linux distribution called kongoni. Kongoni is the
Shona word for a gnu (wildebeest) and this represents the origins of the system: firstly it is African,
secondly it is meant to be a truly free distribution of the GNU operating system.
The name in other words translates literally as: GNU Linux :) (I rather like the wordplay as well).

Fundamental to the design will be an absolute commitment to free software only. That means we will not
include in the installer, nor in the ports tree or any other officially distributed packages any piece of
software that is not under an FSF approved license.
Some degree of the workload can be shared by utilising (and contributing back to) Gnewsense’s list (and blacklist).

Development releases will have a kernel compiled with the no-taint flag – not allowing any non-free drivers to load,
which will be very useful for auditing purposes, where possible we will provide free alternate drivers.
UPDATE: I should have been more clear here. I mean ONLY development releases will have notaint, official releases will not restrict what users can or cannot load.

Where possible I want the system to actively contribute to high-priority free software projects like GNASH and Nouveau,
not least by providing automated scripts in the packages to allow even non-technical users to file automated
bug reports to the projects with usefully information for their needs. Thus possibly increasing the number of testers
exponentially, the improvements that arise will in turn benefit all free software users and developers.
The system will never be commercial, I have no problem with commercial free software (in fact I run a commercial free
software company) but this project would best benefit from being a true community project. If the need arises to
formalize structures, I pledge that it will be done by registering a charity organisation, or joining an existing one
– not by starting a company. If people some day want to start companies that sell services related to the system however
more power to them.

Now on to the initial technical details. First off, I don’t think there is any room in the market for yet another Ubuntu
respin. Ubuntu is a nice system in many ways, but the need is met – and Gnewsense already provides a fully free alternative
to fans of Ubuntu. Instead I believe there is room for new ideas and new thinking.
To this end I want to start with a slackware/bluewhite64 baseline initially targeting x86_32 and x86_64 platforms.
Slackware has many advantages as a baseline and offers enormous power of (easy) customization to give the system a real
unique identity while staying true to standards.
The biggest catch is addressing slackware’s number one shortcoming for desktop users: the limited package manager.
To address this, and also minimise the workload of multiple platforms, I intend to use portpkg to provide a ports tree
that is fully tracked for dependencies. Among my first coding tasks will be a full graphical frontend for portpkg as well
as a series of patches to portpkg itself to allow us to maintain our own ports trees as default. These will consist
of license-audited and dependency-mapped clones of the slackware/bluewhite64 repositories for upstream, and source-only
ports for 3rd-party packages. It is important to maintain our own ports tree since unfortunately all the default ports
available in portpkg include non-free software in their package lists. While we cannot (and should not) prevent users
adding those repositories and installing such proprietary packages – we should not give this action any official support.

The initial default desktop will be KDE4 with intention of including KDE4.2 (due in February) in the first stable release
if possible. OpenOffice.org 3.0 is on the standard packages list, and if the promised GNU/Linux port of Chromium is available by
release time it will be the default browser, otherwise one of the free firefox forks.
An absolute must is a powerful and complete system administration and configuration tool,
utilising things like darkstarlinux’s ALICE suite to complement a full kit for user-admin,
setting up advanced Xorg settings (like multiheads) and other common admin tasks. To ensure
seamless wireless and wired network roaming, wicd will be a default package (and madwifi with the new free ath5k hal for older cards and the newly GPL’d hal from Atheros as well).

It is quite possible that if we have enough volunteers and resources future releases could include parallel versions for
Gnome,xfce,enlightenment etc. and I am happy to include these in the ports tree if somebody helps create the ports.

In terms of project admin I wish to set up a suite of easy-to-use web-apps for contributing, auditing and approving
of ports (the first should be open to all, the latter two to trusted testers only). Designed to make the task
of contributing in this manner not only as simple as possible but to minimize the time needed as far as possible so
that those who choose to contribute their spare time to it can spend as much of that time as possible doing fun stuff
and as little as possible doing drudge work.

The focus of the project is home and desktop users, there are other distro’s aiming at this market but precious few
with a stated mission to be completely free, in both senses of the word.
After freedom, our second most important design principle should be one of “it just works”.

Now of course, as I type this Kongoni is vapourware, the first line of code has yet to be written (though I’ve done
significant amounts of research to make the decisions above, and I have written an installer).
Normally, it isn’t my style to announce something until the first pieces are written but in this case I
find it crucial to the very concept that other people be involved from the start. I have proposed a vision
(not an uneditable one technically) and I want to see who shares my vision and would like to contribute to it’s
realisation. I will be happy to fund hosting for the project and contribute much of my free time to it’s realisation
but I would like to have as many people helping as possible so that this is not just my vision, but our vision.
People who can suggest ideas and improvements, people who can help realise those ideas and help with the
large workload ahead.

If just a few people say “I’m in” – then that’s a go-ahead as far as I’m concerned.

The most useful skills right now will be:
*Web-app programming and web-design
*Ports builders and co-maintainers of the tree
*Graphic design
*Testers

These will likely get official lieutenants appointed on a first-come, first-serve basis.
There is much more to do so if you feel that you can contribute something please feel free to speak up.
If any of the mirror maintainers would be willing to host local mirrors of the ports tree and ISO’s when
we get to release time, please let me know as I have learned from hard experience how even a small distro
release can hit a server.

May I request that those who wish to contribute also reply to me directly as I do not want any
names to get lost in the noise as people discuss the idea.
Finally, I would like to suggest that those who are in Cape Town (once we have a list) meet up
for a face-to-face planning session. Perhaps over coffee on Saturday somewhere in Rondebosch ?

Thank you for reading this far :)
I hope to hear from you.

Ciao
A.J.

Oct 082008
 
No Gravatar

I got my hands on a copy of NeverWinterNights for Linux the other day, and I’ve been playing it whenever I have spare time at night – what a great RPG. Now before the flame comments start, I’m on record as saying I don’t think it’s ethically crucial that games be free software because they aren’t software to begin with – they are art. At least, they art part is far more important than the programming part.
Which is not to say it’s not very good (and certainly a lot better) when they are free software, but like with music it’s good when it happens, but not evil when it doesn’t.

So back on topic, I really enjoy NWN. It’s rules are familiar to anybody who knows even the basics of DnD or has played Nethack for that matter, and it’s filled with tremendous flexibility of gameplay (as befits an RPG). I haven’t tried the online version at all I must admit, but the single player version is really nice. A compelling storyline with the kind of environment that allows you to live that storyline out.

NWN is of course, 32-bit only but I had no real trouble running it on Bluewhite64, all I had to do was grab the 32-bit SDL packages from slackware.com install them in a temp root and copy the usr/lib files into /usr/lib32 and it worked fine ever since.

I did find one nasty – it doesn’t play (no pun intended) nicely with twinview, putting itself in the middle of the two screens spanning halfway onto each. With Xinerama, it works perfectly. Of course Xinerama on NVidia means no compiz effects but I have also found that with twinview enabled my system is really slow and unstable, using Xinerama instead is much faster and works way better under KDE4.

I made one change though, I don’t run it under KDE at all, seeing as I have two screens, KDE needs to keep managing the one NWN is not on, and it’s not like I can multitask that way since the mouse is trapped inside NWN, so that was just a waste of resources, instead I created a .desktop file to launch NWN by itself and copied it into /usr/share/xsessions, now when I want to play it I just select “Neverwinter Nights” from my session menu on the login screen and log in, when I exit the game I’m back at the login screen. I tend to do this with most heavy-on-resource games anyway and I highly recommend it. Being able to completely switch off your desktop while playing games is just part of the real power that GNU/Linux with it’s immense customization offers over other OS’s.

May 122008
 
No Gravatar

I’ve been reading PenguinPete’s series of blogs called “you can hack an OS but you can’t hack people” and I must say it’s a well thought-out, well written piece with a fairly clear understanding of the history of the desktop.
So far it has raised the two biggest problems facing a desktop revolution. It comes down to this: the masses of windows users may want to change -but their culture is one where there was never any problem solving (it wasn’t POSSIBLE to solve problems), it’s one that’s made up of a combination of handholding and blind-clicking, so they need a lot of initial help to get started. The other problem is – they outnumber us thousands to one.

The next problem is that they refuse to read manuals – if you suggest one, you’re an elitist.

These are all valid points – and part of why I said all along we won’t have a year of the GNU/Linux desktop. But we can and will have a decade. Part of the reason why the process is slow – is because it takes a lot of manhours to get a windows user comfortably migrated. A lot of effort – and there are only so many of us to do it.

What Pete has not yet made any attempt to do (granted he has 2 blogs to go in the series) is to actually suggest solutions. The fact is – he is right we cannot do it one-on-one because there aren’t enough of us – and there won’t be for a long time, especially at that rate. So we need to start developing efficient one-on-many support mechanisms. Ways to talk many people through it at once. I think WOLE had been a step in that direction. But imagine something like that in Ubuntu. Something that takes the admin OUT of things that aren’t admin – that makes all the most common setup tasks as simple as the most common day to day tasks have already become.

WOLE did it by looking and acting like an IM client between you and your PC. It handled updates, it handled WIFI and bluetooth setups. Too bad WOLE was never finished- in a 5 year period of very many innovative ideas (many of which are now standard in other distro’s) – I believe it was the best, most revolutionary idea I ever had. Oh well, technology is not always the only question.
It would be nice if other distributions realized it though – added a social aspect to it – and turned the GNU/Linux hand-hold problem into something that worked like self-service but didn’t look like self-service.

I think that’s the crucial aspect, right now the only one-on-many support there is, is googling the problem and getting either a manual or somebody else’s discussion of the same problem on a forum somewhere. This just isn’t good enough.
It needs to be right in there. Wole had to cheat a lot of the desktop concepts to achieve it. Nowadays, with desktops like KDE4 – this is not even needed anymore. Everything WOLE did, and much more, including a user-to-user linking and ‘find users near me’ and all sorts of other Web2.0-ish human-to-computer-to-other-human interaction funky stuff could happen as native and comfortable parts of the desktop paradigm.

So that is the answer I see – and the obvious side-note is that I think the technology that will make it happen (way beyond my little vision of 2 years ago) is already (inevitably) being developed onto the GNU/Linux world.
Guess what, I think you can hack people. Marketroids have been very effectively hacking people for centuries. But you don’t hack them the way you hack code. People aren’t actually very logical. What you need to do to really hack people – is take what used to be difficult and make it fun. Everytime somebody achieves that – he’s about to cause a social revolution.
GNU/Linux has always been that (not only that, but for a lot of people including Torvalds that was the big thing) – making computing fun. The new challenge is to make computing fun for people who are not computer engineers. Everyone has been trying to do this for 30 years of course with mediocre success at best – but I actually think that GNU/Linux is busy achieving it – even if it does look like the underdog. It’s achieving it because ultimately, one of the cornerstone things about fun is that you cannot have fun if there are too many rules. The less rules, the more playtime – and that is why windows can never be fun.
GNU/Linux has been fun for geeks for years, every day it’s getting more fun for non-geeks. And if we crack the computer talking to you the way normal people listen and communicate problem (which I think we’re damn close to …. (tell me, why was WOLE the only program EVER to actually show a DESKTOP VIEWABLE MESSAGE if a disk in the optical drive cannot be read instead of leaving the user waiting for ever and wondering why nothings happening ? I cannot be the only person who ever thought that maybe showing critical stuff from dmesg as popups on the desktop is a good idea ?) … well once we do that, I think the revolution will happen – and who knows – I may even be pleasantly wrong and wake up one day and find out it wasn’t a decade, it was a year after all.

May 052008
 
No Gravatar

After nearly 3 months of very hard (and secret) labor, I can finally reveal my latest project. GeekBling a South African based online T-Shirt shop with a specific focus on computer programmers, savvy users and other geeks of various degrees.

It’s all about pride, and living life passionately. Check it out.
Ifyoucan

Mar 142008
 
No Gravatar

So on #sporks today, we discussed Aargh! I compared it to assembler for chess players, and EvilTerran suggested the idea of an esoteric computer language using chess rules/moves.
I subsequently (with the help of #sporks) designed one. Yes it is possible, it is Turing complete and I believe it can be implemented. A particular thank you to Maximinus who contributed a number of useful ideas.

Starting principles:
Your program is represented by the pieces on a chess board and the board itself. There is a two-byte stack providing state.
Pawns are value pieces, all other pieces are operations. White pawns represent 1, Black pawns represent 0. White blocks on the board are 1 black blocks are 0.
When a pawn is taken, the block it is on represents a bit, the pawn itself another, the piece taking it represents an operation performed on those bits. The result goes in the stack.
When there are 8 bits in the stack, the ascii value represented by the byte they make up is placed on the 2-byte stack.
When operational pieces are taken – the operation they represent cannot be used again in the current game.
If a pawn takes a pawn, nothing goes in the stack, but the pawn is no longer available for arithmetic.

A program consists of a series of games. Each game is started by feeding in a set of starting positions for pieces. All pieces move as in normal chess rules.
Once all the pawns are taken (unless pawns take pawns this means 2 bytes have been placed into the stack – but using pawn-take-pawn you could split stack over several games), the ‘game’ ends and you
feed in values for the next game.

Since you have a theoretically infinite amount of games, the language will be Turing complete if all required operations are supported.

The operations pieces (white) are:
Rook: AND
Bishop: OR
Knight: XOR
Queen: ADD
King: SUB

The black operations pieces represent the NOT’s of their white counterparts:
Rook: NAND
Bishop: NOR
Knight: NXOR
Queen: SUB
King: ADD

A game is begun with a call to start and a set of values representing the initial layout of the board for this game.
The values are given as chess coordinates for all pieces.
The first 8 values represent the white operations pieces’ locations.
The next 8 values represent the black operations pieces’ locations.

Basic example:
start A1 A2 A3…H6 H7 H8
(whatever layout you need) However you can NOT place any pieces on the two center-rows.

Then you need to place the pawns, which are used as input. There are 2 ways to do this.
You can call:
const_pawns
const_pawns takes 16 parameters each a chess coordinate, the first 8 places the white pawns the next 8 places the black pawns. You can place them on
any unused space on the board.
Alternatively you can call:
stack_pawns
Stack_pawns works by itself without any parameters, and places 16 pawns representing the two bytes in the stack.
In this case you may not have a normal chess setup of 8 white and 8 black pawns. The Center rows hold the two stacks as input, it is up to you move the pawns so the values they stand on
represent what you want (initially this is simply a matter of which bit in the byte you have)
The first byte in the stack is placed on the row D1-D8 the second on row E1-E8.
Calling stack_pawns without the stack being full results in an error.

Operating on the stack:
From here on, you write down a set of valid chess moves. Those moves that take a pawn are done as operations and the result added to the output stack.
For example: C7 B4
Means: Piece moves from C7 to B4 (only a knight could do this move btw. But we don’t need to specify the pieces as it’s the interpreter’s job to remember the current location of each piece).
Each operation is written on a new line below the last.
Please note that while you can place any piece ANYWHERE during the start call, you can ONLY make moves for each piece that is allowed under chess rules for during a game.
Once all pawns are removed, you must call start again with a starting position that will allow you to do your next operation. White moves first just like in real chess and moves then take turns.
Some have suggested a variant where games cannot end by merely removing the pawns but require a state of checkmate or a draw to occur – this is still being debated.

Displaying output:
The print command prints out the ascii character represented by a byte from the stack. It takes one argument, either a 0 or a 1.
If it is 0 it prints the first byte in the stack. If it is 1 it prints the second byte in the stack.

Example: print 1

Loops and branches:
The if statement
The program can branch by using the if statement.
If works by performing a boolean test on the two bytes in the stack in the following form:
if OPERATOR then
actions
else
actions.
fi

OPERATOR can be any valid boolean comparison: AND, OR etc. if the result is 00000000 then the if is false, otherwise it is true. It is up to the programmer to place values in the stack that evaluate as he wants it.
Additionally you can also do a boolean operation using the value (0 or 1) of a specific piece (regardless of the type of piece, merely the color determines this).
To do so:
if A5
Where A5 can be any valid chess coordinate. It returns true if the piece on A5 is white, false if it is black or the block is empty.

Actions represent blocks where the programmer can write any valid chesscode commands including nested loops and branches, output or games (which changes the stack).

Calling if without two full bytes in the stack causes an error.

The while loop
Chesscode supports while loops. Like if statements while loops do a boolean operation on the bytes in the stack.
They take the following structure:

while OPERATION
actions
elihw

The actions once more is any valid chesscode commands including games. In fact failing to put games in the loop which will change the stack (and use input from it) to something that ultimately returns false will cause an endless loop.
Like an if statement, calling while on an incomplete stack causes an error.
You can also use a query by coordinates for a while loop e.g.
while C7
In this case, if the piece there is white the loop starts, moving it out or taking it with a black piece leads to a false and ends the loop.

Getting user input.
Like the print command can write a value from the stack to the screen, the read command can read a value from the keyboard to the stack.
It takes a single parameter, which indicates a byte in the stack.
For example: read 1
The user hits a key on the keyboard, the binary representation of the ascii value of this key/letter is then stored in the second byte in the stack.
If you use read 0 instead, then it will go in the first byte of the stack (replacing any value already there).

Ending the program:
Using these structures, you can write all the code to do whatever you need your program to do. When you are finished, call
end
To tell the interpreter/compiler that your program is finished.

Final notes:

Note that all indentation is done for clarity and completely optional. Also note that the EOL character is used as an end of command marker throughout (as opposed to ; for example) so all commands must be placed on a single line.

You are welcome to hate me until the end of time.

Comments are very much desired, and if somebody is up for trying to create a working implementation I would love to know and maybe help.