🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Fuzzy logic help!

Started by
5 comments, last by BradDaBug 23 years ago
I need help with fuzzy logic! what i''m doing is i''m trying to use fuzzy logic to let my NPC''s choose which words to use based on several factors, such as their mood and personality. ie, if they like the player, they''ll say "Hey! How ya doin?" but if they hate the player, they might say "You again?!" i''m refering to the stuff about fuzzy logic in Tricks Of The Windos Game Programming Gurus. i have the NPC''s attitute and mood each in a DOM thingy, but i want to have the words in a DOM thingy too, the only problem is the book only showed how to defuzz the matrix into linear and crips values. I need to take several DOM things and figure out one DOM thingy, the words. Can anyone figure out what I''m trying to do/say? i''d appreciate any help!
I like the DARK layout!
Advertisement
i have the answer

-@linear|1-1: 1 |
| 1-2: 2 |
| 1-4: 4 |
| 1-8: 8|
/------@decode
/
/
@
d
e
c
o
d
<-error: missing ''e''

replace

1 = ------@decode

draw perspective CURVE 1

"branch hint" ;found in one clock
search string for @decode

etc etc etc.

coding can be done in a single op always without
a single drop. i have it
quote: Original post by BradDaBug

Can anyone figure out what I''m trying to do/say?



I hope so! Or this is going to be a complete waste of time! ;-)

I presume what you have is:

A set of input values: call them a, b and c that are ''fuzzy''; and,
A description of the fuzzy sets {A}, {B} & {C} for which a, b and c are members.

From this you want to determine a word w taken from a set W that corresponds to the particular inputs in a ''fuzzy'' manner.

I seems to me that one way to achieve this would be to consider the joint set {A,B,C} and map values from this fuzzy set to your word set {W}.

So, take your three sets {A}, {B} and {C} and perform an ''AND'' operation on them. Given the values a, b and c, deduce the ''mass'' distribution in the fuzzy set {A,B,C} and ''de-fuzzify'' to obtain the value for w.

Make sense?

This operation would give the effect of producing a w like:

[W = "Bugger off"] given [A = hostile, B = weak, C = poor]

Hope this helps.

Tim
"Fuzzy logic" has become too broad because of misuse and ambiguity.

Anyway, With a one dimensional mood (Happy-Angry), you can build a little linked list for each value. (or range of values depending on how much work you want to do and how precise your abstract numbers are...)

So you could have something like:

CList{ "What do you want?",
"What?",
"hum?",
"Hi.",
"Hey.",
"WASSSSSUUUUP???" };

Ok...or you could have the sentences them selves be scripts
as an example for a conversation tree, with moods 1 thru 5:

:begin
? mood==1:"What do you want?"
? mood==2:"What?"
? mood==3:"Hi."
? mood==4:"Hey."
? mood==5:"WASSSSSUUUUP???"
...

If you don''t understand I could try to explain more...
quote: Original post by C-Junkie

"Fuzzy logic" has become too broad because of misuse and ambiguity.



Actually, no... Fuzzy Logic is the same as it has always been. Unfortunately, the understanding of Fuzzy Logic is "too broad because of misuse and ambiguity"!

To clarify.

Fuzzy Logic is simply a computational means of employing non-Aristotlean logic to problems. Aristotlean logic poses that there are only two possibilities with regards to membership of a set: ''true'' or ''false''. If something is in a set then the proposition ''X is in Y'' is ''true'' iff (if and only if) X is contained wholy within Y. The proposition is false otherwise (even for X partly in Y).

Fuzzy Logic states that "X is in Y with degree Z". Some people call Z the ''belief'' that "X is in Y", or even the probability(likelihood) that "X is in Y". Any of these interpretations is acceptable and generally depends on the context.

There are formal mathematical rules for determining whether "X is in Y" is true according to Aristotlean logic: c.f. set theory. There are also formal mathematical rules for determining to what degree "X is in Y" within a Fuzzy Logic formalism. I''m not going to go into the maths unless someone specifically requests it.

Unfortunately, many people confuse Fuzzy Logic with a whole range of other things, in particular probability theory. Most people who talk about it are not sure how to implement Fuzzy Logic correctly and thus create something that they think is performing Fuzzy Logic on their sets, but alas is not.

If anyone would like some good references to fuzzy logic texts, just holler.

Cheers,

Tim
I''d be interested, if you wouldn''t mind

My two chunks of silicon,
Rykard
Lord High Wannabe, Blackstaff Intertainment
My two chunks of silicon,RykardLord High Wannabe, Blackstaff Intertainment
quote: Original post by Rykard

I''d be interested, if you wouldn''t mind



Okay. 8^)

An interesting first read is Bart Kosko''s book, "Fuzzy Logic".

Some more technical books include:

McNeill & Thro, "Fuzzy Logic: A Practical Approach";
Kline & Folger, "Fuzzy Sets, Uncertainty and Information"

The book that I liked was:
Rao & Rao, "C++ Neural Networks & Fuzzy Logic".

It not only gave sufficient information to implement fuzzy sets but gave a good coverage of topics like fuzzy associative memory. It is also a great book on artificial neural networks of all flavours. The book comes with source code on CD and all the data for the examples done in the book. A very worthwhile investment!

Cheers,

Tim

This topic is closed to new replies.

Advertisement