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

#121
so I'm experimenting with a little sound engine inside AGS and I'm not sure what I can do or not do.

- listing and iterating on the game's AudioClips? There's this but apparently it was never integrated in the main source branch? I think that's the most important thing.
On a side note, helios introduced a way to check which channel plays a given AudioClip, but Ithink it's kind of brokensince the same AudioClip can be played on several channels.
- listing and iterating on the game's AudioChannels? At least, knowing which are free or which are in use. (that's the least important of my requests though)
- listing and iterating on the game's AudioTypes? That I could do manually at game startup if I could iterate on the game's AudioClips. That would allow me to automaticlaly check that the right types have been set on the many, many sounds.
#122
Consider this simplified code :
(I'm not sure it's enought o reproduce my issue)
Code: ags

// let aClip1 and aClip2 be AudioClips
AudioChannel* a1a = aClip1.Play(1, eRepeat);
AudioChannel* a1b = aClip1.Play(1, eRepeat);

AudioChannel* a2a = aClip2.Play(1, eRepeat);
AudioChannel* a2b = aClip2.Play(1, eRepeat);


//Then in repeatedly_execute_always
bool a1aPlays1 = a1a.Playingclip == aClip1;
bool a1aPlays2 = a1a.Playingclip == aClip2;
bool a1bPlays1 = a1b.Playingclip == aClip1;
bool a1bPlays2 = a1b.Playingclip == aClip2;

bool a2aPlays1 = a2a.Playingclip == aClip1;
bool a2aPlays2 = a2a.Playingclip == aClip2;
bool a2bPlays1 = a2b.Playingclip == aClip1;
bool a2bPlays2 = a2b.Playingclip == aClip2;

Display("[%d, %d, %d, %d]", a1aPlays1, a1aPlays2, a1bPlays1,a1bPlays2 );
Display("[%d, %d, %d, %d]", a2aPlays1, a2aPlays2, a2bPlays1,a2bPlays2 );



Very naturally you'd expect the display to be :
[1,0,1,0]
[0,1,0,1]

...And yet in some cases I get :
[1,0,0,1]
[0,1,1,0]


In other words, half the AudioChannels appear to be magically playing the wrong clip. Not only that, but there's a pattern : the AucioClips seems to "swap" AudioChannels (aClip1 in the channel supposed to run aClip2, and vice versa).

I'm extremely confused but I've been searching for hours now and I can't explain the mystery.

I'm not claiming this is a bug, but maybe experienced people could give me a lead?

EDIT: OH, OH, WAIT. Is a Clip that's repeating itself getting a new AudioChannel each time it restarts???
#123
AGS 3.3.4

I've got this module that repeatedly loops a sound, starting from the middle of the sound :

Code: ags

AudioChannel* c;
void fooPlay(this AudioClip*)
{
  c = this.Play(1, eRepeat); //we play the sound on a first channel...
  if (c!=null) 
      c.Seek(c.LengthMs/2); //c.LengthMs is never 0; there's an actual sound

}


Then, in repeatedly_execute_always, I perform calculations based on the position.
Please note that I never change the position myself -- I never do .Seek apart from the first one, above. I use these calculations to adjust the volume.

Code: ags


function repeatedly_execute_always()
{
      //float pos = IntToFloat(c.PositionMs) / IntToFloat(c.LengthMs); //Just so you see what kind of calculations I'm doing
      
      if (c.PositionMs > c.LengthMs )
           Display("fPosMs=%f, fLenMs=%f", IntToFloat(c.PositionMs),  IntToFloat(c.LengthMs));
}


Surprisingly, I've come across situations where IntToFloat(c.LengthMs) = 13864.0, while IntToFloat(c.PositionMs) = 27597.0. This should be impossible.
It always happens at the precise moment when the sound reaches its very end (or its very beginning, since it's looping).
Even more surprisingly, this seems to happen randomly. It doesn't happen each time the sound loops; more like once every 4 or 5 loops.
This stinks like a bad float value rounding mishandling a 0.0 somewhere.

Because of the treatment I'm applying to the volume, this causes a sudden stutter. Could this be the cause of the famous "sound stuttering bug" in AGS?

Please note that I've performed a research on the forums to track this potential bug, but didn't find any reference to it.
If requested, I can provide the .MP3 file or full source code (I warn you, it's a massive beast -- But there's only one and only AudioChannel.Seek call in the whole code, I guarantee it).

#124
Critics' Lounge / character walkcycle
Sun 16/10/2016 00:46:40
The base sprite is this one :

[imgzoom]https://www.dropbox.com/s/m7o99ubmc3s6har/progzmax.png?raw=1[/imgzoom]

I  made this walkcycle, based on "the dig":
[imgzoom]https://www.dropbox.com/s/xt2c3kdh2d0plce/thedig_side_height54_slimtrousers_00.gif?raw=1[/imgzoom]

I think it's ... OK (well I hope), but I'm bothered by the fact that the head is very static. However that was already like that in The Dig and didn't look weird.

Source Photoshop file : https://www.dropbox.com/s/s33dyvj2y6ed24j/thedig_side_height54_slimtrousers.psd?dl=0
#125
I would like to share with you the quality of this EGA-style background.
Notice how they used the 16 colors to create :
- a brownish color scheme (the bear's fur)
- a cold light (blue tints -- that was the most used color scheme back then -- remember Melee Island in Monkey Island)
- a warm light (look at the f**ing corridor on the right!)
- a combination of warm and cold light (look at the reflections on the pilars/poles)

...and with all that, they managed to keep top-notch contrast and readability everywhere. And they didn't even overuse gradients.

Amazing.


Source : the book of unwritten tales 2
#126
I don't give a damn about the following game, I didn't even know that it existed.
But it's the first time ever that I see some people able to render the Day of the Tentacle style (bent, seemingly random, cartoony perspectives) in a photorealistic fashion. They're using CGI.

I find this interesting and thought I'd share. I still find it a bit shy though. There are still a lot of elements that are straight and make it look like they hesitate between cartoony style and just a fish-eye effect.

http://www.imaginarylab.it/willy-morgan/


#127
Silly question:
1) I make a game, with some dialogs.
2) I export all the text to a translation file and make someone translate it
3) I re-import the translated file into the game
4) the game moves on and there is new dialog which requires to export the dialogs again for translation.

How will this new dialog get included in the next iteration of the translation? Does AGS re-export a TRA file with all the prevously-translated sentences still included? (the empty lines are only below the non-translated sentences?)
#128
Hi, I'm looking for a module that allows the description of a hotspot to follow around the cursor...
We tried this http://www.adventuregamestudio.co.uk/forums/index.php?topic=26306.msg332567#msg332567
...But according to our scripter, the description pops out of the screen when the cursor moves too close to the edge. Is that right? Is there a better one?
#129
Imagine that you'd want to have the "director's commentary" in every room.
Imagine that you want to offer the opportunity to each team member to record their own comments.
Imagine that you're in charge of importing all the produced mp3 or ogg files into the game project.

...that will be a pain, for several reasons :
- you don't want to do much typing, you're thinking "bulk". So the files would be simply numbered and you don't want to give a variable name to each of them. Is it still possible in AGS to access external sound files through numbers, as before?
- If yes, can they be stored externally in subfolders?

More generally, what would be your most automated process for this?

Bonus question: What's the most convenient tool to record this? (do you know of a super secret niche utility that automatically numbers and saves the files, without requiring to do "new file" or "save file" each tim?). I'l sure there's got to be some obscure tool meant for personal assistants taking notes or whatever.


ACTUALLY: is there a plugin that would allow to do this directly from the beta game? Calin Leafshade, how hard would it be to use the Windows Microphone through the Lua plugin or even ... what was it called... the DLL/C# runtime compiler plugin(s)?





#130
Here's the scenario : we have a room that's used as some sort of mini-map (let's call it : "Map room"). It has a few places where the player can walk to. When he walks there, he's transported to the corresponding room of the location (let's call them : "Room1", "Room2", etc.).

On the mini-map, the interesting locations are indicated to the player using hotspots. When the mouse hovers over them, the player gets the description ("Room1", "Room2", etc.)

What we want is that BEFORE the player has visited any of these rooms, the description of the hotspot on the mini-map is "?". AFTER he's visited for the first time, it becomes "Room1", "Room2", etc.

Our problem is NOT to remember which rooms he has visited. We have nice little boolean flags for that. Easy peasy.

Our problem is that hotspot descriptions can't be changed. So how would you implement the description change?

#131
Critics' Lounge / Indy sprite
Sat 16/04/2016 15:54:54
Any paintover of this is welcome, provided it doesn't change the character's height (the eyes must not be moved up or down) or style (don't turn it into cartoony style).
I think it has reached the stage where written critics can only lead to misunderstandings. I strongly suggest you paint over the bits that you consider faulty.


[imgzoom]http://41.media.tumblr.com/c02b6d4f52b0d18ef7540f08c9627fe1/tumblr_o5qeejxQBE1tsfksfo1_75sq.png[/imgzoom]
3x
[imgzoom]http://40.media.tumblr.com/2155b1b3d124829741774a396d3e7e3c/tumblr_o5qeer02dV1tsfksfo1_100.png[/imgzoom]

VERSION 2
[imgzoom]http://41.media.tumblr.com/6a530df3ed8c9e7cfd24c0ded48749c1/tumblr_o5r2b5JGxH1tsfksfo1_75sq.png[/imgzoom]
3x
[imgzoom]http://40.media.tumblr.com/b5a110282b110b9aa35b818af0fcc9e3/tumblr_o5r2cbjqAH1tsfksfo1_100.png[/imgzoom]
Credits go to Amelie & ProgZmax for the original work base.
#132
Help me redact this cheat sheet.


AGS 3.4 PATCH2 (current released version)

Use caseC#AGS languageComments
Classclassstruct
(don't forget the semicolon at the end!)
Non-instantiable class
(for example, if you want to make a factory
or a set of static utility methods)
abstractbuiltin (that's a trick, that keyword was not originally intented for that)
static member in a classstaticuse a static attribute + a local variable in the script bodySee http://www.adventuregamestudio.co.uk/wiki/Keyword:_attribute
properties (getters and setters)use propertiesattribute+extenderSee http://www.adventuregamestudio.co.uk/wiki/Keyword:_attribute
yeah, yeah, I know that my description in the first column is a poor summary of what properties are.
Array propertiespropertySame as above, but use geti_ and seti_See http://www.adventuregamestudio.co.uk/wiki/Keyword:_attribute
ConstructorsnewYou can use this keyword only for arrays of primitive types (e.g. int[]), unmanaged structs (see below in the table), arrays of unmanaged structs (see below in the table), arrays of built-in types' pointers.
int i[] = new int[20];
DummyStruct1 d = new DummyStruct1; //provided DummyStruct1 was declared "unmanaged"
DummyStruct1 a[] = new DummyStruct1[1];
DynamicSprite* s[] = new dynamicSprite[1];


arrays as parameters : void MyFunc(int a[]) {...}by reference (changes propagate back)by referenceI didn't test what "returning" an array does, but it probably creates a copy
string as parameter : void MyFunc(String s) {...}by copyby copyyeah, yeah, I know that it isn't as simple as "by copy" for strings in C#.
dynamic arrays of custom class
(see also: "dynamic arrays of (built-in) pointers")
MyClass obj[] = new MyClass[20];not possible if 'unmanaged' struct
//this does not work:
struct DummyStruct1{
    int i;
};
...
DummyStruct1 a[];
a = new DummyStruct1[1];
DummyStruct1 d;
a[0] = d;

Possible if 'managed' struct
autoptr managed struct DummyStruct1{
    int i;
    import void Func();
};

void DummyStruct1::Func()
{
    Console.W("i=%d", this.i);
}
void Test3()
{
    DummyStruct1 a[];
    a = new DummyStruct1[1];
    DummyStruct1 d = new DummyStruct1;
    a[0] = d;
    a[0].Func();
}

...unless it contains a dynamic array
autoptr managed struct DummyStruct1{
    int i[]; //won't compile
    import void Func();
};
fixed-sized arrays of custom class
(see also: "dynamic arrays of built-in class")
MyClass obj[20];MyClass obj[20];
UNLESS : ... unless what, by the way? what forbids it?
a class member inside a classclass ClassA{
    int i;
}
class ClassB {
    ClassA a; //this (needs to call "new" later on)
}
not possible
(except as pointers to built-in types:
struct ClassB {
     DynamicSprite* sp;
     GUI* g;
     String s;
};
void game_start() {
  ClassB b;
  b.sp = DynamicSprite.Create(...)
  b.g = ...; //any existing GUI
  b.s = "mlkmlkmk";
}
fixed-sized arrays of built-in classMyClass obj[20]; //actually references
possible...
  s2 = new String[10];  s2[0] = "test";

  DynamicSprite* sp3[10];  sp3[0] = DynamicSprite.Create(10, 10);
...including in structs...
  struct MyClass {
    DynamicSprite* sp[3];
    String s[3];
  };
  MyClass t;
  t.s[0] = "test";
  t.sp[0] = DynamicSprite.Create(10, 10);
...and arrays of structs structs...
  MyClass t[10];
  t[0].s[0] = "test";
  t[0].sp[0] = DynamicSprite.Create(10, 10);
dynamic arrays of built-in classMyClass obj[] = new MyClass[20];
//This C# example actulaly
//shows references,
//but who cares

Instantiable built-in types:
  Possible...
  String s2[];  s2 = new String[10];
  ...including in structs
   struct MyClass {
    String s[];
   };
   MyClass o; o.s = newString[10];

Non-Instantiable built-in types:
   Possible...
   DynamicSprite* sp[];
   sp = new DynamicSprite[10];
   sp[0] = DynamicSprite.Create(10, 10);

   ...except in structs
   struct MyClass {
      DynamicSprite* sp[];
       //this will compile but
       //you can't instantiate
       //at runtime :'(
   };
   
#133
My habits in AGS programming are old, and my brain is still stuck with the features and keywords from 10 years ago. Help me transition to newer AGS programming features!

- what's the difference between protected, writeprotected, and readonly?
- what does "autoptr" mean? (please tell me even if it's not supported?) -- when I google "ags autoptr" I only get results from git, but Monkey uses it all the time.
- please direct me to the post about "managed struct" which I can't seem to find anymore? (EDIT: found this)
- what's the benefit of adding "attribute", inside a struct? (EDIT: OK so apparently this one is not new at all! I've found this.)



So I've found here that managed structs are very limited and cannot contain pointers or dynamic arrays,, and yet for years Monkey has been doing stuff like this :
Code: ags

autoptr managed struct StackData
{
    protected int _idata;
};

struct Stack
{
  protected StackData _items[];
};

void set_Capacity(this Stack*, int value)
{
  StackData items[] = new StackData[value];
  this._items = items;
}

//And then in the code:
...
Stack myStack;
myStack.set_Capacity(100);



What is this wizardry???

#134
So Mandle gently suggested this idea and I expanded the original concept :

Take any secondary character from a big franchise (In the point n click realm, it would be mostly: Lucasarts, or Sierra, but you can choose anything provided it "speaks" to other people. In the movies realm, it could be a Lucasfilm movie like Star Wars, etc.). Now, imagine what this character's very own personal space would look like: either their room, or their workplace, etc.
You can even skip the character entirely and focus on a secondary set that you think was not put forward enough in the original universe. BUT you must stick with the idea that this is some secondary set that does have something interesting to it, that people would like to know more about, and that reveals something from the original universe.

If you choose to go the "character" way, it could be that you draw the at-home room of a character from Indiana Jones... Imagine what the room the big hulky guy that fights Indy around the flying wing looked like...Or the creepy little Nazi with the round glasses... Or one of the worshipers of Kali... Or wherever Short-Round lived... Or how Nur Ab sal feels at home inside Sophia's necklace... Or how Alain Trottier has already all his kinky accessories ready in his room!




If you choose to go the "secondary set" way, it could be the Star Wars cantina seen from a different angle that reveals something about how Han shot first, or it could be what's going on down the moat of Prince Graham's castle, whatever. Just take an interesting approach!



=====================




The tall red fez of the guy in the picture above will explode on Sunday, Jan. 17th, hence marking the end of the competition (unless someone asks for an extension).

There are several voting categories!

Artistic execution : the drawings that make you envious of their artsy skills, or simply that you find so pretty!
Playability : how well would this background fit in a real-life adventure game? Many interesting clickable areas? Perspective? Clear exits? so on.
Most stimulating secondary set or character: the one that makes you say "Wow, I would have never thought of that set/character, but it's actually so cool!"
That funny detail: When the artist has put some emphasis on an object in the scene, or onto something specific that cracks you up!


==============

PS: before you ask -- I know it's very Indiana Jones-centered, but what can I say, it's my current obsession. But it's not a cheap trick to use it in our Indiana Jones game, as I probably won't enter the competition, or even if I do the background won't fit in our Indy game. So, feel free to draw anything you like, nothing is forced onto you! To you pencils/mouses/tablets! ;-D
#135
I'm making a series of tutorials for game makers.

It's not focused at all on the accuracy of technical terms, and it doesn't teach you how to draw with perspective.

What it does teach you is how to slowly start using the many tricks and cheats used in 2D adventure games that aim at keeping your scene realistic and fooling the eye while reducing the need of scaling the character up or down.

Here you go:

INTRODUCTION
Episode 1 - http://youtu.be/TTVdSCOQUq4
Episode 2 - http://youtu.be/cZiDE603xVU

REAL-LIFE EXAMPLES IN EXISTING GAMES
Episode 3 - http://www.youtube.com/watch?v=G82wW90u3sU
Episode 4 - http://youtu.be/uPkTdk7qrtI
Planned: more examples of cheating from gemini rue and from Fate of Atlantis. Planned: Some examples of "curved" perspective from Fate of Atlantis and from Seven Cities of Gold.
Episode 5, 6, 7...

ACTUAL SCENE CREATION FROM SCRATCH
Episodes 8, 9,10...
#136
Engine Development / interface_click
Mon 14/12/2015 18:09:57
So, at the moment:
- you can intercept a click in the room from somewhere else then the global script (add on_mouse_click in the Room script)
- you CANNOt intercept a click on a Gui or Gui button from somewhere else than the global script (except by umaking some tedious module that duplicates the coordinates and Z-order calculations)

That's really annoying. If you have many buttons in your gui, you have to create the even for ALL of them, and then add scripting in the global script for all of them.

Old function interface_click was allowing exactly that: intercept the click on a Button, but then process it wherever you like it (namely : a custom script).

How hard would it be to put it back?

#137
I'm currently working on a tool that requires me to draw very large straight lines onto a small drawing surface. For example, lines that go from coordinates (-5000,-5000) to (5000,5000), onto a 320x200 DrawingSurface. That allows me to draw a grid onto a canvas, as well as vanishing lines (they go very far on the sides of the image).

I've tested how long it takes to simply use DrawLine, and I came to the conculsion that it is very long, because there seems to be no clipping or coordinates checking built into AGS. All tests done in a 32-bits game with Direct3D9.

Here is the sample code:

Code: ags

    int limit = 500000;
    int i;
    bool hasAlpha = false;
    DynamicSprite* ds=DynamicSprite.Create(320, 200, hasAlpha);
    DrawingSurface* s = ds.GetDrawingSurface();
    
    //STEP 1 : takes 19s
    Display("Click when ready for step 1.");
    i=0;
    while (i<limit)
    {
       s.DrawLine(-3200,  -2000,  3200,  2000);
       i++;
    }
    
    //STEP 2 : takes 3s
    Display("Click when ready for step 2.");
    i=0;
    while (i<limit)
    {
       s.DrawLine(0,  0,  320,  200);
       i++;
    }

    //STEP 3 : takes 10s
    Display("Click when ready for step 3.");
    i=0;
    while (i<limit)
    {
       s.DrawLine2( -3200,  -2000,  3200,  2000,  COLOR_LIGHTGRAY);
       i++;
    }
    
    //FINISH
    Display("All over.");
    s.Release();
    ds.Delete();


As you can see, step 1 (with the big coordinates) takes 19s versus 3s with "clipped" coordinates. That's 6 times longer.
Now you'll see that I can reduce it to 10s (so about 50% performance gain) by using my very own clipping function, a.k.a. DrawLine2, relying on some C implementation that I've found on the web :

Spoiler

Code: ags



 
// "Cohen Sutherland" line clipping. 
//  It draws only the part of the line that is within the viewport.
//
// Originally found at http://electrofriends.com/source-codes/software-programs/c/graphics/c-program-to-implement-the-cohen-sutherland-line-clipping-algorithm/
// credits ???

enum outcode {
  TOP = 1, 
  BOTTOM=2, 
  RIGHT=4, 
  LEFT=8
};

int compute_outcode(float x, float y, 		float xmin, float ymin, float xmax, float ymax)
{
  int oc = 0;

  if (y > ymax)
    oc = oc | TOP;
  else if (y < ymin)
    oc = oc | BOTTOM;


  if (x > xmax)
    oc = oc | RIGHT;
  else if (x < xmin)
    oc = oc | LEFT;

  return oc;
}

void DrawLine2(this DrawingSurface*,  int xx1,  int yy1, int xx2,  int yy2,  int color)
{
  
    int c = this.DrawingColor;
    this.DrawingColor = color;
  
    float xmin = 0.0;  float ymin = 0.0; float xmax = IntToFloat(this.Width); float ymax = IntToFloat(this.Height); 
    float x1 = IntToFloat(xx1); float x2 = IntToFloat(xx2); float y1 = IntToFloat(yy1); float y2 = IntToFloat(yy2);
    
    bool accept = false;
    bool done = false;

    int outcode1 = compute_outcode (x1, y1, xmin, ymin, xmax, ymax);
    int outcode2 = compute_outcode (x2, y2, xmin, ymin, xmax, ymax);
    while (!done)
    {
      
        if (outcode1 == 0 && outcode2 == 0)
        {
            accept = true;
            done = true;
        }
        else if (outcode1 & outcode2)
        {
            done = true;
        }
        else
        {
            float x, y;
            int outcode_ex;
            if (outcode1!= 0) outcode_ex = outcode1; else outcode_ex = outcode2;
            
            if (outcode_ex & TOP)
            {
              x = x1 + (x2 - x1) * (ymax - y1) / (y2 - y1);
              y = ymax;
            }
       
            else if (outcode_ex & BOTTOM)
            {
              x = x1 + (x2 - x1) * (ymin - y1) / (y2 - y1);
              y = ymin;
            }
            else if (outcode_ex & RIGHT)
            {
              y = y1 + (y2 - y1) * (xmax - x1) / (x2 - x1);
              x = xmax;
            }
            else
            {
              y = y1 + (y2 - y1) * (xmin - x1) / (x2 - x1);
              x = xmin;
            }
            if (outcode_ex == outcode1)
            {
              x1 = x;
              y1 = y;
              outcode1 = compute_outcode (x1, y1, xmin, ymin, xmax, ymax);
            }
            else
            {
              x2 = x;
              y2 = y;
              outcode2 = compute_outcode (x2, y2, xmin, ymin, xmax, ymax);
            }
        }
    }
 
    if (accept)
      this.DrawLine(FloatToInt(x1), FloatToInt(y1), FloatToInt(x2), FloatToInt(y2));

}


[close]

Now I can't think of any possible scenario where that would be useful to ANYBODY (or maybe crazy people like Radiant, who make vector-based games ;) ) but I thought I'd share.
If some day the C++ team felt like implementing the boundaries check, then it's all ready to use, out of the box.

EDIT: I've gained less than 1 second by putting the code of "compute_outcome" inline (directly where it's called), so the benefit is insignificant.
#138
Hi,

I know it has been explained numerious times, but I can't seem to find the information.
Suppose I have many sprites that would take very little space if they were RLE-compressed.
What would be the best way to reduce my game size? Does it work if I import .PNG files for sprites, or are they immediately converted to whatever format by AGS?
#139
So I've read HERE that when you do a "quick import sprites", it re-uses the setting you used the last time you did a regular sprite import.

So I did this:
- first I imported a sprite the regular way, and left transparency "as-is". This sprite is a bmp file (no alpha) in a 32-bits game, and has pink (transparent) parts.
- I ran the game to check that once used as an object's graphic, the transparent part was, well... transparent, as expected.
- I imported a second sprite using "quick import", added that sprite into a view after the first sprite, and did a "SetView" and "Animate" on the in-game object.
- The first sprite still has transparent parts, but the second sprite's pink parts appear pink on screen instead of transparent.

So, how to I import a whole bunch of sprites with the same transparency settings?

:'(

#140
Can someone explain why the palette cycling does not happen in the background image? I suspect it has something to do with "game palette"/"background palette" because the shifting does happen on the character and GUI.

My mock-up game >>HERE<<

Note: the shifting is done in the room's RepExec script.
SMF spam blocked by CleanTalk