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

#21
I want to build the SDL2 branch of the Engine on Windows 10.

I'm following those instructions : https://github.com/adventuregamestudio/ags/blob/master/Windows/README.md

Here is what I've tried :

1. Open Visual Studio 2019
2. Clone repository : https://github.com/adventuregamestudio/ags.git
3. VS asks me if I want to convert the project to VS2019. I say yes.
4. Switch to branch ags3--sdl2
4. Open solution 'Engine'
5. Download SDL2 from https://www.libsdl.org/download-2.0.php ( SDL2-2.0.16-win32-x86.zip ) , unzip it to a random folder
6. In project Engine.App, set the path to SDL2's include folder as shown here : https://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/msvc2019/index.php
7. In project Engine.App, set the path to SDL2's lib folder as shown here : https://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/msvc2019/index.php
8. Download glext.h from here ( https://www.khronos.org/registry/OpenGL/api/GL/glext.h ) and put it in SDL's include folder for convenience. EDIT: I don't know if it's still needed
9. Download SDL_sound from here ( https://hg.icculus.org/icculus/SDL_sound/archive/997e90562b35.tar.gz ). Unzipped it to a random folder. In project Engine.App, set up the path to SDL_Sound's include folder.


Clean the solution , rebuild the solution.

No compilation error, but linking error : SDL_sound.lib cannot be found.
It's not in the prebuilt package : https://www.dropbox.com/s/3vdq7qw01tdtfux/ags-prebuilt-libs-3.5.x.zip?dl=0

How do I get SDL_sound.lib ?
In the past I've built it myself but I cried so many tears of blood trying to download the dependency of the dependency of the dependency for whatever many libs that I'm not doing it again.
#22
Hi everyone,

This topic is awfully specific and I'm totally OK to delete it if I get a few matches.
But I know that there are Point n click enthusiasts out there in Sweden, they're just hard to find. I found some in Stockholm, and I found some in Göteborg. But what about Örebro?
Drop me a private message if you're not too fond on giving away personal info publicly on this thread.
#23
Version: AGS 3.5.1.5 patched with latest build

Scenario:
- I had a 320x200 game.
- I changed the resolution to 640x400
- AGS asked me : "Do you want to automatically rescale the GUIs?" - I said no.
- I created a new room
- I set a 320x200 background
   So now I have a 640x400 game with a 320x200 background

- I run the game.
Now, this:
I see the 320x200 image fill only the top-left quarter of the screen. Why not, I'm not really shocked here I didn't expect AGS to upscale it for me.

Then I add this :
Code: ags

function room_RepExec()
{
  if (mouse.IsButtonDown(eMouseLeft)) {
    Display(String.Format("%d, %d", mouse.x,  mouse.y));
  }
}

This way every time I click I see the mouse position in room coordinates.

To my great surprise when I click in the bottom right of the screen the coordinates are 320,200.

Can someone explain this contradiction?
- The actual background of this 320x200 room is rendered as a 320x200 image in the top-left quarter of the 640x400 game (in other words: no upscale)
BUT
- the room coordinates are upscaled so that room coordinates (320,200) match screen coordinates (640,400) (in other words: upscaled)


Is that expected behaviour?
#24
Version : Using the Editor from this build (somewhere around 3.1.5.x EDIT: 3.5.1.x).

This doesn't really need to be fixed, just thought I'd let you know.

Scenario :
- 32-bit game, 640x400
- Open the Sprites "manager" from the AGS Editor
- Right-click : "Import new Sprite(s) from file"
- Select this PNG file
- First weird thing : The colors in the preview popup are broken
- Click "Import" anyway. Error popup :" Unknown pixel format".

The image doesn't have transparency, it's a very basic PNG file created using Paint.net 4.2.15

Note: No problem importing when I force Pant.Net to save it with 32-bit colors. The image that caused issues was saved with settings "auto-detect format". I don't know if it created it with a weird palette behind the scenes, I'm just curious why AGS (and its perfectly standard middleware, like LibPNG) fails to read that specific format.
#25
AGS 3.5.0.24. Same issue with 3.5.1.4 (beta 5) and 3.6.0.2

I've never experienced that issue before in any of the thousands of lines of code that I've written.
Annoyingly, I didn't manage to isolate this issue in a simple piece of code. All I can do is provide the complicated AGS project (DOWNLOAD HERE).
I think the issue is in AGS' virtual machine, not in my code. A bug in the stack/heap or something.

Simply open it and run it. You will get "Error releasing pointer: Invalid handle".

This happens on the line containing a closing curly bracket ( } ) because I'm guessing that's where the engine frees local variables.
The issue is definitely with variable "keys" which contains the result of Dictionary.GetKeysAsArrays (i.e. a String[]), and here is how I know it : If you get rid of variable "memberName" and use "keys[ i]" instead directly, then you will get the same error ("invalid handle") on the line where you try to read keys[ i].

Interestingly the error does not happen in any of the subfunctions that have their own local versions of .GetKeysAsArrays (e.g. function ToConsole). It happens only in this block. So I suspect a weird obscure bug in the virtual machine.
I suspect that the handle to the pointer (I mean the handle that's local to this specific code block) becomes messed up when we call GetKeysAsArrays again on the same Dictionary but in another context (inside a subfunction or something) and then try to use the original handle. But it's just a theory.

I'll try with the new compiler, maybe it will help.
EDIT: I don't know how to get a built version of AGS 4.

Here I've rewritten the function without all the obscure code and macros, it's much easier to read:
Code: ags

void MyFunction()
{
        Dictionary* o = ...
        ...

        String keys[] = o.GetKeysAsArray();
        for (int i=0; i<o.ItemCount; i++) {
          //+DEBUG
          o.ToConsole(); //This uses GetKeysAsArray to iterate on every key and write the vale into a file
          //-DEBUG
          
          //AGS engine is having issues managing keys[i] all the way through. At some point it throws "invalid handle"
          String memberName = keys[i];
          
          String memberValue = o.Get(memberName); //You can try to use keys[i] instead of memberName and see what happens
              
          if (memberValue != "undefined") {
            
              ...
              o.Set(memberName, "undefined"); //You can try to use keys[i] instead of memberName and see what happens
              ...
          }
        }
        
       ...
        
      }
}
#26
That's something that has been bugging me for many versions of the Editor :

1) Go to your global script
2) Write this :
Code: ags

DynamicSprite* s = DynamicSprite.Create(1,1);
DrawingSurface* ds = s.GetDrawingSurface

3)
- What you observe (good) : the word "GetDrawingSurface" to be suggested as autocomplete when you start typing it

4) Now, repeat the exact same steps in a ROOM script :
- What you expect (good) : the word "GetDrawingSurface" to be suggested as autocomplete when you start typing it
- What you observe (bad) : the word "GetDrawingSurface" is not suggested

If I'm not mistaken, none of the DynamicSprite functions get their autocomplete in Room scripts


I'm using the latest version (I think it's 3.5.0.24 or something).
This issue has existed probably since 3.4.x

#27
Hints & Tips / A son of Xenon
Wed 03/02/2021 11:26:32
About the code to the boss office in the elevator...

I have this :
Spoiler

ACE
30 instead of 48
[close]

What I'm thinking :
Spoiler

ACE --> 135 --> 0135 (because the code has 4 digits).
But then "30 instead of 48" I was thinking I needed to add or subtract 48-30=18. So I tried 0135+18=0153, or 0135-18=0117
I tried 0135 just in case.
[close]

But none of those work.
So maybe ACE refers to positions on the keypad instead of an actual number...
I was also thinking that ACE could be l33tsp34k, like "4C3" but there's no C in l33tsp34k, so... I don't know.
#28
Hints & Tips / 30 minutes
Tue 02/02/2021 13:15:58
About the retinal scan :
Spoiler

I have the eyeball but the scanner is not powered on. I don't know how to power it on. the canner is powered on but says "unable to perform retinal scan"

I have powered up the console that's in the room with the 4 cryogenic beds, but it only seems to let me check the statuses, not power on any kind of emergency power source
I have tried using the passkey onto the reader in the main corridor, but even the reader is not powered on, so I'm confused.

I still have the spoon, the glass, the eye and the passkey left from my previous actions. The extension cord cannot be taken back from the console.

[close]

I just needed to..
Spoiler
Look at the eyeball in my inventory, and act accordingly to the comment
[close]
#29
I'm thinking of releasing this very beefy module (I'll package it in a template for convenience) and I'd like to know what are the most recent refinements in terms of help files for something that's not native to AGS.
I've seen some very important modules (I can't remember if it was Tweens or maybe Tumbleweed/9verbs) that had their own help sections directly included in the AGS help and I'd like to know exactly how they made that happen.

Was it simply that this module was considered an essential? And since it was in the git repo, then the writer was "allowed" to add a few sections in the main help file?
We can talk later about deciding if my module is considered an essential, right now I'm just asking about the context of how it came to happen.
#30
I've read this on the forums :

Quote from: SpeechCenter on Sun 15/07/2012 22:23:09
Line numbering in AGS, for example, "&3 Welcome" (...)

Where can I learn more about that? Is there a special feature of Translation files that I don't know about?
#31
I've been playing Zniw adventure and I noticed something peculiar.
The game is in 640x480x32 with "max round multiplier" and nearest neighbour. That makes it 2560x1920. It's in Direct3D9.
I'm running it on a wide screen (laptop) (i'm guessing 16:9 ratio maybe?) on a powerful laptop.

I've noticed a thing :
- when I run the game in windowed mode, the game does not slow down
- when I run it in exactly the same resolution, but I press Alt+Enter (which makes it fullscreen letter box, with no resolution change), then the game visibly slows down whenever the room scrolls (i.e. when the camera is following the character around). By "visibly" I mean it's not catastrophic but I can see that the framerate of the game drops a little bit and everything starts moving in slow motion.

I can't think of an explanation since, then again, the number of pixels rendered is exactly the same.
The only reasons I can imagine (and both sound equally crazy) are : a) the letterbox is rendered "manually" which means that every black pixel actually has to be rendered, or b) it's the camera system that contains a non-optimized portion so bad that it can slow down the entire game.
#32
Hints & Tips / Zniw adventure
Sat 07/11/2020 12:50:37
in the dark forrest at the beginning...
Spoiler

How do I get the pine cone?
I have the red fruit, the sticky branch, the poisonous cone, the vine.

I have no idea what the big boulder could be for.

I think I've tried every object on the big boulder, on the bird's branch, on the pine cone (the sticky branch is too short), on the scary eyes in the bushes. And I've tried every object on every object.

Unrelated : I've already given the white flower to the turtle and I've talked to the bird, I'm aware I must make a backpack.
[close]

About the backpack...
Spoiler

I suppose that the backpack will be made with the vine and with the leaves that the turtle will give me after I bring her the pine cone. So I'm 99% sure that the vine won't help me getting the pine cone.
[close]
#33
Try this in 3.5.0.24

Quotevoid game_start()
{
    String s = "a";
    if (s.Contains(" ")) {
         AbortGame("Wut?");
    }
}


Strings are not even supposed to have a function "Contains".

I've tried to overload the function with my own extender, but the compiler says :
QuoteString.Contains already exists
#34
AGS 3.5.0 24 (I think that's Patch 4 but I'm not 100% sure)

Try this in a custom script:
Code: ags

void game_start()
{
  Dictionary* d = Dictionary.Create(eSorted);
  String v = d.Get("badKey");
}



The manual says that d.Get("badKey") should return null.
Instead it generates an engine error.
#35
Just to be 100% sure, I'd rather ask.

the lifecycle of a dynamic sprite is :
Code: ags

DynamicSprite* spr = DynamicSprite.Create(...);
...
spr.Delete();



But what about dictionaries?
Code: ags

Dictionary* d= Dictionary.Create(...);
...
d.Delete(); // <-- this function does not exist
#36
I was thinking of the best way to apply some sort of shader. In other words : The requirement is to scan the pixels of the screen after it's been rendered, and write some new values into the buffer.

- It has been done in the past, with the "underwater" module. This module boldly reconstructs the entire scene (background+objects+characters) in what is effectively a "software" render routine that substitutes itself to AGS' native rendering. Pretty costly in terms of cpu. Also I'm not sure if the game's variables have been updated at this point in time so there might be a one-frame delay. Not too noticeable but kinda sloppy.
- The screenshot feature only exports to a file,
- And using late_repeatedly_execute places you at the right moment in the frame's lifecycle but you don't have a way of accessing the buffer.

So what am I missing? Is there a way of doing that?
#37
What the what now?

https://grumpygamer.com/delores_dev

Ron Gilbert had previously released his engine for Thimbleweed park.
Now he has released the source code for a mini-game ("Delores") based on the engine.

I haven't investigated exactly what it means in terms of ready-to-use adventure game engine, or if there's a catch, but holy Molly!
#38
With 3.5.0.24

Scenario (5 minutes to reproduce) :


- Create an empty AGS game (game1.ags)
- Create another empty AGS game (game2.ags)
- Copy game1.ags into the Compiled folder of game2.
- In game2, create one translation file : "whatever.tra". Just translate one line and compile that language, for test's sake.
- in game_start of game2.ags, Add this instruction : Game.ChangeTranslation("whatever");
   Now we know that no matter what language was chosen in winsetup.exe, it then immediately changes to "whatever"
- in room_AfterFadeIn() of game2's first room, add these instructions :
Code: ags

    bool result = Game.ChangeTranslation(""); //As per documentation, reset to default language
    if (!result) {
      Display("Cannot revert to default language."));
    }
    if (Game.TranslationFilename != "") {
      Display(String.Format(The current translation should be (empty string), instead it's '%s'."), Game.TranslationFilename));
    }
    RunAGSGame("game1.ags", 0, 0);

    Now we know that regardless of what language was chosen as default language in winsetup.exe, and regardless of which language is set programmatically at startup, the language should still be "" just before the call to RunAGSGame

Now the core of the scenario :

- Build the EXE. Go to Compiled. Run game2.exe
  => This is the first execution. The selected language in winsetup.exe is "Default language". The call to RunAGSGame succeeds because when game1 starts, it detects that the current language is "".
- exit the game.
  => Now you will notice that if you start winsetup.exe, the startup language has changed to "whatever" because the engine remembers. OK, why not.
- Start game2.exe again.
  => The game starts with "whatever" (because of winsetup.exe) and immediately switches to "whatever" programmatically (because of game_start). => OK
  => In AfterFadeIn, Game.ChangeTranslation("") succeeds. => OK
  => The game does not enter if (Game.TranslationFilename != "") {. => OK
  => RunAGSGame call happens => OK
  => game1's startup crashes with error message "Failed to read translation file 'whatever.tra'". Why is it trying to read whatever.tra even though we just switched to "" ?

The issue lies in the fact that the engine "remembers" the language that was selected the last time the game exited as the "default language".
In this situation, I don't know how to switch from one game to another if they don't share mutual translation files (same names, same strings, same set of languages)
In other words: I don't know how to revert to "default language" which was supposed to remain "" and be a common, neutral language (i.e. a language that tells the game to use its own strings instead of reading them from any .tra file)
#39
Making a portable launcher for your game in less than 30 minutes

EDIT: Click here to reveal a solution with Qt. Turns out it's not portable because Qt didn't maintain their QtWebEngime module on non-Windows systems.
Spoiler

Here, we're using Qt to make a launcher for our game.

Why a launcher?

  • Because basic users have no clue. Maybe you want a frontend to control who starts winsetup.exe, and how.
  • Because maybe you want to make the startup of your game more festive (a big nice picture and a gigantic, green "start game" button).
  • Because maybe you want the user to agree to general terms before they launch your game.
  • Because maybe you want to automatically display your game's latest news from an online page before running the game.

Why Qt?
  • Qt is free and open source
The condition is that you keep your launcher's code public and make it adhere to the LGPL license or GPL2 license or another one that I forgot.
  • Qt is portable
You just build your launcher as a static-bound program and you're done. Of course, that doesn't make the code to start the AGS game from the launcher immediately portable (e.g. Linux file paths are not formatted identically to Windows file paths) but once the GUI is portable you've done the hardest part.


Steps


1. Install Qt

  • What is Qt?
          Qt is altogether a C++ library to make GUIs, and the IDE that comes with it to build the projects easily.
  • How to get it?
          - You need to create an account on the Qt website
          - Then, make sure to download the open source version of it. Follow the steps in this video "How To Install Qt Creator on Windows 10 - 2019"
          - IMPORTANT : The video tells you to select MinGW as the defaut compiler. Don't do that. Instead, pick MSVC 2017 64 bitsor more recent. The reason is that MinGW doesn't offer the module for embedding a web browser into Qt. If you really need MinGW, then you can try your luck with msys2 by following these steps from stackoverflow
          - Make sure to also check "Qt Design Studio" to design your GUI more easily

Note: If you messed up the install, you can still add or remove features in Qt later by going to "Add or remove programs" and modifying Qt.

2. Create the project
  • On the welcome screen of Qt Creator, use the filter box to see only the sample projects containing the word "Webengine". They should be here if you properly selected WebEngine during install
  • Pick the project called "Webengine markdown editor example"
  • Let Qt create it and build it for the first time. If you see an error (something like : "Unknown module QWebEngineView" it means that you didn't listen earlier and tried with MinGW  :=
  • Run the program ("Build" and/or "Run" in the bottom-left corner of the window). Victory! You have in front of you an application containing a custom GUI and embedding a browser window.


3. Customize your launcher
  • Remove what you don't like : You probably don't need the "File" menu at the top or the Notepad-like editor on the left. Open the "Design" panel of Qt Creator and delete the Notepad-like editor and the menu in your GUI. Delete "menu bar" in the hierarchy on the right. Also delete the rows that contain "ActionOpen", etc. Then go to the "Edit" panel of Qt creator, open file mainwindow.cpp and delete all code related to the things you've removed (basically, any line that has red on it). Open mainwindow.h and delete the same things (onFileNew, isModified, etc.). Click on "Build" in the bottom-left corner of the screen, and always answer "Yes to all" if the editor wants you to save stuff. Look at the errors and fix accordingly until you can run your application
  • Important: If for some reason you can't click on "Design" anymore, click on file mainwindow.ui instead
  • Add what you're missing. You probably need a button to launch your game, and an image. Go again to the "Design" panel and add those. If you're smart you can probably embed the image into your project as a resource. 
  • Make the button start your AGS game. In the function that's fired when the button is clicked, use this simple call :     system("start C:\\path_to_your_game\\yourgame.exe");   Of course, you'll need to experiment a little bit with relative paths and if you're on Linux it will be / instead of \\. You need to use \\ instead of just \ because in C++, \ is a special character that you need to double if you want to use it.
(I'll detail how to fully implement the button and the image later)
(I'll detail how to distribute the launcher later)
[close]



Here, we're using Electron to make a launcher for our game.

Why a launcher?

  • Because basic users have no clue. Maybe you want a frontend to control who starts winsetup.exe, and how. Maybe you want them to launch a custom setup program.
  • Because maybe you want to make the startup of your game more festive (a big nice picture and a gigantic, green "start game" button).
  • Because maybe you want the user to agree to general terms before they launch your game.
  • Because maybe you want to automatically display your game's latest news from an online page before running the game.

Why Electron?
  • Electron and the dev tools that you need are free
  • Electron is portable (Windows, MacOS, Linux, iOS, Android)
  • Electron uses familiar technologies and languages: HTML, CSS, javascript



Steps


1. Install Visual studio code (5 min)

(this is only required for the developer, the players of your game won't need that)

Visual Studio Code is a pumped up text editor. Do not confuse it with the behemoth Visual Studio. Visual Studio Code is lightweight and is more like a modern version of Notepad++, except it comes with a gazillion plugins to easily develop in any language you like. Plus, it's modern, which means it's meant to let you use easily the modern philosophy of "packages" (npm and the like, see below)

It's free. Just google it, download it and install it : https://code.visualstudio.com/Download

2. Install Node.js with npm (5 min)

(this is only required for the developer, the players of your game won't need that)
(if you wish you can skip the explanations and just install them)

Let's just say that Node.js will be your development kit. A bit like installing .Net or the Java SDK. Except here it's for Node.js, which is a sort of pumped up Javascript virtual machine for running Websites as a desktop app.

Npm is what cool kids nowadays call a "package manager". This is the development philosophy that says that instead of downloading the source code of libraries manually, instead everything in the world is a package, with a unique name, and all you have to do is "npm install the_package" and BAM it's included in your project. No more headaches with importing and including the right dependencies. Sensible people in the Linux world have been doing that for decades, but now it's the standard and it's pretty rad.

Both Node.js and npm come bundled together : Again, super easy. https://nodejs.org/en/download/


3. Create your very first electron project (5 min)

  • Open a terminal. On Windows, that would be : Start menu --> type "powershell" (if you're fancy) or "command prompt" and click on the result. Please note that I'm not aware if the most basic versions of Windows still have terminals in 2020. Let's assume you've put on your developer hat today, so you're not trying to follow this tutorial on Windows Home Zero-features edition.
  • In the terminal, go to the folder where you want to create the project for your launcher : cd "C:\MyProjects\MyLauncher"
  • Still in the terminal, type this command : npx create-electron-app my-app     Do it exactly like in this video. If you get an error there, then uh oh! It means you somehow npm (and npx, which is supposed to come with it) didn't get installed properly in the previous steps.
  • It takes about one minute. Now you have a new folder containing the project. It's the folder that contains the file package.json. Open Visual Studio Code and make it open that folder. On the left panel you see the "src" folder and "package.json"
  • Inside Visual Studio Code, in the left panel (under "NPM SCRIPTS"), right-click on package.json and select "Run install". It's a bit like doing a "build" on an old-school project. It downloads all the packages that your project references. Your project is ready to be run!
  • Still under NPM SCRIPTS, now click on the little "Run" arrow next to "start". Your Hello World application should start. Success!



4. Start customizing

  • Your launcher is built like an HTML page with javascript. Except we'll use the Javascript code to run our AGS game and other cool things
  • Watch  this video and get familiar with the general philosophy of your app.

5. Embed your "News" page into your app (1 min)

  • In your file index.html, under <h1 >Hello world!< /h1>, add this row :
Code: ags

    <iframe width="100%" height="400px" src="https://www.google.com"></iframe>

  • Run the app. Success! You now have the Google page inside the window of your desktop app. Replace google.com with any URL you want


6. Add a button that launches your game (5 min)

  • Follow the steps of the video mentionned previously to add a button and the script that reacts to the click on the button:

In the HTML file:
Code: ags
    <button id="launchgame">Launch game</button>


In the render.js file :
Code: ags

const btn = document.getElementById("launchgame");
btn.onclick = () => {
   alert("A click has occurred!");
}

  • Start your app and click on the button. Success!

  • Make the button run an external program.
- At the very top of render.js, add this :
Code: ags

const spawn = require('child_process').spawn;


- Now modify the onclick function like this :
Code: ags

const btn = document.getElementById("launchgame");
btn.onclick = () => {
    const path = "C:\\PATH_TO_YOUR_GAME\\Compiled\\Windows" 
    const cmd = path + "\\mygame.exe";
    const args = { }

    //Runs the external program (the game)
    const p = spawn(cmd, args)

    //Optional : display "stdout" into our app's console
    p.stdout.on('data', (data) => { console.log('stdout: ' + data) })

    //Optional : display "stderr" into our app's console
    p.stderr.on('data', (data) => { console.log('stderr: ' + data)})

    //Optional : display the game's exit code into our app's console
    p.on('close', (code) => { console.log('child process exited with code ' + code)})
}


    • Run the game and click on the button. Success! Your game starts.
    Note: If you get an error about some missing files (for examle the translation files) it's because your didn't start the launcher and the game from the same folder, so you got AGS confused regarding the files' location.

7. Distribute your launcher (1 min)

  • Run the "build" script instead of the "start" script. Success! you now have the .exe file of your launcher (and all the other required files to run it) in the corresponding output folder of your project (look closely at the left panel in Visual Studio code, you'll see them.
  • Snoop around to build the Linux and MacOs equivalents to the .exe file (I'll detail it later). Success! you can now distribute your launcher onto other systems.
#40
Hi,

I'm looking for the most up-to-date source code of the "AGS awards" game. But it seems that even though the sources have always been semi-public, they never got their own public repo? The most recent sources I can find are a zip file fro 2014 hosted on a dropbox by Snarky.

Does anyone have the most recent sources?
To be honest the only bit I'm interested is the TCP/IP part of it. There's a very, very old plugin available in the forums but I'm guessing that any kind of network-related piece of code in the Awards project is more up-to-date.
Alternatively, any solution to get an HTTP response from a server (from within an AGS game) is of some interest to me.

SMF spam blocked by CleanTalk