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

#1
I fail to find the absolute simplest way of using method System.Log.
From what I understand (here : https://adventuregamestudio.github.io/ags-manual/EngineConfigFile.html   and here: https://adventuregamestudio.github.io/ags-manual/RuntimeEngine.html#command-line ) one has to add a command line switch.

Is there a way of simply enabling the logging from running the game in Debug, from the Editor?

I tried adding this to acsetup.cfg in the _Debug folder :

Code: ags
[log]
file=all:all
file-path=C:\Users\admin\repos\ags-essential-modules\AGS 4 essential modules\_Debug\log.txt

Unfortunately the file gets reset every time I run the game.

I tried with acsetup.cfg from folder \Compiled\Windows and \Compiled\Data,. those don't get overwritten but do nothing.

#2
AGS 4

- The last parameter of DynamicSprite.Create used to be hasAlphaChannel. Now, it's an int named "format".
- Object DialogOptionsRenderingInfo used to have a property HasAlphaChannel which it no longer has.

The help file of AGS 4 has not been updated yet and I don't know where to look in the forums in order to find out where exactly those changes were introduced (and explained).

A little help?
#3
Download AGS 4 alpha 11 (from the "AGS Releases" subforum) and try to run the Sierra template.
You'll get error message  ".on" is not a public member of "Character"

My question : I've never used that property, I didn't even know it existed.
- Has it been deprecated or did @eri0o simply forget to declare it in AGS 4 ?
- What is a workaround to that? Character has no "Visible" or "Enabled" properties.
 
EDIT: Enabled and Visible have been added, they just don't exist in the Help file. Problem solved!
#4
As AGS 4 cuts ties with old AGS features, should we get rid of the "old" on_key_press, and while doing it remove the old eKeyCtrlA, eKeyCtrlB, etc. ?

old way:
Code: ags
// Check that only Ctrl is pressed
void repeatedly_execute()
{
    if (IsKeyPressed(eKeyCtrlLeft)) { ... }
}

// Check that ctrl+A is pressed
void on_key_press(eKeycode keyCode) {
  if (keyCode == eKeyCtrlA) { ... }
}

New way

Code: ags
// Check that only Ctrl is pressed :
void on_key_press(eKeycode keyCode, optional int mod) {
  if (mod & eKeyModCtrl) { ... }
}

// Check that ctrl+A is pressed
void on_key_press(eKeycode keyCode, optional int mod) {
  if (keycode == eKeyA && (mod & eKeyModCtrl)) { ... }
}

See the help article of on_key_press for more details.

I'm adding a question mark because maybe those would still be useful do scripters who still brute-force key reading in their main loop?

Code: ags
void repeatedly_execute()
{
    if (IsKeyPressed(eKeyLeftCtrl)) { ... } // make the spaceship go pew pew
}

EDIT : yeah that last use case is definitely still valid for keeping eKeyLeftCtrl... Once again, writing a forum post made me walk myself through the process :-P

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

On a side note, I think the article could provide better examples :
Code: ags
//This checks if Ctrl was pressed : 
if (mod & eKeyModCtrl)

It could do with an example showing Ctrl+A instead of just Ctrl. I'm guessing most scripters are after that.
It could also do with an example of Ctrl+Alt+A as it is where the modifiers and the binary logic will shine
#5
Hello,

I haven't visited the forums in a million years and I have a lot of catching up to do.
I've been looking at AGS 4 (which is amazing btw, it resolves 99.9% of my grudges with the AGS scripting language -- remove the "export" keyword and headerfiles, and we'll be at 101% :-D ).
- I've downloaded the early version and I saw that all the standard templates are here (BASS, Sierra, etc.).
- I've also read that AGS 4 breaks compatibility with AGS 3.x.

Which brings me to my question : Have the scripts of the templates been updated?

For example in the Sierra template I see the KeyboardMovement 1.04 module. Is that module written in AGS 4 fashion or is it still AGS 2.x or 3.x script that just happens to work in AGS 4?
(Note: I've been trying to search the forums myself but the search feature is extraordinarily slow today... I had only one search out of 7 attempts coming to completion. Therefore I'm blind)

I'm asking because I remember that some 3.x template scripts had to do some backflips to work around the limitations of "struct", keeping track of indices -- instead of just putting structs inside structs (was it Tumbleweed? Can't remember. I think tween does that too).

So anyways no that it is the summer holiday I could put a bit of effort into dusting off the most important scripts. If you have suggestions feel free to let me know.
#6
Hints & Tips / Adventures of the black hawk
Thu 15/02/2024 18:05:38
I'm stuck when
Spoiler
Saint Cove needs to find some food to give to Olivier's dog
[close]

I don't know what to do because
Spoiler
there's food laying around literally EVERYWHERE in the game, there's even a dining room and so on, but Saint Cove adamantly refuses to pick up any of it, in pure point-n-click fashion.
[close]

I think that the solution might be that
Spoiler
I'd need to enter the tavern's kitchen, and to do so I need to distract the owner by recovering the grog's recipe. He mentioned that a woman stole it but I can't remember any other clue about it or where to go to find that woman, and unfortunately the dialogs can't be repeated.
[close]
#7
Godot drives me insane.

I can see that it has all the capabilities to achieve amazing things.
The issue is... No one has the knowledge.


Allow me to rephrase that : There are a TON of people who have Godot knowledge. The issue is... Unless you know someone who's willing to be fully involved in your project then it seems impossible to receive consistent and proper help with Godot.

There used to be some sort of Godot forum, similar to the AGS one, which has now shut down (every time you click on a google result you get a 404). Not a good move, I would say!

Then there's Discord. Have you ever visited the Godot Discord? Let me tell you, it's nothing like AGS. There's a gazillion posts per minute. And since it's a continuous flow of chat messages, there's zero consistency. Messages about several topics are mixed together, and you never know what will be the quality of answers. It's like a Russian roulette. The people helping have either no time to try to understand what you're doing, or give crude answers without explaining why the solution is the solution. When the answer is not plain wrong!

I remembered fondly my early days in the AGS forums, when there were people like Ashen, monkey0506, Khris etc. who knew what the hell they were talking about. The information was clear, correct, and there was room for follow-up questions.

Yesterday I tried asking ChatGPT about Godot. The quality of the answer was amazing.... I had a brief moment of euphoria, thinking I had finally found my solution... Until I realized it was ChatGPT3 and its knowledge stops in 2021. It was giving answers incompatible with Godot 4.1.1 (deprecated classes)! And of course, the Godot help page doesn't clearly state that the lass is deprecated (well, it does, but... at the end of the page!)

I'm literally banging my head against the walls. AGS is awesome. Godot is even more awesome (because it's a heavyweight) but all that awesomeness goes to shit instantly, every time.


I was tempted by an upgrade from AGS to Godot. But now I'm seriously considering reverting my experimentations and throwing away those last 2 years of experiments with Godot.
#8
Trying to build the unit tests (Common.Lib.Test and Engine.app.Test, in solution Tests) of branch ags4
On windows 10 with Visual Studio 2022

Is there a help page? (I don't think so).
I think I need third-party libraries Allegro (4?)  and gtest. Anything else?


PS: Please tell me I can use a prebuilt version of Allegro and that I won't have to rebuild it myself.
#9
I see in main.cpp that there's this main_process_cmdline function to parse command line arguments.
But I also see in cmdlineopts.cpp that the same code has been rewritten in modern c++.

Is the new code supposed to be part of AGS4, and, if yes, what do I need to toggle to enable the new code? Nothing seems to be using CmdLineOpts::Parse.


My bad. It's used by the new compiler. The Engine's startup simply hasn't been updated to use this too.





#10
I'm currently in a professional environment.
the acwin.exe from AGS AGS-3.5.1.19-P12 triggered the following false positive : https://www.f-secure.com/v-descs/w32_malware.shtml

I've submitted the file to FSecure (by using their dedicated form)  in the hope that their automated heuristics will learn not to flag AGS.

I'm not looking for solutions, just sharing knowledge.
#11
EDIT - useless first post
#12
I'm looking at the engine source code.
In this file ( cc_instance.cpp ), I see that the engine looks at the "actions" that have been queued, and then pops them in order to execute them (by calling the c++ function that has a matching prototype).

A function "matches" if :
- It has the same mangled name
- It has the same number of parameters.

To check that it has a known mangled name, it iterates over every known function name, and does a strncmp each time
Code: ags

if (strncmp(thisExportName, mangledName, mangled_len) == 0) { ... // line 352


Is that still a thing?
If yes, that would be a spot for extraordinarily beneficial somewhat beneficial optimization. EDIT: I realize that checking on the string's length first probably removes a lot of work from the comparison. But still, just a few function overloads can add quite many loops! E.g. comparison of mangled names "Button::Animate^4" with "Button::Animate^7"
Or maybe I misunderstood the purpose of this function and it's not meant for executing one instruction but instead for linking modules (and their symbols) together, only once? Or maybe this applies only in Debug mode, and the Release code gets rid of mangled names entirely?



#13
Is there still a technical reason for the "int" value of a color to be awkward?

By awkward I mean two things :
1) The fact that R, G and B values work by increments and maintain backwards compatibility for palettes, which doesn't let us use all the values for B (see help article for DrawingSurface.GetPixel). Blessed be the innocent soul who does SetPixel 0-31.
2) the fact that int colors go roughly from 0 to 65535, which means 16 bits

Maybe there's a smart way of making those values 32 bits and getting rid of a lot of crap?
#14
I remember CW saying that one of the obstacles of easily "managing" managed objects inside the AGS virtual machine is that they share the same address space as basic pointers. I don't remember exactly which kind of difficulties it was causing but I clearly remember that it was creating a technical glass ceiling -- because in the end everything is a pointer. So this limitation was indirectly impeding some glorious steps towards engine modernity and dynamic objects. 

This message is not to ask "what is the problem exactly" but to suggest a solution. Maybe what I'm about to write is dumb and has nothing to do with the issue, but here goes nothing. I've done that successfully in some pseudo-VM I was writing in AGS :

Split the pointers address range in two. I mean, a pair of completely artificial "fake" addresses ranges. For example :
0x0000 --> 0xFFFF = old-style pointers, nothing changed.
0x10000 --> 0x1FFFF = managed objects. You generate those exactly like you used to (values from 0x0000 to 0xFFFF), but you immediately add 0x10000 for as long as they're passed around as value from C++ function to C++ function-

With a simple binary mask you can tell which value represents which type. <= 0xFFFF = regular pointer. >=0x10000 = managed pointer.
Whenever you need to actually read/write to memory, just remove the bogus offset : For example, convert managed pointer 0x100AA to 00AA, then do whatever you would normally do (pointers arithmetic, real address in memory, etc.)

Food for thought.


#15
Context:
AGS has no problem working with high-resolution games : With hardware acceleration it can display lots of sprites and tint them, etc. The engine is also performant enough for scripting effects when you stick to built-in operations (native sprite scaling, native transparency, etc.).

But AGS becomes slower when you want to make the AGS script handle more intensive algorithms, such as iterating on large arrays of hundreds of thousands of items, or trying to perform per-pixel operations on larger sprites, or when your function calls stack exceeds a certain depth.

This is why when it comes to scripting, especially special effects, AGS is better suited for low-resolution games : 320x200 or 640x480. And that's also why advanced shaders written with the AGS scripting language are out of the question.


I sometimes ask myself why that is. What are the reasons why the AGS scripting language is not lightning fast?

Having very little knowledge of the engine's code, I can't seem to come up with a reason :
- It uses SDL, which is very close to the hardware. If not the fastest possible option, it's pretty close.
- It's written in C/C++
- The virtual machine is running pre-compiled code, literally just byte code.

So, what is slow in all this?
Is it that the VM's instructions are not mapped directly to the underlying CPU instructions? Is it that the engine uses simple data structures with a lot of overhead and lookups? Etc.

#16
I want to add a new sort of "Component" in the AGS project tree.

- I duplicated "ScriptsComponent" and named it "FooComponent".
- I replaced the word Script/script/Scripts everywhere relevant.
- I did "AddComponent" in ApplicationController.cs
- Finally, I duplicated "scripts.ico" and "script.ico" in the Resources folder and named the new files "foos.ico" and "foo.ico".
- I added those files to the Resources folder in the project ("Add existing item").

Everything compiles, but when the Editor starts, ResourceManager.GetIcon crashes. It says that "System.ArgumentException: 'Resource 'foo.ico' cannot be found in class 'AGS.Editor.Resources.ResourceManager'.'
.


Again, I did everything like ScriptsComponent does it, except with "Foo" in place of "Script".

So, my question : Do new resources (icons) need to be added explicitly to some sort of Resources manifest file or some list that I failed to locate?
Why are the new icons not found? Not found in what? (in the file system? In some list?)

#17
Hello,
I don't have a specific situation on mind, I'm asking about general best practice.

Let's say you have this :
Code: ags

    File* f = File.Open("file.txt", eFileRead);
    while (!f.EOF) {
      String s = f.ReadRawLineBack();
      //EVENT HAPPENS HERE
    }
    f.Close();



Notice the line "EVENT HAPPENS HERE". I'm talking about random events that almost never happen but could happen.

Two scenarios :
a) On that line, this game gets saved (e.g. through "SaveGameSlot" in another script) and then instantly quits (the player closed the game in Windows).
b) On that line, another game gets restored (e.g. through "RestoreGameSlot" in another script). As a mental exercise we imagine that we restore a previous occurrence of scenario "a".

Question:
If "a" just happened, then do I just have to accept that the file is not entirely loaded into the game's VM, and deal with it next time it gets loaded?

If "b" just happened, then
1) Is f in an undefined state? I guess I can't just continue reading from it.
2) What should I do? Just scrap it and have a mechanism to restart reading the file from the top?

#18
Editor Development / [AGS4] Syntax overhaul
Mon 06/09/2021 17:39:39
Fact : AGS script is VERY inspired by C. It's the archaic side to AGS.

Don't get me wrong. C is a fine language, and it works.

But nowadays, who declares a class as "struct"? Who uses so-called "pointers" in a high-level scripting language?
The only reason why AGS still offers both managed and unmanaged is because until the latest versions dynamic structures were not fully implemented. And this is on the verge of being fixed.

Here is my suggestion :
Quote
1. Accept to break (a tiny bit of) script retro-compatibility upgrading when from AGS 3 to AGS4.
2. Replace keyword "struct" with "class"
3. Make *all* structs managed.
4. Get rid of the "asterisk" ( * ) when dealing with managed objects.
This would effectively make AGS move to the age of References rather than pointers.

So INSTEAD of this :
Code: ags

managed struct A {
  int i;
};

function Foo(A* a) 
{
   a.i = 777;
}

void game_start()
{
   A* a = new A;
   Foo(a);
}


...the new syntax would be this. And would look like most mainstream languages.
Code: ags

class A {
  int i;
};

function Foo(A a) 
{
   a.i = 777;
}

void game_start()
{
   A a = new A;
   Foo(a);
}



The beauty of this is that almost everything is already there. It's only a matter of substituting some syntactic elements with other syntactic elements;
#19
Advanced Technical Forum / Polymorphism
Mon 06/09/2021 16:47:28
I'm experimenting with the old discovery of monkey0506 that polymorphism is somewhat possible. He explained it here : https://www.adventuregamestudio.co.uk/wiki/Extender_Methods_mean_Polymorphism!

What I've done :

HEADER
Code: ags

managed struct Base {
};
import int GetSetting(this Base*);


managed struct A extends Base {
};
import int GetSetting(this A*);


managed struct B extends Base {
};
import int GetSetting(this B*);



BODY
Code: ags


int GetSetting(this Base*)
{
   AbortGame("You need to overwrite this function");
}

int GetSetting(this A*)
{
   return 666;
}

int GetSetting(this B*)
{
   return 777;
}


Then I do this :
Code: ags

Base* array[10];
array[0] = new A;
array[1] = new B;

So far so good. I've managed to store instances of both A and B into the same array of Base.

My issue is that I don't know how to cast back.

If I do this :
Code: ags

Base* o = array[0];
o.GetSetting(); //This causes AbortGame because it calls Base::GetSetting instead of A::GetSetting



And if I do this :
Code: ags

A* o = array[0]; //The compiler forbids this. It doesn't know how to cast back from Base* to A*


Do you have an idea to make polymorphism work? Something like GUIControl::AsLabel or GUIControl::AsButton.
If I try to write this I'll encounter the same issue as before :
Code: ags

A* AsA(this Base*)
{
    return this; //AGS won't know how to cast from Base to A.
}
#20
As far as I can see, in AGS 3.6.0.8 (patch9) : (September 2021)


This works and it's really cool :
Code: ags

managed struct A {  // <-- MANAGED
  int i;
};

struct B {  // <-- NOT MANAGED
  A* a; // <-- Pointer to managed.
};



This works and it's really cool too:
Code: ags
managed struct A
{
  int i;
};


struct B{
  A* array[];
};

Later :
Code: ags

   B b;
   b.array = new A[10];
   b.array[0] = new A;
   b.array[0].i= 666;



This does NOT work :
Code: ags

struct A {  // <-- NOT MANAGED
  int i;
};

struct B {  // <-- NOT MANAGED
  A a; // <-- Compiler error! Non-managed inside struct.
};


This does NOT work :
Code: ags

managed struct A {  // <-- MANAGED
  int i;
};

managed struct B {  // <-- MANAGED
  A* a; // <-- Compiler error! Pointer to managed inside a managed.
};


Correct?
SMF spam blocked by CleanTalk