Skip to main content
GameDev.net gamedev.net
🔒 Locked

Code AI for RPS Game?

Started by wenching Jun 9, 2003 at 7:08 AM 13 replies 2.7k views
Original Post
wenching
wenching
Hello everyone. I had pickup some understanding of A* Pathfinding and Finite State Machine (FSM). But that is in theory. I plan to code in C#, coz my game is in C#. Haha! There are many codes on C++ but i had no knowledge on C++. Any place in the Internet, which i can pickup AI in C#? I had looked up an example in planet-source-code in VB.NET - A* Pathfinding. Very cool! But it is vb.net! Had a hard time doing conversion. Any help from gamedev community? What i am focusing is on FSM, A* Pathfing, Dynamic A* Pathfinding and Neural Networks in C#? Please help. Thanks. Regards, Chua Wen Ching
"Very new to games I think"
Timkin
Timkin
Try the CMU Artificial Intelligence Repository. I''m not sure how up to date it is now, since I haven''t visited it in about 2 years... but it may have some C# code... then again, it might not...

Cheers,

Timkin
wenching
wenching
Really not much AI in C# codes...

Thanks for the link

I really want to see some c# examples that implement finite state machines (FSM)?

Please help.

Regards,
Chua Wen Ching
"Very new to games I think"
Popolon
Popolon
Any thing you code is a FSM, since the computer itself is a FSM

Seriously, to implement a FSM of the kind you are talking of is really a children game, just design your FSM, and after that, to implement it do this:


int execute_cycle(int state,int input)
{
switch(state) {
case STATE0: ...
break
case STATE1: ...
break
...
}

return state;
}


who cares if the code is in C, C#, C++, Java, VB or whatever. You just have to get the idea!!

You could think on implementing a general FSM that can be instantiated to any particular FSM, but I don''t hink that will be very usefull (maybe just for pedagogical purposes)
fup
fup
Popolon: A switch based FSM is very poor design. It is a nightmare just waiting to bite you.

A much better approach is to use either a state transition table or (for OOP) the State design pattern.

Eric (Geta) has an article about using a state transition table in one of the Gems books (or maybe AI Wisdom, I don''t recall offhand).

You can read about the State design pattern in "Design Patterns" published by Addison Wesley, or do a search onm Google.





My Website: ai-junkie.com My Book: AI Techniques for Game Programming

alexjc
alexjc
quote:
Original post by Popolon
Any thing you code is a FSM, since the computer itself is a FSM



It''s not the case. FSM are fundamentally limited to recognizing regular languages. Computers are much more computationally advanced, closer to universal turing machines.

The issue of including arbitrary procedures as states in a gray area, but the bottom line is it''s no longer a traditional FSM...



wenching: Why use a recent language like C# if you want community support?
Join us in Vienna for the nucl.ai Conference 2015, on July 20-22... Don't miss it!
wenching
wenching
Hi again.

I am already half way through in my game. So i had to stick in C#. Haha!

Oh.. so fsm is just a way of implementation.. i think shouldn''t be a problem coding it.

Hehe!

Oh.. but neural network in c#??? Headache

Regards,
Chua Wen Ching
"Very new to games I think"
krez
krez
correct me if i am wrong (i haven''t used .NET yet), but can''t you write the different parts of your program in any of the various VS.NET languages anyway? that was the impression i got from the propaganda...
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
wenching
wenching
Yeah you can!

You do module 1 with C# and module 2 with J#!

But the problem is that I know C++ syntax but not really know very detail!

And my project is in .Net!

Regards,
Chua Wen Ching
"Very new to games I think"
wenching
wenching
Oh okay!

Read codes... i think i can!

I want to implement some good AIs from Black and White...

I heard the AI is extra cool!

Just wonder, how they do it?

I know there is another thread on this, where nlp comes in?

I think they use more than that right?

Any very recommended website where i can read AI codes?

Regards,
Chua Wen Ching
"Very new to games I think"
Ouranos
Ouranos
quote:
Original post by fup
Eric (Geta) has an article about using a state transition table in one of the Gems books (or maybe AI Wisdom, I don''t recall offhand).



There are several articles in the first Gems book on this subject, I''m sure this is one of them...

Wen Ching: I would definitely recommend picking this book (AI Wisdom is also good). You don''t want to rush in to coding anything, a good design will go a long way, it will also ensure reusabilty for future games. One of the themes you pick up when studying Computer Science is that programming is programming, no matter the language. Programming is all about algorithms and design, both of which can be applied to any language, a good programmer can learn a new language within a week because of this mentality.

insert witty signature here
-------------------------http://www.roachpuppy.com
5010
5010
Regardless of how well you understand the syntax of a specific language, if you can''t turn an algorithm into code, then you don''t know how to program.

-solo (my site)
-solo (my site)
wenching
wenching
I can modify algorithms and pseudocodes into codes...

but can''t modify mathematics into codes... those very advanced mathematics...

AI Wisdom is really that good? I had flip through, any speciality in there?

If it is really good, i will propose my educational institute to buy it!

The book provides any samples codes so i can easily get started!

Regards,
Chua Wen Ching
"Very new to games I think"
baylor
baylor
At the risk of being a heretic, why on earth would you want to implement all those things you''re talking about? Hopefully not for games - you *might* be able to get an ANN or GA or whatever to solve a specific problem you''re having but i suspect there are many easier, common sense ways to do AI for your game. The biggest issue is to be able to define exactly what problem you''re trying to solve and then be able to work the problem by hand. There are no silver bullets in things like so-called "neural nets"

As for C#, it''s just Java. And Java is just C++ with some asterixes missing. If you have C++ code, moving it to C# is almost always trivial (except if the code used templates or multiple inheritance). And to convert VB.NET to C#, you cut and paste it and then add semicolons (OK, it''s slightly more than that, but only barely). It''s all trivial, so if you have code, using C# shouldn''t be a big deal

As for how they did B&W, there''s an article in Game Developer Magazine/gamasutra.com that explains some of their design. It''s practically identical to a system i wrote years ago called Light Blue which you can find documented on my Web site (ihatebaylor.com). But that doesn''t necessarily do you any good does it? i''m assuming that since you''re half way through an implementation you have specific problem and that means you need a specific solution, and i don''t think knowing B&W or ANNs or NLP is going to help you

Sounds to me like the real thing you need to worry about is the specific problems you''ll encounter in your games

Re: AI Game Programming Wisdom, is it that good a book? Well, sort of. It''s one of the only books written on game AI, which is a radically different beast than "AI". So it''s valuable from that perspective. It has some good articles and some atrocious ones. It covers only what the authors felt like writing about. i bought it and don''t regret it for a second but don''t think that buying it will solve all or even a signficant portion of your problems

Them''s my two cents

-baylor

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.