### Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

### Messages - Perdurabo

Pages: 1 2 [3] 4 5 ... 7
31
##### Classic Roguelikes / Re: New version of Crawl released. What about DOS-version?
« on: June 08, 2010, 06:29:40 PM »
The solution is ofc to make a tiled version using ASCII-only tiles.

32
##### Temple of the Roguelike / Re: Spam Filter for Forum
« on: May 21, 2010, 08:49:06 PM »
Why don't you just simply set up new users to need approval before posting?

33
##### Programming / Re: C# Point Class code
« on: May 04, 2010, 11:00:39 PM »
Good points. I'll get another version written to sort those out.

Ta,
P.

34
##### Programming / C# Point Class code
« on: May 04, 2010, 07:02:22 PM »
C# doesn't (unlike Delphi) has a cartesian point class so I went ahead and wrote one. All code public domain blah blah blah. Should work on Mono as well:

/* Sample Point Class for C# for use in Roguelikes. By Dave Moore (starbog@NOSPAMgmail.com) */
/* All Code here is Public Domain - no copyright whatsoever, use it however you want */

using System;

namespace Map
{
// List of cardinal directions useful in offset and coordinate calculations
enum CardinalDirection { None = -1, N = 0, NE = 1, E = 2, SE = 3, S = 4, SW = 5, W = 6, NW = 7 };

// Point Class to handle Map Functions
class Point
{
// Default Constructor
public Point()
{
// Set the internal values
this.x = 0;
this.y = 0;
}

// Standard Constructor
public Point(int X, int Y)
{
// Set the internal values
this.x = X;
this.y = Y;
}

// Limit the values of the point to an additional supplied arbitrary
// bounds - useful when working with calculated values
public Point(int X, int Y, int Min, int Max)
{
// Set the internal values
this.x = X;
this.y = Y;

// Limit the x value if necessary
if (this.x > Max) { this.x = Max; }
else if (this.x < Min) { this.x = Min; }

// Limit the y value if necessary
if (this.y > Max) { this.y = Max; }
else if (this.y < Min) { this.y = Min; }
}

// Copy Constructor - we need to use this because unlike C++ we cannot
public Point(Point P2)
{
// If we have a valid reference
if ((object)P2 != null)
{
// Set the internal values
this.x = P2.X;
this.y = P2.Y;
}
}

// Override the ToString method
public override string ToString()
{
return string.Format("[{0},{1}]", this.x, this.y);
}

public static bool operator ==(Point P1, Point P2)
{
// If we have a valid reference
if ((object)P1 == null) { return false; }
if ((object)P2 == null) { return false; }

// Check for full equality on both values
return (P1.x == P2.x && P1.y == P2.y);
}

public static bool operator !=(Point P1, Point P2)
{
// If we have a valid reference
if ((object)P1 == null) { return false; }
if ((object)P2 == null) { return false; }

// Check for inequality on either values
return (P1.x != P2.x || P1.y != P2.y);
}

public override bool Equals(System.Object P2)
{
// If we have a valid reference
if ((object)P2 == null) { return false; }

// Check we can cast the incoming object to a Point
Point p = P2 as Point;
if ((System.Object)p == null) { return false; }

// Check for full equality on both values
return (this.x == p.x && this.y == p.y);
}

// Provide a custom GetHashCode function (needed when the Equals operator is
// overridden
public override int GetHashCode()
{
// Use XOR
return this.x ^ this.y;
}

// Provide an equivalent of an assignment operator
public void Set(Point P2)
{
// If we have a valid reference
if ((object)P2 != null)
{
// Set the internal values
this.x = P2.X;
this.y = P2.Y;
}
}

// Provide another equivalent of an assignment operator
public void Set(int X, int Y)
{
// Set the internal values
this.x = X;
this.y = Y;
}

// Return the euclidean distance between two points
public int DistanceTo(Point P2)
{
// If we have a valid reference
if ((object)P2 == null) { return -1; }

// Return the distance (as an int, rounded down)

return (int)Math.Sqrt((this.x - P2.x) * (this.x - P2.x) +
(this.y - P2.y) * (this.y - P2.y));
}

// get the difference between two points
public void SetFromOffset(Point P1, Point P2)
{
// Set the default values
this.X = 0;
this.Y = 0;

// If we have a valid reference
if ((object)P1 == null) { return; }
if ((object)P2 == null) { return; }

// Get the offsets
this.X = (P1.x - P2.x);
this.Y = (P1.y - P2.y);
}

// Return the difference between two points optionally limiting the
// values returned
public void SetFromOffset(Point P1, Point P2, int Min, int Max)
{
// Set the default values
this.X = 0;
this.Y = 0;

// If we have a valid reference
if ((object)P1 == null) { return; }
if ((object)P2 == null) { return; }

// Get the offsets
this.X = (P1.x - P2.x);
this.Y = (P1.y - P2.y);

// Limit the x value if necessary
if (this.X > Max) { this.X = Max; }
else if (this.X < Min) { this.X = Min; }

// Limit the y value if necessary
if (this.Y > Max) { this.Y = Max; }
else if (this.Y < Min) { this.Y = Min; }
}

// Get the direction of one point from another as an enum
public CardinalDirection DirectionTo(Point P2)
{
// If we have a valid reference
if ((object)P2 == null) { return CardinalDirection.None; }

// Set up an offset array to convert the offsets of the two points
// into a direction
Point[] Directions = new Point[8];
Directions[(int)CardinalDirection.N] = new Point(0, -1);
Directions[(int)CardinalDirection.NE] = new Point(1, -1);
Directions[(int)CardinalDirection.E] = new Point(1, 0);
Directions[(int)CardinalDirection.SE] = new Point(1, 1);
Directions[(int)CardinalDirection.S] = new Point(0, 1);
Directions[(int)CardinalDirection.SW] = new Point(-1, 1);
Directions[(int)CardinalDirection.W] = new Point(-1, 0);
Directions[(int)CardinalDirection.NW] = new Point(-1, -1);

// Get the offset from one point to another
Point P = new Point();
P.SetFromOffset(this, P2, -1, 1);

// Find the matching direction
int Index = 0;
foreach (Point Item in Directions)
{
if (Item == P) { return (CardinalDirection)Index; }
else { Index++; }
}

// Return the null value just in case
return CardinalDirection.None;
}

// Check if two points are adjacent to each other
{
// Test if the points are 1 square apart
return (this.DistanceTo(P2) == 1);
}

// Private data members
private int x;
private int y;

// Publically accessible properties
public int X
{
get { return this.x; }
set { this.x = value; }
}
public int Y
{
get { return this.y; }
set { this.y = value; }
}

}

}

And here's a console test app as well:

/* Sample Point Class for C# for use in Roguelikes. By Dave Moore (starbog@NOSPAMgmail.com) */
/* All Code here is Public Domain - no copyright whatsoever, use it however you want */

using System;
using System.Text;
using Map;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Point P1 = new Point(10, 11);
Point P2 = new Point(24, 20);
Point P3 = new Point(100, 5);

System.Console.WriteLine("C# Point Class Demo\n*******************\n");
System.Console.WriteLine("Defined P1 as (10, 11), P2 as (24, 20) and P3 as (100, 5)\n");
System.Console.WriteLine("Standard Constructor & ToString(): P1 = " + P1.ToString() + ", P2 = " + P2.ToString() + ", P3 = " + P3.ToString());
Point P5 = new Point(999, -999, -9, 9);
System.Console.WriteLine("Limit Constructor: P5 = (999, -999, -9, 9): P5 = " + P5.ToString());
Point P4 = new Point(P1);
System.Console.WriteLine("Copy Constructor (P4->P1): P4 = " + P4.ToString() + "\n");
System.Console.WriteLine("==: P1 == P2 = " + (P1 == P2).ToString());
System.Console.WriteLine("!=: P1 != P2 = " + (P1 != P2).ToString());
System.Console.WriteLine("Equals(): P1.Equals(P2) = " + (P1.Equals(P2)).ToString());
Point P6 = new Point(66, 66);
P6.Set(P3);
System.Console.WriteLine("(Assignment Operator) Set(): P6 = (66, 66), P6.Set(P3); P6 = " + P6.ToString());
Point P7 = new Point(77, 77);
P7.Set(7, 7);
System.Console.WriteLine("(Direct Set Operator) Set(): P7 = (77, 77), P7.Set(7, 7); P7 = " + P7.ToString() + "\n");
System.Console.WriteLine("DistanceTo(): P1.Distance(P2) = " + (P1.DistanceTo(P2)).ToString());

Point P8 = new Point(88, 88);
P8.SetFromOffset(P1, P2);
System.Console.WriteLine("SetFromOffSet(): P8 = (88, 88), P8.SetFromOffset(P1, P2) = " + P8.ToString());
Point P9 = new Point(99, 99);
P9.SetFromOffset(P2, P1);
System.Console.WriteLine("SetFromOffSet(): P9 = (99, 99), P9.SetFromOffset(P2, P1) = " + P9.ToString());
Point P10 = new Point(10, 10);
P10.SetFromOffset(P1, P2, -1, 1);
System.Console.WriteLine("SetFromOffSet(): P10 = (10, 10), P10.SetFromOffset(P1, P2, -1, 1) = " + P10.ToString() + "\n");
System.Console.WriteLine("DirectionTo(): P2.DirectionTo(P1) = " + P2.DirectionTo(P1).ToString());
System.Console.WriteLine("DirectionTo(): P1.DirectionTo(P2) = " + P1.DirectionTo(P2).ToString());

}
}
}

Enjoy!

Best,
P.

35
##### Early Dev / Re: Rogue Survivor alpha 1
« on: May 04, 2010, 07:09:54 AM »
This is the kind of game I've been waiting for...

Me too, unfortunately i think it won't work on ubuntu.

It could via Mono.

D.

36
##### Early Dev / Re: Rogue Survivor alpha 1
« on: May 04, 2010, 12:46:21 AM »
For what its worth, it works fine for me.

Vista (urgh).

But I do have VS C# 2008 installed.

Looks VERY promising!

What did you use for the sound btw? I'm on the lookout for a decent C# sound library (preferably one that is cross-platformable using Mono).

37
##### Programming / Re: LambdaRogue: The Book of Stars (1.5.x) Trailer
« on: April 24, 2010, 04:39:41 PM »
You still wanting to rename it, Mario?

If so, why don't you just call it "Book of Stars"?

38
##### Programming / Re: Some themes, have they been done before?
« on: March 24, 2010, 04:41:34 PM »
C'mon now, Perdy, why would you need to listen to anyone but Christ? He has all the knowledge of the universe, minus dinosaurs.

And Cthuhlu.

And Pi.

39
##### Programming / Re: Help me decide on an interface
« on: March 24, 2010, 03:46:05 PM »
+1 for the thin text.

40
##### Programming / Re: Some themes, have they been done before?
« on: March 24, 2010, 03:45:15 PM »
And a completely tone-deaf one at that, Krice.

41
##### Off-topic (Locked) / Re: Good Books
« on: October 17, 2009, 12:49:58 AM »
I don't read a whole lot of books, but I like the Shannara series.  They are authored by Terry Brooks.  There is also The Magic Kingdom of Landover series.  This is also by Terry Brooks.

http://en.wikipedia.org/wiki/Terry_brooks

I think I will look into the Ice and Fire books though.  Along with other suggestions that get posted here.

Don't forget the Wheel of Time.

Book 12 is due out in just over a week.

42
##### Off-topic (Locked) / Re: Good Books
« on: October 16, 2009, 09:07:18 AM »
George RR Martin's "A Song of Ice and Fire" series, without a doubt.

43
##### Programming / Re: Kharne Alpha 1 Available
« on: October 12, 2009, 09:25:53 PM »
Kharne Alpha 0.0.5b is now available

See http://kharne-rl.blogspot.com/2009/10/kharne-005b-now-available.html for full details (including source)

The big change in this version is the addition of Scrolls (press r to read them). There are currently nine different types of scrolls available, there will be many more added over forthcoming releases.

The full list of changes is:

* Scrolls have been implemented.
* Scrolls and potions are no longer PseudoIDed.
* Hunger is now increased by wearing magical items.
* Fixed a bug with cursed fountains not causing the character to hunger correctly when drinking from them.

44
##### Programming / Re: RougeLike Step by Step Tutorial?
« on: October 05, 2009, 10:54:02 PM »
Thanks for help mates, and btw do you thing C++ is the best choice for start righting my own RLRPG ( i have some skills in basic also ). For example is it possible to make Rouge like game using something like BlitzBasic or your advice is to go deep and deep in C++?

Best,
P.

45
##### Programming / Re: Map Generation / Tile definition?
« on: October 04, 2009, 06:36:48 AM »
you have a 2d array of objcts? as in swords and boots and stuff? how then would drop more than one item into onto a tile?