Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Saturday, 8 October 2011

Daemon

I've scrapped the idea of rewriting Kharne. I'm currently coding the occult-themed roguelike as a new game called Daemon using C# and the libtcod.NET library.

I'm aiming to get a first version out (under the GPL) by the end of the month or so. It will be a complete game with save/load and a win condition, as I've largely used the framework I wrote for my 7DRL, Stygia.

Have some gratuitous screenshots:




Sunday, 18 September 2011

Welcome Kharne v3

So, I've decided to take my existing 7DRL, Stygia (which is a complete game) and use it as a framework to commence an in-parallel (and much less ambitious) rewrite of Kharne, using C# and Libtcod.NET. This one will have a slightly darker, less generic theme (with a magical system based entirely on Goetic magick) and will focus more on atmosphere and personal horror.

No doubt there will be extra-dimensional tentacles involved somewhere.

Don't worry, there will be another release of the existing Kharne (Alpha 24) shortly.

And this mysterious text below? Why the big bad himself, that you will have to defeat. Kudos and a hug to the first person to recognise the language.

Saturday, 17 September 2011

Thursday, 25 August 2011

Hmmmm

I'm really tempted to start rewriting Kharne in C# using Libtcod.NET

Tuesday, 4 May 2010

C# Cartesian Point class

I've developed a class for using Points in C# (unlike Delphi, there's no inbuilt type). You can grab the source code and a sample console app here or here. All code is public domain, knock yourself out, etc, etc, etc.

Sunday, 25 April 2010

Stygia - weekend 1

So, weekend 1 of Stgyia coding completed. Time spent so far: 3 hours. Managed to get the title screen and a framework set up (albeit in a glorified hello world-esque application):

But this is the same as his previous hello world application, I hear you cry. Not really. This is using the new C# wrappers for libtcod. I pretty much had to rewrite from scratch all my code.

Next stop, a main menu framework and doing some more framework code, so I can progress onto Step 3.

Incidentally, as well as the sources mentioned previously, the plot will also be inspired by this old (and criminally underrated, IMHO, CRPG).

One other thing I'm intending to do within the three months is to write all my data maintenance tools in ASP.NET.

Saturday, 24 April 2010

Stygia - a 3-month Roguelike

It might have been obvious that I've been having some thoughts recently about rewriting Kharne in C# using libtcod.

This would mean rewriting an absurd amount of code from scratch.

I don't want to do that, however, I've got a powerful career incentive to learn C# properly.

So I'm going to turn the work I've done already on Prelude into a new Roguelike, which I'll develop in parallel with updates on Kharne.

This one will be called Stygia, and I've set myself a strict 3 month timescale to get a complete game out, following the steps outlined here.

Stygia will be loosely inspired by this particular classic CRPG and somewhat more by this classic roleplaying game. Features wise, it will follow the usual roguelike conventions, but with a more heterotopic and dystopic vibe.

It might even have tentacles in it. Scratch that, it WILL have tentacles in it.

And lots of san loss.

Thursday, 22 April 2010

An experiment....

Using Libtcod.NET and C# with Visual Studio 2008. I shall have to ponder what this means.

Friday, 16 April 2010

C#/Libtcod.net revisited.

I never got very far in the end with using libtcod.net to write a C# roguelike. Mainly due to various issues with setting it up, and a general development ennui which had enveloped me over the winter (major personal issues & upheaval didn't help either).

I do see that there's a new version out now with improved C# documentation. I don't intend to start work on a C# roguelike until I get Kharne complete.

But after that I may end up writing some additional optional features (such as a hiscore/chat server in ASP.NET, which I have to learn soon for my day job.

Tuesday, 30 June 2009

Prelude C# Excerpt #1

Prelude, if you didn't already know, is my proto-Roguelike in C#. I'm using it as a testbed to develop some concepts for importing into Kharne, as well as developing (hopefully) an enjoyable RL in C#.

To whet your appetites, this is the current version of the main AI loop for each creature. Its not a particularily complicated AI, but it is sufficient to givc the appearance at least of intelligent enemies.


// Namespace: Kharne.Creatures.Classes
// Class/Method: Creature.DoStuff()

///
/// The main creature AI behaviour routine
///

public void DoStuff()
{
// Paranoia Check
if (_alive && _awake && _energy > 0)
{
// If the creature is carrying an item that it can use or wants to use, then use it instead of doing
// something else (e.g. drinking a potion if it is at low health)
if (!_UseCarriedItem())
{
// If there is an item on the current square, and the creature judges it to be of value then
// pick it up and do nothing else
if (!_PickupItem(new Item()))
{
// TODO: also allow orders to influence what a creature does, for example, if a creature is
// a minion of the player or another creature

// The status of the creature governs what it does. Beserking differs from normal
// behaviour in that the creature will not cast spells nor will run away if brought
// to low health but will rather will stand and fight
switch (_status)
{
case CreatureStatus.BERSERK:
case CreatureStatus.NORMAL:
{
// Do we have a direct line of sight from the creature to its target?
if (_CanSee(_target))
{
// Update the target location since we can see the target
_targetLocation = _target._location;

// If the creature has mainly melee-based attacks and isn't adjacent
// to its target then attempt to move one square closer (movement is
// calculated using an A* algoritim). Note that the _Move routine deals
// with opening and closing doors on a creature-by-creature basis
if (_AI == CreatureAI.MELEE || !_Adjacent(_target))
{
if (_status == CreatureStatus.BERSERK)
{
// If we're beserking, then simply move.
_Move(_target.Location);
}
else
{
// Some creatures can cast spells, but there is only a certain
// chance of this happening, so check to see if we can cast a
// spell, if we want to, and if so, cast it
if (_CanCastSpell() && !_CastSpell(_ChooseSpellToCast()))
{
// Don't cast a spell so move towards the target
_Move(_target.Location);
}
else
{
// Can't cast a spell, so just move
_Move(_target.Location);
}
}
}
else if (_AI == CreatureAI.MELEE || _Adjacent(_target))
{
// Next to its target so let rip with melee attacks!
_Attack(_target);
}
else if (_AI == CreatureAI.RANGED || _Adjacent(_target))
{
// The first priority of creatures that have ranged attacks is to
// move to their preferred distance. In both cases below, if we can't
// actually move (due to another creature or the terrain) just attack
// anyway with ranged attacks
if (_Distance(_target) < _preferredrange)
{
if (!_Move(_GetMoveAwayLoc())) { _Attack(_target); }
}
else if (_Distance(_target) > _preferredrange)
{
if (!_Move(_target.Location)) { _Attack(_target); }
}
else
{
// Like the melee situation, check to see if we can cast a spell
// and if so, cast one. If we don't do any spells, just attack
// anyway with ranged attacks
if (_CanCastSpell() && !_CastSpell(_ChooseSpellToCast()))
{
_Attack(_target);
}
else
{
_Attack(_target);
}
}
}

}
else
{
// We can't see the target, thus we move to the last location that we hold
// for the target - of course the target may have moved
_Move(_targetLocation);
}
}
break;
case CreatureStatus.AFRAID:
{
// If the creature is afraid, then highest priority is to move away from the
// source of its fear, but if it can't then turn and prepare to fight
if (!_Move(_GetMoveAwayLoc())) { _status = CreatureStatus.NORMAL; }
}
break;
}
}
}
}
}

Sunday, 28 June 2009

Richard Stallman: Sage or Misunderstood Genius?

"The danger is that Microsoft is probably planning to force all free C# implementations underground some day using software patents"

Richard Stallman, giving his reasons not to use C#.

Incidentally, he also has some...unusual views regarding web browsing:

"For personal reasons, I do not browse the web from my computer. (I also have not net connection much of the time.) To look at page I send mail to a demon which runs wget and mails the page back to me. It is very efficient use of my time, but it is slow in real time."

Back in my university days (somewhere in the Pre-Cambian era), writing just such a program as this was our introduction to C (granted, we didn't use good old wget but instead we built our own process to do the same thing that used the Berkeley Sockets Library instead).

UPDATE 29/06/09: A member of the Debian Mono Group responds.

Monday, 11 May 2009

Hello World Libtcod.NET Style

After quite a bit of unanticipated kerfuffle,I finally got the libtcod.net demo project to compile and run:


Its a start. :-)

Friday, 24 April 2009

Prelude

The name of the new project will simply be 'Prelude'.

I've done some experimenting already with data structures and classes, leaning heavily upon what I've learned so far in coding Kharne. This has proceeded a quicker than first time around for two main reasons: firstly, I'm rewriting code I've already largely written; and C# is proving to be an excellent language for this sort of thing.

As soon as I've figured out how to post code properly to blogger without it messing up the formating, I'll post some codesnippers.

Wednesday, 22 April 2009

An announcement.

My day job mainly involves using Delphi but the place where I work is moving to .NET and later this year, I'll will be taking the TS: Microsoft .NET Framework - Application Development Foundation Exam 70-536. As part of the learning process, I've decided to write a cut-down mini version of Kharne in C# (using the .NET 3.5 Framework) applying some of the lessons I'm currently learning in writing the main game. I intend for this mini-Kharne (I need a new name for it!) to be a prelude to the main game and to be something akin in size and complexity to Dweller.

I'm confident this won't affect development of the main game, as I've set myself limited goals and scope:
  • A single dungeon with only a few levels.
  • Only a dozen or so items with perhaps a half-dozen brands at most.
  • A dozen or so different monsters.
  • Only a few skills.
  • Only two classes: Fighter and Mage.
  • No Races and only four main stats: STR, DEX, CON, INT
  • Only a few families of Spells.
  • Traditional ASCII Display using libtcod-net.
  • Simplified Inventory handling.
Effectively, in terms of effort, its a 7DRL spread out over a period of a couple of months. Eventually, I'd like to allow an export option to export characters from this mini-game to the main Kharne.

In terms of Kharne, the next tasks on the horizon (which have been partially implemented already but turned of in 0.02a) is to get skills, potions and scrolls working. When those are done, I'll release a 0.02b.

Friday, 17 April 2009

Progress Report #14

There's been a bit of an interregnum here recently in terms of development and posting (at least compared to the somewhat crazy standards I set in March), which I can now explain the reasons for. I've not done any coding on Kharne for a week or so, because I had the threat of redundancy looming (I'm a Delphi developer by trade at a smallish company which has been affected by the current economic climate). But that's been sorted out now and the threat has been lifted, and valuable lessons have been learned, so I'm looking forward to restarting coding on Kharne and getting v0.02 out soon!

In the long term this means I will focus more development towards C# but for now, Kharne will continue to be written in good old Delphi!

Thursday, 19 March 2009

News and Updates

There's going to be one more interim Alpha 1 release for Kharne, which will try and fix a possible problems with fonts that has been reported.

Following the comments in this post, I'm going to start work on an equivalent of a 7DRL (albeit over a longer period) in C#, mainly to learn the language. Don't worry, Kharne will not suffer from this, but it will be a platform for seeing how C# compares to Delphi.

The title?

QuantumRogue.

Tuesday, 10 March 2009

C# and climbing aboard the Microsoft Juggernaut

I really need to learn C#. Its a shame in a way Kharne is being written in Delphi. I'm not keen on the baggage surrounding C# (i.e. the .NET framework) but if I was starting again, I'd do a roguelike in C#.

I might however write a Vault/Data Creator/Editor and other support utilities in C#. Kharne itself will stay Delphi for now.