Pipes
icon1 acmACIS | icon2 Problem | icon4 08 29th, 2009|
A large fresh water reservoir has two types of drainage system. Small pipes and large pipes. 6 large pipes, on their own, can drain the reservoir in 12 hours. 3 large pipes and 9 small pipes, at the same time, can drain the reservoir in 8 hours. How long will 5 small pipes, on their [...]





recently i needed to write a macro that processes an MS  Visio 2007 page and and does some actions based on the contents of a custom defined stencil shapes, where this contents are saved as a Shape Data field in the shape

the problem was i wanted to access the Shape Data of each shape

there is a data type Shape, which has a data field names “Name” which specifies it’s Class

i mean if u r using the following shape set

and dropped an object from the Triangle Class, that object will have the data field “Name” holding the string “Triangle.xx” where the xx is a unique number for that object in the current document

so to make sure that it’s of the class “Triangle” u can use the function “Mid” in VBA that is a substring function, like

IF mid(shpObj.Name,1,8) = "Triangle" Then
'say i am a drunk square
End IF

back to the main topic

i needed to access the Shape Data for the dropped objects, trying to use  the intellesnce that existed in the VBA studio that is already in the office

i found nothing called “ShapeData” or anything named data that can help

so of course the second step would be google,

after a little search i found that most if the shape data are saved in a 3D table, this table is composed of Cells that hold somthing

according to all the results i’ve found, i could access the value of the Shape Data i need using the property shpObj.Cells()

which is the table cells indexed by the cell’s name

so assuming that we are using the shape in the first figure, and want to access the Shape Data “Cost”

i could write

shpObj.Cells("Prop.Cost").Format

where “Format” holds the value held by this cell

but running this code produced an exception which is equal to “Object reference not set to an instance of an object” .Net Exception

which meant that this cell has not been found returning a NULL which have no “Format” to be accessed

i was sure of the name, and tried some other combinations on “Prop” and “Cost”, and always the same result

so, back to google, i found nearly the same ways to access the data

so, the next step, MSDN… it was a typical waste of time with no results, u can search for the information in the MSDN in google better that using the MSDN search itself, just add “msdn” before ur query

so, back again to google D

i found another field in the shape object called CellsSRC(), that is the 3D data table holding the data

it takes three indexes for a particular cell (Section index,Row index,Column index)

so i moved to the debug mode, added a watch “shpObj.CellsSRC(1,1,1)”, and noticed the values, changed the section index till the data was in the same context i needed, then change the column index and the row index, (u can use the constant VisSectionProp to advance directly to the Shape Data section e.g. shpObj.CellsSRC(VisSectionProp,1,1) )

and at last i’ve found the data item i need, and the cell had a weird name…

it is supposed to be “Prop.Cost”  -if we are to follow the first figure example- but i found it “Prop.xxx_Cost” where the xxx were some other letters i don’t remember -as i was pretty mad at this moment D -

so i “copy-paste”ed this Name and wrote

shpObj.Cells("Prop.xxx_Cost").Format

in the watch and found the result i wanted, but take care the value in the “Format” field is/must be surrounded by extra double quotes

as if the value u want to add is “x”, you should add it as ” “x” ” (spaces between double quotes are for demonstration)

and at last…. it worked D

i had some other problems but that was the major one

one last thing…

i could have used the .NET development kit for office, but i just wanted to try VBA macros, now i doubt that i took the right decision D

Tagged: Cells, CellsSRC, Google, Microsoft, Microsoft Office, Problems, Programming, Shape, Shape Data, VBA, Visio, Visual Basic for Applications




Years [Answered]
icon1 acmACIS | icon2 Solution | icon4 08 28th, 2009|
The answer is 2003, they all are prime years The Winners The First Hebatalla The Second Magdy Sayed The Third Nessma Ossam Then marmoor1989 Ahd EnasMohey





today after work i went to pray in a mosque near the company,

i was with three other friends and it was a new built mosque, it looked great from inside, intensively air-conditioned, big and well designed from inside

and like any other mosque it had the digital prayer times calculator

but in addition to the upper pic there was another field that was offbut what i understood later that it is used to show the time between the Azan and Iqama, so once it started to count down to the Iqama 1 minute before it.

actually i didn’t notice it except 5 seconds before Iqama time, it was my first time to see such feature in such calculator, i’ve seen one that counts down to the Azan time, but not this one

i don’t know why i felt something is going to happen when it reaches “00″, and more than one time me and one of my friends looked at each other and stared at the counter waiting it to reach the zero

u may say that it was 5 seconds, but they passed slowly, i don’t know why

but with every second passing i felt  that something is going to happen

what thing ?? i don’t know D

and time passed

5

4

3

2

1

0

…….

the weird thing is that nothing happened,  yeah weird

of course u’re gonna ask “why is that weird ?”

actually i don’t know, i kept asking my self that question till now

and my friend felt that too !!!

may be i was waiting for the Iqama to be played from that calculator, the microphones goes on, an alarm rings or even lights goes off D

may be coz my career in life is related to automating life..

but nothing happened !!!!

even the man who was supposed to broadcast the Iqama didn’t show up till 3 minutes later

i felt a very strange feeling that i am not able to explain D D

i don’t know what was that or why was that,

but at least it was a day that passed….

Tagged: Azan, Iqama, Mosque, Prayer, Prayer times calculator, Work




Years
icon1 acmACIS | icon2 Problem | icon4 08 21st, 2009|
What year comes next in this sequence: 1973 1979 1987 1993 1997 1999




Escape [Answered]
icon1 acmACIS | icon2 Solution | icon4 08 21st, 2009|
The answer is:- One person is chosen as the Counter. When a prisoner enters the living room, if the light is off they turn it on – but only if they have never switched it on before. When the Counter enters the room, if the light is on, they will turn it off. When the Counter [...]




Game AI
icon1 ZiKaS | icon2 AI for Games | icon4 08 20th, 2009|

Game AI

  • It is a common mistake to think that the more complex the AI in a game, the better the characters will look to the player. Creating good AI is all about matching the right behaviors to the right algorithms
  • Knowing when to be complex and when to stay simple is the most difficult element of the game AI programmer’s art. The best AI programmers are those who can use a very simple technique to give the illusion of complexity
  • You need to make sure that a characters’ AI matches their purpose in the game and the attention they’ll get from the player
  • Perceptions should only be what exactly AI character need not more
  • Take care of changing behaviors (2 solders conversion example – 63)
  • For in-game AI, behaviorism is the way to go. We are not interested in the nature of reality or mind; we want characters that look right. In most cases, this means starting from human behaviors and trying to work out the easiest way to implement them in software
  • Developing Game AI Could Use:
    • Hacks: ad-hoc solutions and neat effects
    • Heuristics: rules of thumb that only work in most, but not all, case
    • Algorithms (the “proper” stuff)
  • Developers rarely build a great new algorithm and then ask themselves, “So what can I do with this?” Instead, you start with a design for a character and apply the most relevant tool to get the result
  • Some if the AI doesn’t require an algorithm or a technique it only requires a simple bit of code that performs an animation at the right point
  • Human beings use heuristics all the time. We don’t try to work out all the consequences of our actions. Instead, we rely on general principles that we’ve found to work in the past (or that we have been brainwashed with, equally)
  • Problems with heuristics all the time: range units when shooting peons (65)
  • Common Heuristics:
    • Most constrained
      • For example, a group of characters come across an ambush. One of the ambushers is wearing phased force-field armor. Only the new, and rare, laser rifle can penetrate it. One character has this rifle. When they select who to attack, the most constrained heuristic comes into play: it is rare to be able to attack this enemy, so that is the action that should be taken
    • Do the most difficult first
      • For example, an army has two squads with empty slots. The computer schedules the creation of five Orc warriors and a huge Stone Troll. It wants to end up with balanced squads. How should it assign the units to squads? The Stone Troll is the hardest to assign, so it should be done first. If the Orcs were assigned first, they would be balanced between the two squads, leaving room for half a Troll in each squad, but nowhere for the Troll to go
    • Try the most promising first:
  • Hacks and heuristics will get you a long way, but relying on them solely means you’ll have to constantly reinvent the wheel. General bits of AI, such as movement, decision making, and tactical thinking, all benefit from tried and tested methods that can be endlessly reused (use algorithms here)
  • Just remember that for every situation where a complex algorithm is the best way to go, there are likely to be at least five where a simpler hack or heuristic will get the job done
  • One of the major reasons that new AI techniques don’t achieve widespread use is their processing time or memory requirements
  • Processor Issues in Game AI:
    • Complex AI that does work in games needs to be split into bite-size components that can be distributed over multiple frames. The chapter on resource management shows how to accomplish this. Applying these techniques to any AI algorithm can bring it into the realm of usability
    • SIMD:
      • Most modern CPUs have dedicated SIMD processing. SIMD (single instruction multiple data) is a parallel programming technique where a single program is applied to several items of data at the same time
      • Steering algorithms benefit from this feature
    • Multi-Core Processing and Hyper-Threading:
      • Modern processors have several execution paths active at the same time. Code is passed into the processor, dividing into several pipelines which execute in parallel. The results from each pipeline are then recombined into the final result of the original code. When the result of one pipeline depends on the result of another, this can involve backtracking and repeating a set of instructions. There is a set of algorithms on the processor that works out how and where to split the code and predicts the likely outcome of certain dependent operations; this is called branch prediction. This design of processor is called super-scalar
      • Normal threading is the process of allowing different bits of code to process at the same time. Since in a serial computer this is not possible, it is simulated by rapidly switching backward and forward between different parts of the code.
      • A multi-core processor effectively has multiple separate processing systems (each may be super-scalar in addition). Different threads can be assigned to different processor cores
    • Virtual Functions/ Indirection
      • Virtual functions add flexibility to the code but it’s very costly
  • Memory Concerns:
    • Cache:
      • If processors had to rely on the main RAM, they’d be constantly stalled waiting for data
      • All modern processors use at least one level of cache: a copy of the RAM held in the processor that can be very quickly manipulated. Cache is typically fetched in pages; a whole section of main memory is streamed to the processor. It can then be manipulated at will. When the processor has done its work, the cached memory is sent back to the main memory.
      • In my experience (author), dramatic speed ups can be achieved by making sure that all the data needed for one algorithm is kept in the same place
  • PC Constraints:
    • If the AI gets less time to work, how should it respond? It can try to perform less work. This is effectively the same as having more stupid AI and can affect the difficulty level of the game. It is probably not acceptable to your quality assurance (QA) team or publisher to have your game be dramatically easier on lower specification machines
  • Develop your AI code to be an AI Engine that could be reused
  • Try to develop tools that can generate you AI Code ( as in steering behaviors)
  • AI-Implant’s Maya module, for example, exposes complex Boolean conditions, and state machines, through graphical controls

 





Introduction
icon1 ZiKaS | icon2 AI for Games | icon4 08 19th, 2009|

Introduction

  • What is AI?
  • Many of trivial problems ( playing Connect 4) were solved by computers but there are many things that computers aren’t good at which we find trivial: recognizing familiar faces, speaking our own language, deciding what to do next, and being creative. These are the domain of AI: trying to work out what kinds of algorithms are needed to display these properties
  • In academia, some AI researchers are motivated by philosophy: understanding the nature of thought and the nature of intelligence and building software to model how thinking might work. Some are motivated by psychology: understanding the mechanics of the human brain and mental processes. Others are motivated by engineering: building algorithms to perform human-like task. Where game developers concerns with the last motivation
  • History of Academic AI:
    • The Early Days:
      • In the early days (before computers) some questions appeared (in philosophy of mind) as:
        • What produces thought?
        • Could you give life to an inanimate object?
        • What’s the difference between cadavers (جثة) and human it previously was?
      • Pioneers of the field these days were: Alan Turing (father of AI), von-Neumann, Shannon
    • The Symbolic Era:
      • From 1950s till 1980s main thrust in AI research was in “symbolic” systems
      • A symbolic system: is one in which the algorithm is divided into two components (as Expert Systems):
        • Set of knowledge: represented as symbols such as words, numbers, sentences, or pictures
        • Reasoning algorithm: that manipulates those symbols to create new combinations of symbols that hopefully represent problem solutions or new knowledge
      • Other symbolic approaches in games: blackboard architecture, pathfinding, decision trees, state machines, steering algorithms
      • Common disadvantage of symbolic systems: when solving a problem the more knowledge you have, the less work you need to do in reasoning
      • The more knowledge you have, the less searching for an answer you need; the more search you can do (i.e., the faster you can search), the less knowledge you need
    • The Natural Era:
      • From 1980s to 1990s frustration symbolic approaches come into two categories:
        • From engineering point:
          • early success on simple problems didn’t seem to scale to more difficult problems
        • From philosophical point:
          • Symbolic approaches are not biologically plausible (i.e. You can’t understand how a human being plans a route by using a symbolic route planning algorithm)
          • The effect was a move toward natural computing: techniques inspired by biology or other natural systems (like ANN, GA and simulated annealing)
  • The no-free-lunch theorem and subsequent work has shown that, over all problems, no single approach is better than any other
  • The narrower the problem domain you focus on, the easier it will be for the algorithm to shine. Which, in a roundabout way, brings us back to the golden rule of AI: search (trying possible solutions) is the other side of the coin to knowledge (knowledge about the problem is equivalent to narrowing the number of problems your approach is applicable to)
  • Game AI:
  • Till 1990 all computer-controlled characters used FSM
  • In 1997 the new technique included was ability to see colleagues and notify them when killed
  • In mid-1990s RTS games (Warcraft II) was the first time popular game having robust pathfinding implementation
  • The AI in most modern games addresses three basic needs:
    • The ability to move characters,
    • The ability to make decisions about where to move
    • The ability to think tactically or strategically
  • Model of Game AI:

  • Movement:
    • Movement refers to algorithms that turn decisions into some kind of motion
    • Examples (49):
      • Super Mario example when attacking enemies with bullets
      • Guard that want to reach alarm example
  • Decision Making:
    • Involves character working out what to do next
    • Examples: take the decision to attack, defend, patrol…
  • Strategy:
    • To coordinate whole team you need a strategic AI
    • In the context of this book, strategy refers to an overall approach used by a group of characters
    • In this category are AI algorithms that don’t control just one character, but influence the behavior of a whole set of characters
    • Example: surrounding a player in FPS Game
  • Infrastructure:
    • These are Information Gatherer (perception) and execution management issues
  • Agent-Based-AI:
    • agent-based AI is about producing autonomous characters that take in information from the game data, determine what actions to take based on the information, and carry out those actions
  • Techniques in this book are implemented into 3 categories: Algorithms, Data Structures, Game Infrastructure
  • Key elements to know when implementing algorithms:
    • Know the problem the algorithm want to solve
    • A general description of the working mechanism of the algorithm including diagrams
    • A pseudo-code presentation of the algorithm
    • Indication to the data structure used in the algorithm
    • Particular implementation node
    • Analysis of the algorithm performance: execution speed, memory footprint and scalability

Weaknesses in the approach





Before Chapter # 1
icon1 ZiKaS | icon2 AI for Games | icon4 08 18th, 2009|

Before Chapter # 1

  • This book is an outworking of that experience. It doesn’t tell you how to build a sophisticated AI from the ground up. It gives you a huge range of simple (and not so simple) AI techniques that can be endlessly combined, re-used, and parameterized to generate almost any character behavior that you can conceive

 






Steering Behaviors (SB)

  • Sometimes in games, creatures not require intelligence and you want them to behave in natural way. Here you are looking for steering behavior
  • Steering techniques tend to be low level and concerned only with which direction a character should steer (يتوجه)
  • Characters that use SB are called autonomous agents meaning that they are typically set in motion and don’t require additional help from programmer or scripted elements in order to perform within the game world
  • SB are only concerned with movement so autonomous here appears in that area only
  • Reynolds call his original creatures boids and he set up 3 simple rules that can model complex locking behavior
  • These rules are:
    • Alignment: your head should always be in the same direction with the rest of the group
    • Cohesion: force of keeping the group together; tight and focused
    • Separation:
      • Could be seen as opposite of cohesion. This gives group members “personal space bubble” so they don’t crowd each other too much and every individual has room operate

 

  • Emergent behaviors is something like holy grail of game programming, where combination of simple local rules lead to very complex global behaviors
  • Because every boid is behaving in local stimulus (حافز), by time this can lead to chaotic state. But negative feedback from the main controller brings the overall group back into more ordered state
  • Prediction of the next behavior is 1 minute is impossible!
  • When to combine behaviors take in account following:
    • The combination could lead to meaningless behavior
    • Some behaviors could cancel other behaviors (antagonistic behaviors)
  • Most popular combining behaviors are:
    • Simple Weighted:
      • Sum up all individuals steering forces
      • Apply a weight multiple to each force vector before adding it into running sum
        • This able you to control the effect of the steering behavior on the overall system
      • The problem here is: how to find the suitable weights that lead to balance
      • Expensive o n CPU time because this calculation is calculated every game loop
    • Prioritized Sum:
      • Behaviors are stored in prioritized list
      • When we update each one we sum the result into accumulated steering force
      • The magnitude of the incoming force is subtracted from the maximal force (set by the programmer)
        • Here when we pass the maximal amount we truncate sum and stop updating
      • Advantages:
        • Here we only update exactly the number of allowed behaviors
        • We set up the behaviors here from important (pure) to lower importance
    • Prioritized
      Dither:
      • All the given behaviors are stored in priority order
      • Each behaviors is assigned a probability value
      • When the manages goes to update behavior collection, it rolls the dice and tests against the behavior’s probability value
        • If it passes, the behavior is updated
        • If the behaviors does something (sends back a steering vector), then its ignored
      • And after that the behavior in the collection is tested
      • Advantages:
        • For accurate results a very probability will be assigned to it
  • Pros of Steering Behaviors:
    • Ease of implementation
    • Predictable
    • Inexpensive to execute on the CPU
  • Cons of Steering Behaviors:
    • Combinatorial complexity
    • Short sightedness (بعد النظر)
    • Deadlocking problems
    • Large tuning requirements
    • They look robotic is misused
    • Not great at modeling idle states
  • Extension to Paradigm:
    • Layered Steering:
      • Each steering behaviors has other system of steering
      • The layers tend to be general then specific
    • Learning Behaviors:
      • Use learning behaviors in:
        • Altering weights and probabilities of behaviors
        • Learn the agent when to use the specific behavior
      • GA was used successfully in that area
      • There are 2 papers useful in that topic:
        • Competition, Coevolution and the Game of Tag
        • Evolution of Corridor Following Behavior in a Noisy World
    • Common Steering Behaviors:
      • Approach
      • Pursuit
      • Evade
      • Arrive
      • Avoid
      • Wander
      • Purist With Offset
      • Patrol
      • Match Target Speed
      • Hide
      • Interpose
      • Orbit
      • Flow Field Following
      • Queuing
    • Data-Driven Steering Behaviors:
      • This will be grateful for game designers because with one mouse click a new behaviors will be added to your system
  • Optimizations:
    • Load Balance:
      • Update certain agents in certain loops
        • Take care here if you are using flocking groups so, all the group should be updated
      • Update agent under condition
        • Like if we have a leader and a following group, the group will not be updated only if the leader changes his state
      • Using less costly combination methods for certain percentage of time
        • In order to partially bring down CPU cost without losing all the accuracy in your game
    • Priority/Weight Adjustments:
      • Assign the highest propriety to the least expensive behaviors you have (also does work well)
      • The less cost behaviors could be checked first
  • Design Considerations:
    • Genre: preferred to be used with tactical types
    • Agent Reactivity: very reactive and able to be adjusted
    • System Realism: suitable for realism
    • Genre:
      • Genres that require emergent, organic movement from AI controlled agents
      • Genres that have groups and flocking behaviors exist
    • Development Limitations:
      • Make sure of the produced emergent behaviors by system
  • Note:

Always check that you problem is really simplified break down to the simplest behaviors you have





Escape
icon1 acmACIS | icon2 Problem | icon4 08 17th, 2009|
100 prisoners are locked up in individual cells, unable to see, speak or communicate in any way with each other. There is a central living room with a single light bulb, the bulb is initially off and no prisoner can see the light bulb from their own cell. Every day, the warden picks a prisoner at [...]




What is the Number [Answered]
icon1 acmACIS | icon2 Solution | icon4 08 17th, 2009|
Answer: 7-3 = 4 4 – 1 = 3 so 4 * 3 = 12 =========== 6 – 2 = 4 8 – 7 = 1 so 4 * 1 = 4 The Winners The First: dody The Second: marmoor1989 The Third: Eman The Forth: EnasMohey





i just wanted to know the meanings of the complicated names of the Ubuntu releases, maybe it’s complicated for me, i’vee never heard such words before “intrepid , Jaunty , Ibex,….”

so i did some search to find them, and here are the meanings

first all the code names are composed of 2 words an adjective and an animal, both starting with the same character where releases are sorted alphabiticaly except the first two releases

meglyman_wartywarthog

Release 1 ( Ubuntu 4.10 Warty Warthog)

which means a type of swines covered with Pustule

which is an ugly looking swine D , duno why did they name it so

Ubuntu_5.04_Hoary_Hedgehog_

Release 2 (Ubuntu 5.04 Hoary Hedgehog)

which is a gray hedgehog, it looks cute… i like it )

badger-3

Release 3 (Ubuntu 5.10 Breezy Badger)

a delighted badger, thanx God it’s delighted D

dapper-drake

Release 4 (Ubuntu 6.06 LTS Dapper Drake)

a handsome male duck D

LTS is for  Long Term Support

where the support ended on july 2009

edgy-eft

Release 5 (Ubuntu 6.10 Edgy Eft)

an excited eft, i duno what is the eft

but check the pic D

feisty-fawn

Release 6 (Ubuntu 7.04 Feisty Fawn)

an energetic antelop

starting to be cute )

gutsy-gibbon

Release 7 (Ubuntu 7.10 Gusty Gibbon)

a noisy monkey D

ubuntu_heron

Release 8 (Ubuntu 8.04 LTS Hardy Heron)

a brave heron “a bird”

ibex

Release 9 (Ubunut 8.10 Intrepid Ibex)

a fearless wild goat

that was my  introduction to Ubuntu family

Jackalope

Release 10 (Ubuntu 9.04 Jaunty Jackalope)

a cheerful Jackalope where the jackalope is a

legendary type of deer-rabbit

or a rabbit infected with some sort of virus

but anyway it looks veryyyy cute

654px-cutest_koala-450

Release 11 (Ubuntu 9.10 Karmic Koala)

its an active koala, this cute animal )

i’m very waiting for its release

there is one word which i couldn’t get it’s meaning but i like it

Ubuntu

Tagged: Ubuntu, Ubuntu Breezy Badger, Ubuntu Dapper Drake, Ubuntu Edgy Eft, Ubuntu Feisty Fawn, Ubuntu Gusty Gibbon, Ubuntu Hardy Heron, Ubuntu Hoary Hedgehog, Ubuntu Interpid Ibex, Ubuntu Jaunty Jacklope, Ubuntu Karmic Koala, Ubuntu Warty Warthog





Common AI Development Concerns

  • Designing Issues:
  • Data-Driven AI System:
    • Data-Driven primitive Levels: animations, behaviors and strategies
    • Designers could build animations themselves
    • Data-Driven system doesn’t improve AI engine but supplies its degree of organization
    • Be sure that you are not driving data for areas that are better with code solutions
    • Rule of Thumb Here:
      • Create reusable, simple primitives that allow users to build more complex objects
  • The One-Track-Mind Syndrome:
    • The problem is that AI programmer apply one AI technique on all AI problems in the game
    • Most error here: “State Machines are all you need!”
    • Every AI technique is suitable for particular input and under particular game conditions
    • You can use FSM for basic layout of the game, FuSM for main short decision layer, a simpler planner to run your pathfinding and long term decision making layer , and a scripting system to drive your animations
  • Load of Details (LOD):
    • LOD might entail (handle AI details between various levels):
      • Off-screen and faraway: characters are completely non-exist for human player
      • Off-screen and close: characters can’t be seen but the human player might still hear them
      • Very far-off: character is visible a pixel or two
      • Far-off: characters are visible as solid colors but no real details yet (you can differentiate between truck and car)
      • Medium: this distance would be your true area of sight
      • Close: anything closer than medium
      • Interaction: the character is interacting directly with the player someway
    • If characters are in off-screen faraway then we can forgot about real obstacle avoidance
    • There could be LOD systems for your engine that determines the current level of detail
    • Areas under human sight could be updated thirsty times per second and far-away area could be 3/2 times
    • Scientist example (page 647)
    • LOD in RTS Game (page 648)
      • Buildings and mining will be statistically determined (without moving peons)
  • Helper AI:
    • Some areas still benefit from AI techniques as:
      • User Interface
      • AI Advisors
      • Automated Testing Systems
        • Testing Areas:
          • Limits Testing: testing values around of system’s capabilities
          • Random Testing: uses completely random input to the system
          • Smart Testing: real-game play techniques are applied
  • General AI Thinking:
    • Determine the goals of your AI controller
    • Brainstorm about how to solve these problems
    • Talk with AI staff about each proposed solution you have got
    • Coining the solutions in a small prototype (like AIsteroids)
      • Here you have 80% of the solution the rest 20% will be discovered in the code
    • Think in fuzzy with your colleagues
  • Always differentiate between good programming and programming for sake of goodness
  • Consider novelty in your AI Engines (like MOHAA when you throw grenade on them they pick up it and throw it back)

Stupid AI could do: Rules Enemy, Bad Pathfinding, Non-Contextual Enemy, Oblivious Enemy






Today.., no no… now…. is the first lesson in my sister’s private chemistry course

personally i hate private courses, all of them, i can not deny that i took private courses during my secondary school but i didn’t start from AUGUST !!!!

why is that ?!!!

i can hear the teacher saying “we have no time, we have to finish as soon as possible” and “you have to study 16 hours per day”

what the &%$%^ !!!!!!

i just don’t know what to say but again I HATE PRIVATE COURSES

Tagged: Chemistry, Private Course, Sisters, University




How To Use “PC^2″ In ACM Contests
icon1 Tasniem Seliem | icon2 Inside Contests | icon4 08 10th, 2009|
يعتبر برنامج PC^2 أهم ما فى مسابقات ال ACM, وذلك لأن عن طريقه يمكن أدارة المسابقة من كافة النواحى, ويعتبر قناة الوصل الوحيدة بين المتسابقين "Teams" والحكّام "Judges". وفى هذا الموضوع سنتناول الاتى : كيفية الدخول الى البرنامج. ارسال الحلول "Submit". نتائج الحلول "Run Results". التوضيحات والأسألة "clarification". تغير ال Password. ال Score Board.




Distributed AI
icon1 ZiKaS | icon2 AI Game Engine Programming | icon4 08 10th, 2009|

Distributed AI

  • The first rule of ALL game programming: Keep it Simple, Stupid
  • The purpose of the distributed method is to simplify overall AI creation and maintenance, by spreading out AI tasks into modular, as well layered systems working with each other
  • Several AI Engine Layers:
    • Perception/Event Layer: Filters incoming sense data for relevance and various other factors
    • Behavior Layer: Determines the specifics of how to perform a given action
    • Animation Layer: Determines which animation to play to fit game state
    • Motion Layer: Handling aspects like pathfinding, collisions and avoidance
    • Short-Term Decision Making Layer:
      • The narrow-view intelligence for the AI entity, primarily concerned with just the entity
    • Long-Term Decision Making Layer:
      • Handles wire-view intelligence issues, like planning or team based considerations
    • Location-Based Information Layer:
      • Includes information transmitted to the entity from influence maps, smart terrains

     

  • Perception and Events Layer:
  • Why to create central perception System:
    • Prevent game values being calculated several times within single game loop
    • Supports debugging and tracking the system
  • Perception systems works fine with message based systems

     

  • Behavior Layer:
    • This layer is a candidate for data-driven systems
    • The more content designers put in this layer, the more virtually “calculation-free” personality and intelligent your characters with exhibit
    • scripts shouldn’t contain math; it contains sense-style that characters’ behaviors requires to seem realistic

     

  • Animation Layer:
  • Choosing right animation to play is not a trivial task
  • Scripted systems here saves calculation time

     

  • Motion Layer
    • Basic movement, pathfinding and obstacle avoidance algorithms stated here
    • You can adjust this layer for every character you have:
      • Smart Character: know when to use teleport in the suitable time
      • Weak Character: let the obstacle pass first and then he passes
      • Strong Character: move the obstacle away the way!

     

  • Short-Term Decision Making:
    • This layer is relative to character either because of its attributes, its current perceptions or its last experience
    • A character might be almost dead so his goal now is to get health power up or run away
    • A character’s weapon is empty so, its goal now is to hide and reload the weapon and appear again
    • Most of the games develop the ST layer in state-based manner

 

  • Long-Term Decision Making:
    • LT are likely to be outside any one unit
    • In RTS games this layer usually developed under FuSM
    • This layer contain the planning algorithms and high strategic decisions
    • In RTS games, AI opponent can use full fuzzy system logic to “guess best” action to take under current info

 

  • Location-Based Information Layer:
    • This layer is like blackboard architecture for creating AI Engines
    • Uses of LBI Systems:
      • LBI can help LT in determining weak defensive area
      • In knowing military intersect area in the map
      • Discovering valuable suitable ambush areas in the map
      • Pathfinding algorithm use LBI to avoid kill zones or bad designs in the map
    • Triggers could be added to this layer to help to simplify other layer (like be careful enemy is near you!)

     

Quote: “reaching for insect intelligence first, and then go on”






Other Techniques of Note

  • Artificial Life (ALife):
    • ALife is about searching to find “governing principles” to the life
    • Rules that can’t be broken in the future and can be used without fail to understand aspects of nature and predict outcomes based on hard equations
    • Newton has proved Descartes’ clockwork universe: in which God set up everything like a clock. God’s only contribution to the universe was to set everything in motion, and from there the laws of science took hold and have governed every sequence of events since that time
    • Chances to find any governing principles are so limited so we could construct our own “life simulations” so and doing so find out more about how life in general operates
    • ALife is a field of studies that hopes to understand natural life better by attempting to recreate biological phenomena from virtual computer environments
    • One main tenet of alife is that life is simply an emergent property of nature following some very simple rules over and over again
    • An emergent property refers to a trait or behavior exhibited by a creature that reaches beyond the capabilities of its constituent parts (Question)
  • ALife Usage in Games:
    ALife was used in Black & White and Creature Games
  • Artificial Life Disciplines:
    • Cellular (خلوي) Automata (CA):
      • CAs are group of algorithms that show a stunning amount of complex behavior with the very simplest of rules
      • Cells example (page 522)
      • When to use CAs:
        • Simulating mold growth
        • City building
    • Self-Organizing Behavior and Flocking (التدفق):
      • Large group of creatures can organize their movements within groups quickly, easily with what appears to be unified mind
      • Investigations here were to produce algorithms that allow us to replicate this kind of behavior using simple rules
      • The most famous research in this area was Boid research, mainly by using few key concepts you can achieve a remarkable simulation of many types of flocking movement
        • These simple concepts are:
          • Separation to avoid crowding
          • Alignment to the average group heading
          • Positional cohesion of the group
    • Genetic Algorithms: can
      model the idea of evolution
  • Pros of ALife:
    • Emergent behavior:
      • ALife is one of the best ways we currently have of creating emergent situations
      • Emergent behavior will appears in games where the AI opponent with simple actions that can be combined in different ways leading to a wealth of different final behaviors
    • Behavior of reuse:
      • ALife forces the developers to build games out of building blocks, assembling gameplay until it can be expressed in simple rules. In fact many ALife games are simple to build
  • Cons of ALife:
    • Emergent behavior: the emergence outcome could be not entertained!
    • Tuning issues: little changes in game parameters could destroys the emergence behavior completely
  • Some games uses ALife with creatures to create actual ecologies within the world instead of random spawn points

     

  • Planning Algorithms:
  • Planning is, deciding upon a course of action before acting
  • Formulas that planning algorithms follow:
    • Break the abilities of the AI into distinct operators
    • Designing your AI character, and game environment in states manner
    • Construct either:    
      • Tree: that shows transition connections between states and lists the transition operators
      • Rules embedded in each state: that details which operators are available
    • Then, AI forms a plan within a local working memory by applying these transitions on a copy of its current state, testing for the best action to the behavior it wants
  • Here you know what your start state and end state, planning lists the best string of operations to get you to the end
  • Example: the plan to a pathfinding (page 525)
  • Because planning is costly we’ve used hardcoded plans (scripts, FSM…) which allow us usually do right behaviors
  • Usage in Games:
    • Used in pathfinding algorithms
    • Used in attacked/defense in RTS games: when AI sees that the enemy creates unit from type X so it (AI Opponent) searches in its technology tree for the path to get the anti-unit to that unit and start creating it
    • In FPS games: a human entering a room for a power up and AI should kills him (527)
      • This is a serious AI player that mimic humans
    • Make AI anticipate ambushes
  • Some Planning Techniques:
    • A*
    • Means And Analysis (MEA):
      • combines forward and backward searching of tree & tries to minimize unnecessary search
    • Patch Recalculation:
      • Get a broken plan then pass this plan to a function that patches (by come up with planning step) the hole is this plan
      • This method is used when an event happens results in broken plan & also your plan should be long
      • This planning technique provides a way of keeping plans up to date without having to start from zero
    • Minimax:
      • Considers your opponent is going to be working against you every chance he can get
      • Reinforcement Learning cold be combined with that technique resulting in more challenging behaviors
  • Pros of Planning:
    • Planning algorithms provide much intelligent looking behavior
    • Planning is generic and could be developed once and used in many contexts
    • Planning can be implemented hierarchically (See example page 528)
  • Cons of Planning:
    • Planning is computationally complex
    • Humans player are unpredictable so you should be careful in the plan depth
      • Make balance between speed and flexibility of plan Vs. having short range plans to avoid gaffs
      • For long plans you could use patching recalculation to adapt them on the situation
    • Planning can make the AI seems sluggish (بطيء) or un-reactive if plans are too monolithic (متشابهة) or take too long to adapt to new situations
  • Areas for Exploitations (الإستغلال)within Games:
    • Planning is used when creating strategic AI systems that require many steps to achieve goals
    • Most candidate for planning is RTS Games
    • Used in FPS, could be used to set ambushes and traps
    • Used in race-car to pass critical corners quickly rather than just “seed up” the car
    • Used in Frightening Games in choosing damaging combinations (box attack then kick head …)
    • Used in football games to confuse human player or waste time till much ends (to win of course!)

 

  • Production Systems:
  • Production systems are also referred as expert systems
  • Production systems are rule-based systems that strive to encompasses expert knowledge within a specific area
  • Example of this is hardcoded conditional if-then branches within your AI engine to make decisions
  • In 1969, Alan Newell and Herbert Simon released the theory of the General Problem Solver (GPS) based on how the human mind operates (means-and-analysis)
  • GPS tends to store expert knowledge about highly specific problem
  • Production system is separated into four parts:
    • Global database
    • Production rules: serve as actual if-then statements
    • Rules/Situation Matcher: decides which operator to use next upon the database get closer to your goal
    • Conflict resolution function (for use with rule collisions)
  • Production system use:
    forward chaining inference and backward chaining inference
  • Production systems could be used as planning systems or learning devices
  • John Laird and his team successfully interfaced Soar with both Decent 3 and Quack 2 and created competent, non-scripted opponents for each game. Using a system more than 700 rules, they created quack bot that can move in game levels; use all weapons and level elements (such as bonus pad, teleporters). Can anticipate human actions and also creating custom routes of travel to maximize amount of power ups it could collect and perform intelligent ambushes and human behaviors
  • Pros of production systems:
    • Generic Algorithm; production systems are data independent
    • Research; tons of researches have been on production systems fast matching algorithms like RETE and TRETE (stateless of RETE) they speed up matching
    • Goal directed
    • Highly reactive (with as good set of rules)
  • Cons of Production Systems:
    • Computationally expensive; especially with games having large rule set or non-arbitrary match collision resolution
  • Areas for Exploitation within Games:
    • Written in a data-driven way; so new rules perceptions could be added easily to the game world
    • So it’ll offer highly extendible and reusable systems

     

  • Decision Trees:
  • Here you mainly convert each if-else statement in a node within a tree
  • The root of the tree could be the question that the tree answers
  • There are 2 types of decision trees used:
    • Classification Trees: trying to determine “type” of player the human is behaving like (aggressive, defensive)
    • Regression Trees: adjusting AI behaviors (too hard, too easy) on human playing difficulty
  • The differences between using Decision Trees (DT) and NN are:
    • NNs are black box; weights couldn’t be changed or understood whereas DT are fully understandable, descriptive and easy to change
    • DT can only comprehend hard comparisons within a binary outcome whereas NN could handle noisy data or data within gaps and strange jumps in behavior
    • Output from DT always discrete values where output from a NN can be continues value
    • DT consider single variable at a time (called monothetic) whereas NN can handle multiple variables at a time (called polythetic) So when a combination of variables used to take one decision NN are more suitable here
    • NN are much accurate than DT. Relative error in traditional data set might be 10 times or more for DT over back-propagated NN

  • Pros of Decision Trees:
    • Easy to use, understand and change
    • Many algorithms exist for designing, training, debugging, tuning and optimizing decision trees
    • DT are suitable to be used in games and make more sense than NN
    • Complexity could be resolved using hierarchal decision tree
  • Cons of Decision Trees:
    • BDTs deals only with distinct states, don’t scale well and difficult to maintain or extend once they got a certain level of complexity
    • The size of your tree is direct inverse correlation between accuracy and size
      • So if you need specific and accurate outputs go to NN or other techniques
    • Non-binary trees are hard in constructing, altering and using
  • Areas of Exploitation within Games:
    • Using classification to perform simple player modeling
    • Data driving the trees and provide adding and removing nodes from trees (used in Black & White to record high level thinking that you avatar did about his environment given his experiences and training, about which actions to take at any given time)
    • Can be simply used by game level designers

 

  • Fuzzy Logic:
  • Fuzzy logic is a far more advanced system, complete with its own logical proof and methods
  • The Sony PlamTop is reported to use decision trees based on fuzzy logic to classify handwritten Kanji characters
  • Fuzzy logic could be used in “Fuzzy-Logical Production System” which follows all the rules of regular production systems, but performs all its inference using fuzzy logic instead
  • The general inference process is three (optionally four) – Page 537:
    • During Fuzzification: membership function is applied to the input to determine the degree of membership
    • Unser inference: usually MIN or PRODCUT are used in inferred rules
    • Under Composition: usually MAX or SUM are used
    • Defuzzification: converting fuzzy output to crisp number (common methods: Centroid and Maximum)
  • Fuzzy systems are used in pattern recognition, financial systems and heavy data analysis
  • They are not implemented in systems that require a heavy amount of realism
  • Fuzzy set membership discuss to what extend something already is true
  • Pros: extends Boolean logic in a new manner
  • Cons: Computationally expensive (Combs method to combat this problem)
  • Areas of Exploitation within Games:
    • Dealing with unknown or partially known information (like player modeling)
    • In online games, it could used as “helper AI” that plays a game for you temporarily (if you are afk for a while)




what is the Number ?
icon1 acmACIS | icon2 Problem | icon4 08 7th, 2009|
What number replaces the question mark?




[ E ] [Answered]
icon1 acmACIS | icon2 Solution | icon4 08 6th, 2009|
The Answer is “Envelope” start with E, end with E and contain one letter The Winners The First Hassan Ibraheem The Second Aya Magdy The Third Ahmed Abdullah Then memo0o marmoor1989 Eman sara el_sebaiee kawaguchi Noran El-Kafrawy Ahd




« Previous Entries