AI Engine

@foxhavendesigns if you want you can try to implementing AI. :slight_smile:

@mifth said:2) well it saves much performance. Just imagine if 50 AICharacters will be making CollisionCheck 60 times per second. It's too much i think. 3-5 times per second is good enough... As a game can have many other things like shaders, effects, meshes, animation... which take performance too.

2a) Whether it’s too much or not depends. Even a marginally decent CPU can handle much more than 60 collision checks of 50 objects per second. Do the match: unoptimized, it’s 50 objects comparing to 49 others, multiplied by 60 cps you have 504960 = 147,000 checks per second. Of course, that won’t scale well… that’s why you use octrees or equivalent for collision checking.

  1. Shaders, effects and meshes tend to burden the GPU, not the CPU (CPU just sets these up, the main work is done by the GPU). I.e. you can hit one limit and still have lots of headroom with the other.
    (At least that’s my current understanding how 3D graphics cards work.)
@toolforger said: 2a) Whether it's too much or not depends. Even a marginally decent CPU can handle much more than 60 collision checks of 50 objects per second. Do the match: unoptimized, it's 50 objects comparing to 49 others, multiplied by 60 cps you have 50*49*60 = 147,000 checks per second. Of course, that won't scale well... that's why you use octrees or equivalent for collision checking.
  1. Shaders, effects and meshes tend to burden the GPU, not the CPU (CPU just sets these up, the main work is done by the GPU). I.e. you can hit one limit and still have lots of headroom with the other.
    (At least that’s my current understanding how 3D graphics cards work.)

  • If you have 1000000 polygons (even in physicsSpace) your collision calculation will die. Also, mobile apps need havy optimization.
    Edited: Also in my game (Road to Providence) i have 300fps without physcs and 200fps with physics. If there will be also 147,000 check - my game will die.

  • I just said it for example. Well, there can be EntitySystem, and other things which can take performance. Also Mobile apps have not so cool CPU. :slight_smile:

  • Thanks @mifth

    I’ll start playing with it too hopefully soon, but after gsoc we’ll make it work for sure.
    You gave some good points

    - it would be cool to have a choice to run the AIEngine in the separete thread.

    Sure, just lets be sure we wont get into some synchronization nightmare.

    - It would be cool to have ability to pause some AI characters. In this way no updates will be and performance will be much better. For example, if AICharcacter has distance>300meters, so no updates will be for the AICharacter.

    Yes. We can make each event have range so, characters out of range dont get updates

    @sevarac said: Thanks mifth

    I’ll start playing with it too hopefully soon, but after gsoc we’ll make it work for sure.
    You gave some good points

    Sure, just lets be sure we wont get into some synchronization nightmare.

    Yes. We can make each event have range so, characters out of range dont get updates

    No problem. If you need any help you can find me in IRC or here on the forum. :slight_smile: