Need Help With Game Programming

G

Guest

Ok, I've searched all over the net and I can't seem to find what I'm looking
for. I'm trying to develop a game similar to Wizardry or Bard's Tale in the
Compact Framework. I have the core logic and such, but what I'm having a
problem with is trying to create a 3D viewpoint based on a 2D array that
holds the map. I was planning to use Line commands to draw a wireframe
picture similar to the original Wizardry.

Can someone point me to a tutorial or some sample code to do this? Thanks. =)

Flynn
 
P

PrestonVW

Let me see if I understand what you are trying to do. You want to know how
to draw a 3D viewpoint of a dungeon maze that it stored in a 2D array
indicating where the walls are.

So it I had a map like below and I knew where I was and which direction I
was facing, how would you draw my viewpoint? Am I close?

x xxxxxxxxxx
x x x
xx x xxxxxx
x x x x
xx x x
x x x
xxxxxxxxxxxx

-PrestonVW
 
G

Guest

Yes, exactly. Right now, I'm only concerned with drawing lines. Later I might
try something nicer looking, but this is just a sketch project, so it's not
designed to be "fancy", heh.

Flynn

--
---------------
If we can't corrupt the youth of today,
the adults of tomorrow won't be any fun.


PrestonVW said:
Let me see if I understand what you are trying to do. You want to know how
to draw a 3D viewpoint of a dungeon maze that it stored in a 2D array
indicating where the walls are.

So it I had a map like below and I knew where I was and which direction I
was facing, how would you draw my viewpoint? Am I close?

x xxxxxxxxxx
x x x
xx x xxxxxx
x x x x
xx x x
x x x
xxxxxxxxxxxx

-PrestonVW
 
P

PrestonVW

You can use the PolyLine function to draw lines.

-PrestonVW

[DllImport("coredll.dll")]
private static extern IntPtr GetCapture();

[DllImport("coredll.dll")]
private static extern IntPtr GetDC(IntPtr hwnd);

[DllImport("coredll.dll")]
private static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);

[DllImport("coredll.dll")]
private static extern bool Polyline(IntPtr hdc, POINT[] lppt, int
cPoints);

private struct POINT
{
public int x;
public int y;
public POINT(int x, int y)
{
this.x = x;
this.y = y;
}
}

private void button1_Click(object sender, EventArgs e)
{
this.Capture = true;
IntPtr hwnd = GetCapture();
this.Capture = false;

IntPtr hdc = GetDC(hwnd);

POINT[] pointArray = new POINT[] { new POINT(10, 10), new
POINT(100, 150) };
Polyline(hdc, pointArray, 2);

ReleaseDC(hwnd, hdc);
}


Flynn Arrowstarr said:
Yes, exactly. Right now, I'm only concerned with drawing lines. Later I
might
try something nicer looking, but this is just a sketch project, so it's
not
designed to be "fancy", heh.

Flynn
 
G

Guest

Thanks, I'll give it a try. =)

Flynn

--
---------------
If we can't corrupt the youth of today,
the adults of tomorrow won't be any fun.


PrestonVW said:
You can use the PolyLine function to draw lines.

-PrestonVW

[DllImport("coredll.dll")]
private static extern IntPtr GetCapture();

[DllImport("coredll.dll")]
private static extern IntPtr GetDC(IntPtr hwnd);

[DllImport("coredll.dll")]
private static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);

[DllImport("coredll.dll")]
private static extern bool Polyline(IntPtr hdc, POINT[] lppt, int
cPoints);

private struct POINT
{
public int x;
public int y;
public POINT(int x, int y)
{
this.x = x;
this.y = y;
}
}

private void button1_Click(object sender, EventArgs e)
{
this.Capture = true;
IntPtr hwnd = GetCapture();
this.Capture = false;

IntPtr hdc = GetDC(hwnd);

POINT[] pointArray = new POINT[] { new POINT(10, 10), new
POINT(100, 150) };
Polyline(hdc, pointArray, 2);

ReleaseDC(hwnd, hdc);
}


Flynn Arrowstarr said:
Yes, exactly. Right now, I'm only concerned with drawing lines. Later I
might
try something nicer looking, but this is just a sketch project, so it's
not
designed to be "fancy", heh.

Flynn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top