roguelike games in c sharp

  • Thread starter Thread starter Thund
  • Start date Start date
T

Thund

Hello group,

Please can anyone tell me some guidelines how to make roguelike game (like
ADOM) in C# ? Is there any guide, reference, tutorial, resource on internet?
It would be really helpfull to me, thanks alot.

Goran, Croatia
 
Please can anyone tell me some guidelines how to make roguelike game (like
ADOM) in C# ? Is there any guide, reference, tutorial, resource on internet?

This is an extremely vague subject. Pragmatically, I don't think that
anyone has ever thought of putting the question that way - how to
write a game of a specific genre in a specific language. I can
understand the issues surrounding the game design, but as for the
actual implementation - well, either you do know C#, or you don't;
whether you want to use it to write a roguelike game or an accounting
application doesn't really matter. First, you need to know the
language - any C# starter book will do. Then, you might want to study
object-oriented design - all games map very naturally onto OO, since
they are essentially simulations, and it is what OO was originally
designed for. Last, you sit down and write it according to the design
document :)

If you have any specific questions, such as: how to draw stuff on the
screen in text mode (since you mention ADOM), or how to handle
keyboard input, or how could C# events be used in the simulation -
those can be answered or at least discussed. But it's best to do that
in separate threads.
 
Well thanks Pavel, and sorry I was not so specific :)
I did read some introduction book for c sharp so i know
it just in theory (so i am a newbie). I know i need a lot of
practice in language, and i would like to start on project like
roguelike game.
For first problem i tramped onto is how to move cursor
through the Console using curses?

For example you have a room. (sorry on being so picturial, but i cant
explain any other way)

xxxxxxxxxxxxxxxxxxxxxx
x x
x O x
x x
x x
xxxxxxxxxxxxxxxxxxxxxx

First, how can i use cursor to move throughout the room, second how
can i use O character to move throughout the room?

p.s. maybe it would be a much help some source code in c sharp for such
games,
but i found it impossible to find on net.
I hope I was explainable enough :)

Greetings, Goran

Please can anyone tell me some guidelines how to make roguelike game (like
ADOM) in C# ? Is there any guide, reference, tutorial, resource on
internet?

This is an extremely vague subject. Pragmatically, I don't think that
anyone has ever thought of putting the question that way - how to
write a game of a specific genre in a specific language. I can
understand the issues surrounding the game design, but as for the
actual implementation - well, either you do know C#, or you don't;
whether you want to use it to write a roguelike game or an accounting
application doesn't really matter. First, you need to know the
language - any C# starter book will do. Then, you might want to study
object-oriented design - all games map very naturally onto OO, since
they are essentially simulations, and it is what OO was originally
designed for. Last, you sit down and write it according to the design
document :)

If you have any specific questions, such as: how to draw stuff on the
screen in text mode (since you mention ADOM), or how to handle
keyboard input, or how could C# events be used in the simulation -
those can be answered or at least discussed. But it's best to do that
in separate threads.
 
There's no curses support in .NET per se. But, the console window
does, if I recall correctly, support ANSI terminal control codes,
including cursor movement. So you could easily write your own curses
library for that purpose.

Once you've got that, then the "how" of moving the character
representing the player around the screen is the same as it would be
in any other context.

Pete

System.Console has a SetCursorPosition() method that will move the cursor
around as well as a bunch of other methods that do curses like things.

joe
 
Well thanks Pavel, and sorry I was not so specific :)
I did read some introduction book for c sharp so i know
it just in theory (so i am a newbie). I know i need a lot of
practice in language, and i would like to start on project like
roguelike game.
For first problem i tramped onto is how to move cursor
through the Console using curses?

Just to clarify - why would you need Curses for that? .NET BCL has
pretty much everything you should need in System.Console class -
specifically look at ReadKey, Clear, Write and SetCursorPosition
methods, and the ForegroundColor, BackgroundColor and KeyAvailable
properties of it.
For example you have a room. (sorry on being so picturial, but i cant
explain any other way)

xxxxxxxxxxxxxxxxxxxxxx
x                                   x
x             O                   x
x                                   x
x                                   x
xxxxxxxxxxxxxxxxxxxxxx

First, how can i use cursor to move throughout the room

Do you mean the cursor keys on the keyboard?

Assuming your game is turn-based in the same sense ADOM is (every user
interaction is a turn), you'd have a main loop along these lines:

class Actor
{
...
int x, y;
void MoveBy(int dx, int dy) { x += dx; y += dy; }
...
}

void Main()
{
Actor player;

// initialize game world
...

// main loop
while (true)
{
ConsoleKeyInfo keyInfo = Console.ReadKey();
switch (keyInfo.Key)
{
case ConsoleKey.Escape:
return;
case ConsoleKey.UpArrow:
player.MoveBy(0, -1); break;
// etc for all other keys you want to handle
...
}
// let all other objects in the game world make their turn
}
}
second how can i use O character to move throughout the room?

This question I don't understand at all.
p.s. maybe it would be a much help some source code in c sharp for such
games,
but i found it impossible to find on net.

I'm not sure there are any; at least I don't know any roguelike
written in any .NET language. It's a good training exercise for better
understanding of OOD, as well as some C# subtleties, but the real
games like that usually take a very long time to implement, and the
community seems to be rather "old-school"; so most of it is in C/C++.
 
Back
Top