critical bug found on win32 version...

Everything related to the code /
Tout ce qui touche au code
Post Reply
User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

critical bug found on win32 version...

Post by zuzuf » Sat Nov 10, 2007 1:17 pm

the random number generator function rand() doesn't return a 32 bits random number !!! Only a 16 bits one!! So the rand_from_table() function which is the random generator of TA3D (a cached version of rand() to speed up things) that uses rand() doesn't return numbers larger than 16bits integers !!!

It doesn't happen on other systems, but it has consequences on the win32 version of TA3D, mainly the one that made me aware of this : AI cannot decide to build more than one or two unit types !!! Because it uses the rand() function to decide ... and other units aren't covered by this short 16 bits range.

I am going to fix it, it should be easy to fix.
=>;-D Penguin Powered

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sat Nov 10, 2007 1:38 pm

ok, randomness is back :D . AI doesn't build only solar panels, it should behave as expected now.
=>;-D Penguin Powered

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Mon Nov 12, 2007 6:12 am

Hehe, now AI should have some brains :) Gona check it out.

User avatar
AF
Administrateur - Site Admin
Posts: 139
Joined: Thu Dec 28, 2006 8:19 pm
Location: NW UK
Contact:

Post by AF » Mon Nov 12, 2007 3:09 pm

Is there a direct link to the folder the AI is implemented in somewhere?

Is it integrated into ta3d or is it in an external module aka dll/so/dylib?

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Mon Nov 12, 2007 4:09 pm

AI is implemented in ... well currently I don't think we can say AI is implemented :? . TA3D currently has an API that is an interface between the game and the AI, the small behavior you'll see when playing is the result of basic commands given through this API, the whole code is in ia.cpp & ia.h.

Currently the API provides:
  • * neural networks objects (unused at the moment)
    * AI threads
    * giving orders to units
    * managing resources
    * scanning available units
the code handles all we need, but it still needs some cleaning, and parts of this code have to be put into functions that can be accessed from a shared library. I'll also make it more modular, so at the end, you'll have a set of pointers to functions that will do the jobs from a shared library. Of course we'll provide our own AI, but that's for later, when all this will be finished.
=>;-D Penguin Powered

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests