Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
i am almost done with my first game, so to say, all i have left to do is the manual labor. BUT i just relized that my game is not a net game so it wouldn't work. I am building a 2 in one chess/checks game. And i dont know how to make the computer play along with you... i guess you could call it AI. How do i go about making it?
  • *Experts*
Posted

There's no easy answer to that. AI is a very very complicated task. For my end-of-year project in QuickBASIC I made a 2 player chess game, and that was very hard even without a computer player. Having AI would have made it incredibly hard.

 

To design chess AI that is half-decent, you need to understand the senarios completely; what moves take precedence, when the consequences down the road will be. Very advanced stuff.

 

They managed even to make a chess AI that beat Gary Kasparov, but only in 2 of 7 games or something, and that was an IBM super computer that a team of skilled logicians and chess players worked at creating.

 

Checkers won't be so hard, but AI of any kind will be a big challenge. I suggest you do some searching of Google, and some intensive reading.

  • *Experts*
Posted

To addition of what Volte said, I would very strongly recommend that you yourself are god at chess before even attempting to create an AI. Its hard to be good in chess :D ;) .

I sguuest you play online with some people, I like visiting games.yahoo.com when I want to play chess online :).

Posted (edited)

hmmmmm never thought of it that way..... um in that case i'll modify what i have to make a single player game. right now i'm using mutants drawing code for my board

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
       Dim X As Integer
       Dim y As Integer
       For X = 0 To 360 Step 90
           For y = 0 To 360 Step 90
               e.Graphics.FillRectangle(New SolidBrush(Color.Black), X, y, 45, 45)
           Next
       Next
       For X = 45 To 315 Step 90
           For y = 0 To 360 Step 90
               e.Graphics.FillRectangle(New SolidBrush(Color.Red), X, y, 45, 45)
           Next
       Next
       For X = 45 To 315 Step 90
           For y = 45 To 315 Step 90
               e.Graphics.FillRectangle(New SolidBrush(Color.Black), X, y, 45, 45)
           Next
       Next
       For X = 0 To 360 Step 90
           For y = 45 To 315 Step 90
               e.Graphics.FillRectangle(New SolidBrush(Color.Red), X, y, 45, 45)
           Next
       Next
   End Sub

how do i modify that code to make a disign like this:

| . . .

| . . . . .

| . . . . . . .

| . . . . . . .

| . . . . . . .

| . . . . .

| . . .

Each of those dots are a 45x45 colored square. Just like the code mutant gave me just i dont to block a few drawings. I hope i explained it to some degree of understanding :D

PS- THe board is bigger than that this thing wont show all of it for some reason. What u see, reflect the same thing on the other side of the line but without the 3 large rows just the 5 high and the 3 high:mad: sorry

Edited by starcraft
Posted

There are tutorials on http://www.gamedev.net (or http://www.flipcode.com, one of the two) about building a chess AI. You don't really have to know much about chess.. you just build a tree of all possible moves and pick the move that has the shortest road to victory.

 

Of course, the hard part is pruning the tree so you can decide on a move within a certain time limit (don't want your player waiting days for the pc's move :) ). If I recall correctly the techniques are called min-max with alpha-beta pruning (it's been years so that's probably not right).

 

Hmm.. quick google search gives these:

 

http://www.digichess.gr/articles/minmax.html

 

http://www.seanet.com/~brucemo/topics/alphabeta.htm

 

Hope that helps.

 

Pete

  • *Experts*
Posted
do you have any idea how to use a graphic as an object and move it over the checkerboard???

 

You would have to keep track of the coordinates at which the graphics have to be and then draw it everytime it moves at the specified coordinates.

Posted
ok, great site. im still going over them. but i also need help for after i finish this checkers game ( im only doing checkers for experience ). i wanna do something like Dungeon Siege. if i could get some help i would be all too appreciative
Posted

Hmm.. for something like Dungeon Siege you probably want to look at this site: http://www.truevision3d.com. It's a 3d engine compatible with .net that is free for non-commercial use (although you have to have a little "Truevision" banner in one corner, but full shareware licensing is quite cheap (for a 3d engine).

 

Please note that I have no affiliation with that group (so this isn't some cheap plug ;) ).

 

Pete

Posted

I've been examining Dungeon Siege and am only just beggining to understand the theory and logic of the engine despite owning the game for more than 6 months. It is a massive game. You can get ideas on how it works from the Map Making tutorials at http://www.dungeonsiege.com but if you're going to do it, you'll need to understand Inheritance to manage the game objects, Dungeon Siege is like a mini-version of Windows, it uses a message loop engine to send game messages (such as Activate, UserClick, EnterActiveMapArea, etc) to game objects, each game object has a handle similar to a Windows hWnd, its extremely complicated.

 

If you try, you'll want to know Direct3D just about inside out as well as DirectInput and DirectSound3D. The general abilities of the .Net framework and all of it's classes as well as a good understanding of how Windows works and managing massive amounts of data without using up the RAM and paging file. If you make a 2D version then you shouldn't have too much difficulty but the game worlds are likely to much smaller and simpler, you'll probably also want experience in running applications based on data in files(Allows dynamic addition of game objects) and using scripts to prevent hard coding the mechanics.

.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Posted

Wowzers

 

Wow StarCraft, that is cool code! All I had to do was copy and paste, hit the play button, and I saw the beatiful squares :D . I love it when I find code that easy lol. I hate it when I find code, and I get darn errors!

"Reality is fake, Dreams are for real"
Posted

ThePentiumGuy: At the top of the features page "The TV3D Engines are supported in .NET (C#, VB.NET and some other .NET-supported languages), in VB5/6 and in Delphi". There are loads of samples in both c# and VB.

 

The VC++6 support is only a wrapper as far as I can tell.

 

Pete

Posted
Actually, it looks like VB 5/6 and .Net have wrappers, seeing as it was written in C++
.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Posted

I've been examining Dungeon Siege and am only just beggining to understand the theory and logic of the engine despite owning the game for more than 6 months. It is a massive game. You can get ideas on how it works from the Map Making tutorials at http://www.dungeonsiege.com but if you're going to do it, you'll need to understand Inheritance to manage the game objects, Dungeon Siege is like a mini-version of Windows, it uses a message loop engine to send game messages (such as Activate, UserClick, EnterActiveMapArea, etc) to game objects, each game object has a handle similar to a Windows hWnd, its extremely complicated.

 

Interesting. Very interesting.

Gamer extraordinaire. Programmer wannabe.
Posted (edited)

To add a bit more, Dungeon Siege uses parsed C Style scripts for every object in the game, the messages are handled like:

Start State Waiting$ {
     TriggeredBy EnterActiveMapArea {
        SetState Start$
     }
}
State Running$ {
     TriggeredBy LeaveActiveMapArea {
        SetState Waiting$
     }
     TriggeredBy UserActivate {
         //Do Something
     }
}

 

The map making tutorials give reasonably detailed descriptions of the how the engine works, try looking over some of the tutorials here: http://www.dungeonsiege.com/siegeu.shtml(300 is programmer orientated) if you want to find out how it works more specifically.

 

The game uses an interesting inheritance method for tracking objects that acts as a kind of treeview, if might be useful for people in future, but they use a structure sort of like:

Interface GraphicalObject
   'Graphical data+animation stuff

Class AGameObject
   'General Game stuff (Location for example)
'Get GameObjectID As Int32


Class StaticObject :Inherits AGameObject :Implements GraphicalObject
   'Mesh Data, translucency, misc graphics, animations, Can be interacted
      '(Objects that can't be interacted with[decorations like displays])

Class CrateObject :Inherits StaticObject
    'Whats inside (object), shatter effect, can be shattered

Class ChestObject :Inherits StaticObject
    'Whats inside (object), etc

Class GoldObject :Inherits StaticObject
    'Value

This seems to make everything simpler to keep track of because you can categorise everything. People might find this useful in planning games in future(it really only applies to RPGs however)

Edited by AndreRyan
.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Posted
It looks like it's all event driven. The object hierarchy makes sense, I can't imagine doing it differently.
Gamer extraordinaire. Programmer wannabe.
  • *Experts*
Posted

Imagine designing it, or using it! Most of us spend our lives figuring out MS's design for managing windows and events. They built their own design that's similar, but it's own set of functions and more. CSG (Crazy Smart Guys).

 

-Ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...