Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Monsieur OUXX

#361
General Discussion / Ashen ?!?
Mon 06/08/2007 16:31:40
Was reading quotes from bash.org, and i found this :

http://bash.org/?6490


Ashen?!?
#362
Hello,

I'm feeling REALLY stupid about this... I've been looking for more than 20 minutes in the forum but i can't find the answer to my really really really stupid question. the answer is probably obvious but I don't know what keyword I could use for a successfull search.

I just can't remember how to test if the player has an object in his inventory or not...
#363
After "Chris Jones" as "the creator of AGS" and "Chris Jones" as "the actor playing the game character Tex Murphy", i found another Chris Jones, leader of a 3D game engine project : http://www.opengameengine.org/  ...

Is there a kind of immaterial omniscient entity named "Chris Jones", obsessed by video games, materializing into mortal bodies whenever it wants?
#364
Hi, I'd like to do something to make my modules more intuitive for the end-user, but I'm not sure how I should do.

It's a question concerning the declaration of static functions within a struct; i'd like my struct to be visible from the outside of the module (=> declared in the header), with some static functions accessible from the outside, and some other not accessible (so that the user knows what functions he may use, and what functions he may not use). This also means that these functions stay accessible from the module, even outside this struct!

In fact, what i'd like to do is nothing more than public and protected static functions, provided that protected functions can still be used inside the whole package (for example in Java), though not visible by the end-user. Here, the package would be the module.

This is what i'd like to have : (pseudo-AGS code)

HEADER
Code: ags

struct MyPublicStruct {
    import public static void MyPublicStaticFunction();
    import protected static void MyPrivateStaticFunction();
};

struct MyPublicStruct2 {
    import public static void MyPublicStaticFunction2();
};


BODY
Code: ags

static void MyPublicStruct ::MyPublicStaticFunction() {
    ...
}

static void MyPublicStruct ::MyPrivateStaticFunction() {
    ...
}



static void MyPublicStruct2::MyPublicStaticFunction2() {
    MyPublicStruct.MyPublicStaticFunction();
    MyPublicStruct.MyPrivateStaticFunction();
}




How should I do?

#365
I found out recently that there was an unofficial AGS French website with a forum. It seems to be admin'ed by Marion (a user on this forum - she is called Shai-La on the French forum). Marion is very active; you probably tried her last game "Pirates of Monkey Island of the Carribean", which was quite funny, though missing some finishing.

The address is : http://adventuregamestudio.fr-bb.com/


[EDIT]Looks like she already posted a message concerning the forum, but that it wasn't added to the official website. Sorry for the inconvenience[/EDIT]
#366
The following code gives a wrong result :
[EDIT]According to Ashen, this specific code works, but my code (more complicated) doesn't[/EDIT]
Code: ags

#define MACRO1  1
#define MACRO2  -1000

...
int tab[10];
int i=1005;

int x = tab[i+MACRO1 MACRO2];


i+MACRO1 MACRO2 should be evaluated as "i+1 -1000", so it should be equal to 1005+1-1000 = 6.
Instead, it seems to be evaluated as "i+1+1000" and it is equal to 1005+1+1000 = 2006

Or maybe I made a mistake? Maybe "-" is forbidden in macros? But then how does it come that "i+MACRO1 MACRO2" still manages to be evaluated (since it would then give "1005+1   1000")?


I'd be tempted to say that this bug is similar to the one preventing functions to be evaluated when used as the index of an array.  ( example : tab[MyFunction()];
#367
Is retro-compatibility of custom-script really useful? Do people creating a new game choose to make it with an old AGS on purpose, or am I missing something like "DOS users can only use AGS versions older than x.y" ?
#368
Hi, i don't understand how "float" optional parameters work...

here is my code :

Code: ags

#define FLOAT_PARAM     -1000.0

struct MyStruct {
    import static void MyFunction(float aNormalParam, float anOptionalParam = FLOAT_PARAM);
};


With this code, i get the error "Parameter default value must be a literal" at compile time.

If i replace "-1000.0" by "-1000", then i get the error "cannot convert from int to float" when i call the function.

Code: ags

#define FLOAT_PARAM     -1000

...
MyStruct.MyFunction(0.0, FLOAT_PARAM); //this raises an error
...

#369
The following code doesn't compile :

Code: ags

#define INT_MIN  -2147483647

struct MyStruct {
  	import static void MyFunc   (int value = INT_MIN);
};


the value of -2,147,483,647 comes from the manual
I always get the error : "default parameter out of range".

It appears the the minimum value for an optional parameter is -31999 ...  ???
#370
Hello, I'd like to ask CJ if script variables types int, char, float, etc  really have the size they're supposed to have (int = 32 bits, char = 1 byte, float = 32 bits), or if their size is homogenized by the engine, finally making them all 32 bits in memory.

(just like the Java virtual machine does : when you use a 'char', it gets converted to 'int' with bounds-checking, making it even slower than with a real int...)
#371
Module : Dynamic arrays
Author : Monsieur OUXX
AGS version : 2.72 (but should be compatible with following versions!)


IMPORTANT NOTE: What Vector Class do you need?
- if you use AGS 3.0, you don't need any. It's built-in! (unless you want to be able to "point" at your arrays, then use this one)
- if you use a version previous to AGS 3.0 and need some easy-to-use and error-proof dynamic arrays with real unlimited size, use Monkey_05_06&HeirOfNorton's Vector classes.
- if you use AGS 2.72 or 3.0 or upper, are familiarized with pointers, and need some really fast (allocation and memory read/write) dynamic arrays, use this one. The maximum total size of the data you will be able to store is around 5Mb

Download   http://ottl.free.fr/ouxx/agsh/DynamicArrays.zip

Abstract

This script module implements a way to dynamically allocate some arrays within a big static array called “the memory”. It also provides functions to handle these so-called "dynamic arrays" (getSize, etc.) When an array is no longer needed, one can "free" it by calling FreeArray

Allocation and disallocation are quite fast ( in O(log2) ), and memory read/write is as fast as possible ( in O(1) with no function call needed)

Why are dynamic arrays so usefull?

Sometimes, it is useful to be able to refer to a variable not by its name but by a numeral value (its address / its pointer).



Once you have created a dynamic array, use its pointer :

·        You can pass it to a function as a parameter

·        Don't bother about where you create your arrays, or if there is still room in each array or in the virtual memory: when there's no room left, the engine tells you. Then you just have to increase the size of your virtual memory for your game to be stable.

·        You can create arrays of arrays (therefore multidimensional arrays)

·        You can use it to implement arrays of Vectors, Hashmap, Trees, etc. These could also be passed to functions as parameters (which can't be done with a normal “struct”)


How to use dynamic arrays

Code: ags

 //allocate the array
 ADDR myArray = AGSH_DynArrays.AllocArray(100); //arbitrary size

 //example of use : fill in the array with an arbitrary value
 int i=0;
 while (i < AGSH_DynArrays.GetArraySize(myArray) {
     memory[myArray+i] = 66;
     i++;
 } 

 //show what's inside the array
 AGSH_DynArrays.DisplayMemoryRaw(myArray, AGSH_DynArrays.GetArraySize(myArray));

 //free the array
 AGSH_DynArrays.FreeArray(myArray);
#372
this problem is solved

Hello, I know it's not nice to bother other people about his very own algorithm, but the problem I have looks very simple (and it is probably very simple) - But, you know, sometimes you have been trying to find the error for so long that you don't see a very obvious error anymore.

Here is the function :

Code: ags

static ADDR AGSH_Allocator::searchContiguousBlock(ADDR node,  ADDR contiguousToBlock) {
  
    ADDR return_node = node;
  
    AGSH_Console.DebugMsg(String.Format("searchContiguousBlock (%d, %d)", node, contiguousToBlock));
	
    if (contiguousToBlock < 0) {
      AGSH_Console.DebugMsg(String.Format("Cannot search block contiguous to an invalid node (@%d)", contiguousToBlock));
      return INVALID_ADDR;
    }
	
    if (node == INVALID_ADDR) {
      //node = INVALID_ADDR;
      //do nothing; return INVALID_ADDR
      AGSH_Console.DebugMsg("null"); //DEBUG
    } else {
	  
      int whatSide = AGSH_Allocator.compareNodes(contiguousToBlock, node);

      if (whatSide == CMP_INTERSECT) {
        AGSH_Console.DebugMsg("CMP_INTERSECT"); //DEBUG
        //we are probably in the case where contiguousToblock == node; search 'node's sons
        return_node = AGSH_Allocator.searchContiguousBlock(AGSH_FreeNodesLifo.GetLeftSon(node),  contiguousToBlock);
        if (return_node == INVALID_ADDR)
          return_node = AGSH_Allocator.searchContiguousBlock(AGSH_FreeNodesLifo.GetRightSon(node),  contiguousToBlock);
      } else if (whatSide == CMP_LEFT) {
        AGSH_Console.DebugMsg("CMP_LEFT"); //DEBUG
        return_node = AGSH_Allocator.searchContiguousBlock(AGSH_FreeNodesLifo.GetLeftSon(node), contiguousToBlock);
      } else if (whatSide == CMP_RIGHT) {
        AGSH_Console.DebugMsg("CMP_RIGHT"); //DEBUG
        return_node = AGSH_Allocator.searchContiguousBlock(AGSH_FreeNodesLifo.GetRightSon(node), contiguousToBlock);
      } else if (whatSide == CMP_LEFT_CONTIGUOUS_RIGHT || whatSide == CMP_RIGHT_CONTIGUOUS_LEFT) {    
        //block 'contiguousToBlock' is contiguous to 'node'
        AGSH_Console.DebugMsg("CMP_LEFT_CONTIGUOUS_RIGHT || whatSide == CMP_RIGHT_CONTIGUOUS_LEFT"); //DEBUG
        //do nothing; we return 'node'
      } else {
        AGSH_Console.Error(String.Format("AGSH_Allocator::searchContiguousBlock : Forbidden value : whatSide=%d", whatSide));
      }
    }

    AGSH_Console.DebugMsg(String.Format("Return : %d", node));
	
    return return_node;
  
  }
}



and here is the output :

Code: ags

searchContiguousBlock (688, 688)
CMP_INTERSECT
searchContiguousBlock (-1, 688)
null
Return : -1
searchContiguousBlock (-1, 688)
null
Return : -1
Return : 688


As you can see, the execution enters the "CMP_INTERSECT" condition and tries searchContiguousBlock on leftSon and rightSon. Both return INVALID_ADDR (-1); But, strangely, the final return is 688 instead of -1...

Why so???





Note : i noticed that when i don't use a temporary variable (result_node) to modify the return value directly from a parameter (node), it causes bugs (the function returns random values). That means that if 'node' is a parameter, and if i write "node = ...;" and then "return node;", then the return value will be incorrect.
This has nothing to do with my problem explained above, and someone else probably noticed it before me, but it's quite confusing.
#373
General Discussion / AGS not in Google anymore
Tue 03/07/2007 07:45:08
I used to visit the AGS website by typing "ags" in google.
Since 3 days, Google seems to have changed it's ranking system, and AGS doesn't appear in any of the 5 first answer pages. I have to type in "ags games" or "ags studio", etc.

I'll write a letter to Mr. Google to complain.  :)
#374
Quote from: Pumaman on Mon 06/06/2005 18:50:56
There is no fixed limit on the size of global arrays, but as scotch says they use up memory

I noticed that global arrays (declared in the body of a module) increase the size of the compiled game on the hard drive.
=> An array of 100,000,000 ints will cause the game to use 100,000,000*32 bits = 400 MB on the HD...

I can't understand why "volatile" variables (like arrays) should be stored on the hard drive, not just created in the RAM when the game starts???
#375
I'm trying do find the best possible dynamic structure among all possible dynamic structures in AGS script.

For example, a String is a dynamic structure : you can resize it in memory with an "Append" operation. Heir of Norton understood that and exploited this workaround to use Strings as dynamic arrays in his "Vector" module.

But, what other dynamic structures are available?

I've thought of dynamic sprites, but i don't know if there is a per-pixel access, and if so, i don't know if it's awfully slow or not.

I've also thought of declaring a basic array (myArray[1000000000000000];  ;) ), and use it as if it was the RAM. Then i'd write some allocation routines (malloc, delete...).

Another solution : GUI objects such as ListBox; one can add up to 200 rows to a ListBox, AND, most important, pointers to ListBoxes are available. But there may be a limit to the number of declared ListBoxes...




PS : (about arrays) : read this thread
#376
Why can't I start a new topic in the "modules/plugins/etc." forum???

The option is available in any other forum, but bot in this one.

The answer must be written somewhere, but not in the sticky threads of this forum.
#377
Is it possible to write MACROS with parameters in the AGS script?

For example, one can do this in C :
Code: ags

#define MYMACRO(param) printf("this is the parameter of my macro : %d", (param) );



Then, everytime i write "MYMACRO(12)", this will have the same effect as if i was writing "printf("...", 12)";

This would be of great help for my AGSH module (syntax would be much lighter), but if it's not available, i'll find anoterh way  ;D
#378
Hi,

I'm at debugging phase for my script, and when i launch ("Test") the game, it instantly freezes into a black screen (this is normal because the bug in my script is probably in the initialization code - it's executed at startup)

My question is : what could cause a black screen?
- does AGS detect an infinite loop after a few seconds? (it would mean it's something else)
- is the screen black because AGS couldn't display anything yet, before freezing ?
- are there some special cases where AGS simply crashes (without exiting) instead of giving a reason such as 'index out of bounds in an array', etc.
#379
I'm not sure it is a bug or not, or if it has already been discorvered by someone else :

I have a code looking like this :

Code: ags


// MODULE 1 HEADER ///////////
struct A {
    import int MyFunction();
    import static int MyStaticFunction();
}

A MyA;

// MODULE 1 BODY///////////
int A::MyFunction() {
    return 0;
}

static int A::MyStaticFunction() {
    return 0;
}


// MODULE 2 HEADER //////////

struct B {
    import int MyOtherFunction();
}

// MODULE 2 BODY ////////////////

int MyArray[10];

int B::MyOtherFunction() {


    return MyArray[MyA.MyFunction()]; // CODE 1 : compiles fine



    int i = A.MyStaticFunction(); // CODE 2
    return MyArray[i];           // CODE 2 : compiles fine



    return MyArray[A.MyStaticFunction()]; // CODE 3 : doesn't compile (unknown symbol/parse error after '[')
}    


What do you think ?

#380
I'd like to use GUI0 for my own purpose but I'm not sure it hasn't any special built-in particularities that I don't know of.

I've been looking in the manual, and also on the forum (keyword : GUI0), but haven't found anything relevant.

Do you know anything about it ?
SMF spam blocked by CleanTalk