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
My c# roguelike which is pretty simple is up at
http://code.google.com/p/realtimerl/
John Palmer
Coding a RL in C# is not really different than any other language, you
have to deal with almost the same problems: line of sight, FOV, my
turn your turn, random generations etc.
The real difference is in the fact that you have an entire, rich
framework ready to use, but maybe the question becomes: how to program
with the .NET framework? ;)
Greetings
Chris
I wonder where these really specific questions come from. You don't
see people going around asking "can someone point me to a pacman in
COBOL tutorial?" or "can someone tell me how to program tetris in
javascript?".
The only thing you have to know is that you can use the Console class
(http://msdn.microsoft.com/en-us/library/system.console.aspx) instead
of curses, otherwise there is nothing c# or .net specific you need to
know.
-Ido.
<thep...@gmail.com> wrote in message
news:236ab730-7f07-457c...@l33g2000pri.googlegroups.com...
"Ido Yehieli" <Ido.Y...@gmail.com> wrote in message
news:9b78962f-dc1f-46d0...@j8g2000yql.googlegroups.com...
If you're new to the language, roguelikes might not be the best place
to start, unless you're an uber genius or have significant prior
programming experience in other languages... they are often
deceptively complex!
Not to belittle your skill, but perhaps something like Yahtzee or
Battleship might be a better choice for learning the language? Then
perhaps chess (2-player that is, not vs. an AI - chess AI's are
notoriously difficult even for IBM!), and then a roguelike?
Why not roguelike Yahtzee? :P There's really nothing wrong with
learning programming throuh making a roguelike, as long as you keep
your designs simple to start with. Try to make something the scale of
Nethack to start off with and you're sure to fail.
--
Darren Grey
I downloaded NCursesSharp http://home.nedlinux.nl/~florian/downloads/NCursesSharp.tar.gz
it is a c# wrapper for pdcurses. Not all functions, constants for
keycodes & colors are supported but it will give you a good start.
Are you familiar with Object oriented programming?
As to your question, Im familiar with OOP as a concept and in theory
from reading some of c# books, but never in theory. I made simple
applications
like money exchanger, tic tac toe, random dice generator but never made
with classes *blush*
<jimmy...@gmail.com> wrote in message
news:d6797d77-afc5-4571...@e38g2000yqa.googlegroups.com...
"Ed" <edk...@gmail.com> wrote in message
news:287e1c0a-2431-4ec2...@r27g2000vbp.googlegroups.com...
Please bottom post, top posting makes your messages hard to read.
Usenet etiquette is different than email.
-Ido.
Actually, I think programming a roguelike is a pretty good way to
learn a programming language, for several reasons:
1) You aren't at the point where you need to learn how to code
specific, low level instructions, or how to optimize graphics routines
(for example, why burden yourself with learning DirectX in addition to
your base language). Indeed, nothing could be more simply than select
X, select Y, and print a "@".
2) A roguelike game will teach you some basic concepts, like logic,
arrays, keyboard handling, file handling, etc., that are useful in any
program you will attempt.
2) All your coding is very high level, allowing your code to read
almost like spoken logic: If X > 3 then Y = Y + 1. Any completely
computer illiterate person could figure something like that out. And
really, at the heart of it, Rogues don't really use any complicated
programming structures or techniques...
EXCEPT for (the one place I heartily agree with you) certain
'advanced' topics, like line of sight or pathfinding. But let's face
it - every single one of us out there, regardless of what language we
were programming in, had to sit down and read and understand the logic
of A* or Djikstra algorithms before we attempted to code something
like that. But really, you don't HAVE to have pathfinding in a rogue;
you probably need line-of-sight, but high school trig should pretty
much let you puzzle out how to do a basic raycasting algorithm.
@ the Original Poster: Give it a shot and post what you create here.
The people on this forum are for the most part very nice and helpful,
and will be more than happy to help you with your project. We all love
rogue-like games, and having more players and developers is in every
possible way a good thing! I will actually download and play (at least
once) EVERY rogue that gets posted here. You WILL learn a lot, and
there are some talented people here that know there stuff. Above all,
don't get discouraged - and keep your first attempt modest - if you
bite off more than you can chew, it will be painful admitting you
can't finish that project you've spent so much time on.
B-
MPRDB1 had no fancy line of sight and was quite playable. It's
rogue-style; 8 spaces around you in a corridor, all of a room if in a
room.
--
David Damerell <dame...@chiark.greenend.org.uk> flcl?
Today is Saturday, March - a weekend.
Thanks B, I really appretiate that!!
Well actually I just made my first code, actually "room" where the cursor
moves through the room. Im not sure it would be appropriate to paste the
whole code here, so i added project in .rar or .cs who doesnt have time to
open it all.
Well i managed to make a room and move character with cursor, but the real
> problem comes with cursor, apparently when i reach the east wall and if i
> am
> starting to click to the right, character '@' stops on the place but
> cursor moves
> to the right and deletes my precious wall. What should i do?
> Is that because i used .NET Console, or that depends from portability and
> OS from
> computer to computer? Anyway, this is my for starters code, and any
> recommendation
> and advice will do!
> Thanks alot guys,
> Goran
>
>
>
p.s. this is my attach-less post, for any case my post with attachements
didnt make through
just source code: http://rapidshare.com/files/208386482/Program.cs.html
the whole project:
http://rapidshare.com/files/208386795/RoguelikeGameFromNews.rar.html
(its option for rapidshare to delete this after 10 times download, so if
anyone wants to see it again
can email me or post for more download)
Hi again,
You should not try to add NCWrapper.dll, this file is a dll of ncurses/
pdcurses based on c code - hence your error.
The file you should add is NCurses.dll - which is a dll based on C#
functions that calls the functions in NCWrapper.dll.
...
I have made some modifications to the NCursesSharp project, you can
download it here: http://rapidshare.com/files/208474825/NCursesSharpMod.zip.html
(note the file can only be downloaded 10 times), the difference
between is that my project has more functions and keep the names of
the original functions. Here is a guide: http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/init.html
Why use it at all when you can use the built-in System.Console class?
-Ido.
Hi, had a look at the code - some comments
I think you missed some closing brackets somewhere as you have your
Actor class completely inside your Program class which seems a bit
pointless. I think you need a } around line 70.
Also, the room is not redrawn inside your main loop which can cause
the edges to disappear
For the drawing I think your better with something like:
for each actor
{
Console.setposition(actor.x,actor.y)
Cosole.DrawString("@")
}
This means all your drawing code is in one location
Also, your functions for left right up and down are basically all the
same - it would be simpler to have one function which needs a
direction input as well
The reason you hace disappearing walls in the console cursor is
getting moved to a wall spot and deleting the cursor. Putting your
map drawing code inside your main loop should fix this - probably -
but I don't use a console for displaying. The actual .net console
should be reasonably portable using Mono.
John Palmer
> Also, the room is not redrawn inside your main loop which can cause
> the edges to disappear
>
> For the drawing I think your better with something like:
>
> for each actor
> {
> Console.setposition(actor.x,actor.y)
> Cosole.DrawString("@")
> }
> This means all your drawing code is in one location
Thank you, that was really usefull. I put this code in while loop,
draw a room then added this code:
Console.SetCursorPosition(player.x, player y);
Console.Write("@");
I also modified all methods erasing code wich is no longer needed
> Also, your functions for left right up and down are basically all the
> same - it would be simpler to have one function which needs a
> direction input as well
Well I must admit that as a newbie im still feeling unconfortable using
methods and classes, and I just didnt maked the solution how to achieve
that with only one method since every method has different if expression
and different arguments for SetCursorPositiion. Can you please show me
how did you mean that.
> The reason you hace disappearing walls in the console cursor is
> getting moved to a wall spot and deleting the cursor. Putting your
> map drawing code inside your main loop should fix this - probably -
> but I don't use a console for displaying. The actual .net console
> should be reasonably portable using Mono.
>
> John Palmer
Putting the code in the main loop solve all my problems, thanks.
Can you explain me please little more about actual .net console,
as I am still new to all this. Do you mean some cross between
Windows application and Console application or what exactly?
But thanks alot John, I have now good beggining example how to
make a game start.
But still I have a lot of others problems on my mind what to do next:
1. How to change font collors and/or background collors?
2. How to interact with obstacles (in the form of other character types)
like different objects, items and sooner or later NPCs ?
3. How to make multiple rooms, should I implement it in the class, or like
independent static method for each incoming room or some other alternative
way?
But in spite of that, youve been all very helpfull, thanks!
Please guide me at least on some of my questions if not all.
Greetings, Goran =)
You should not try to add NCWrapper.dll, this file is a dll of ncurses/
pdcurses based on c code - hence your error.
The file you should add is NCurses.dll - which is a dll based on C#
functions that calls the functions in NCWrapper.dll.
...
I have made some modifications to the NCursesSharp project, you can
download it here:
http://rapidshare.com/files/208474825/NCursesSharpMod.zip.html
(note the file can only be downloaded 10 times), the difference
between is that my project has more functions and keep the names of
the original functions. Here is a guide:
http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/init.html
-------
Thank you on modified NCursesSharp project and for the guide, I will
take time in recent days to read it. PDCurses.dll have a lot of methods and
options which will help me to make my succesfull roguelike game, but please
take notice that Im a still begginer, and Im in this language for only three
months
so some advanced topics like interfaces, polymorphism, inheritance, generics
and simmilar are still mystery to me, but I firmly believe the best way to
learn is
through practice. That means im still not familiar with all the fields in
your dll.
and .cs files (especially not in .c file) but as I cruise through your
tutorial I hope
that subject will starting to be more familiar for me too :)
greetings, Goran
//repeat same for y
}
It is better to have some other method which actually checks whether
it is actually possible to move the player - you can use this to see
whether movement is blocked by walls
>
> But still I have a lot of others problems on my mind what to do next:
> 1. How to change font collors and/or background collors?
You can use Console.Foregroundcolor/backgroundcolor to change console
colors - but according to http://msdn.microsoft.com/en-us/library/system.console.foregroundcolor.aspx
you are limited to one color at a time. I use forms to avoid this
problem but people who use the Console in c# may have a better answer
> 2. How to interact with obstacles (in the form of other character types)
> like different objects, items and sooner or later NPCs ?
You'll just need to find what works - although your going to need at
least a 2D array for the map and an array or list for the NPC's.
Probably best to have a look at some code. My current Rl is
reasonably simple - only 1250 lines its at http://realtimerl.googlecode.com/svn/trunk/
- easiest to use SVN to grab it or I could upload a tar
> 3. How to make multiple rooms, should I implement it in the class, or like
> independent static method for each incoming room or some other alternative
> way?
I have a static class which generates maps
> But in spite of that, youve been all very helpfull, thanks!
> Please guide me at least on some of my questions if not all.
>
> Greetings, Goran =)
Thanks
> If you're new to the language, roguelikes might not be the best place
> to start, unless you're an uber genius or have significant prior
> programming experience in other languages... they are often
> deceptively complex!
> Not to belittle your skill, but perhaps something like Yahtzee or
> Battleship might be a better choice for learning the language? Then
> perhaps chess (2-player that is, not vs. an AI - chess AI's are
> notoriously difficult even for IBM!), and then a roguelike?
Depends how good you want the AI to be. Minimax combined with a
mobility heuristic will give you something that recognisably tries to
play chess, after the fashion of 1980s PCs.
- Gerry Quinn
--
Lair of the Demon Ape (a coffee-break roguelike)
<http://indigo.ie/~gerryq/lair/lair.htm>