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

Messages - Monsieur OUXX

#241
Quote from: morganw on Wed 20/05/2020 16:00:58
It is probably worth noting that recent builds of Windows 10 come with a version of curl, and that AGS doesn't change the working directory when it starts, so potentially you may actually be running a separate copy and not the one which you have supplied. Also this shouldn't be confused with the curl alias in Powershell, which is a horrific attempt to map the symbol 'curl' to Powershell's web request functions (which are dependent on other system/IE components, which are potentially not operational).

Is curl a standard program in Linux and/or MacOS? It would be cool if I didn't have to ship it with any of my game's ports.
#243
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.
#244
So I've tried this and it seems to work on Windows 10, AGS 3.5.0.24 (aka "patch 2") using curl 32 bits :
Code: ags

  ShellExecute("", "curl.exe", "\"https://www.raidersofthesevencities.com/stats-startup.html\"");


I've simple put all files from curl's "bin" folder into my AGS game's execution folder
Code: ags

curl.exe
curl-ca-bundle.crt
libcurl.dll


Me happy.

I'm very happy that I can just download the binaries for Curl on other systems (MacOS) right off the website.
I'm less happy that I only have the sources to ags_shell and that I need to build them myself for MacOS or Linux. But, oh well. I can't really compain about that.

#245
Quote from: Khris on Wed 20/05/2020 10:46:57
(Also, maybe a mod can split off the https messages and move them to the technical forum?)

Nah, it's really not AGS, just me not understanding internet protocols.
If ShellExecute("", "http://google.com", "") works, I don't need more. Again, I don't need to parse the result, I just need the http server to know that someone hit that page.
Nope, that's no good. It does switch out from the game and open the page in a browser. I want to silently hit the page. I'll try curl.
#246
Quote from: Khris on Wed 20/05/2020 08:30:31
Not sure, but you can use curl instead.

And here's the plugin: ags_shell

It will be a better solution, because this causes the page to open in a browser, which I don't want :
Code: ags

ShellExecute("open", "rundll32.exe", "url.dll,FileProtocolHandler http://www.google.com");
#247
Quote from: Khris on Wed 20/05/2020 07:59:12
ags_shell.
A few months ago I was trying to remember that plugin and couldn't find it. Thanks! I'll try. Maybe I can do everything through the shell, with Powershell commands. Will it pop up a shell terminal?
#248
Quote from: Khris on Tue 19/05/2020 19:56:05
Anyway, the socket plugin has no built-in support for https, all it does is open connections. You would have to implement the entire ssl protocol yourself.

OK but before it sends encrypted stuff there has to be a way for me to simply get a "you hit the right page, thank you" answer, without any encryption-related code? I humbly confess I don't know enough.
#249
I'm trying to get an HTTP response from a https page, using AGS (ags sockets plugin)
I don't really care bout the content, I just want an HTTP 200.

When I try with postman this is what it sends to the server :

Code: ags

GET https://www.raidersofthesevencities.com/stats-startup.html

User-Agent: PostmanRuntime/7.24.1
Accept: */*
Host: www.raidersofthesevencities.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive


Nothing fancy.

Here is how I try to replicate it :
Code: ags

  String host = "www.raidersofthesevencities.com";
  String path = "/stats-startup.html";

  SockAddr *ip = SockAddr.CreateIP(host, 80); //Only 80 works, 443 doesn't return anything

  state.server = Socket.CreateTCP();
  state.connected = !state.server.Connect(ip);
  state.server.blocking = false;

  if (state.connected) {
    String completeTarget = String.Format("https://%s%s", host,  path); //  https://www.raidersofthesevencities.com/stats-startup.html
    
    String command = "";
    
    command = command.Append(String.Format("GET %s HTTP/1.1\r\n", completeTarget )); //I tried removing HTTP/1.1, I get "bad request"
    command = command.Append(String.Format("Host: %s\r\n", host));
    command = command.Append("Connection: keep-alive\r\n");
    command = command.Append("Accept: */*\r\n");
    command = command.Append("Accept-Encoding: gzip, deflate, br\r\n");
    command = command.Append("User-Agent: AGS (Windows NT 5.1; U; en)\r\n\r\n");
    
    state.server.Send(command);
  }


Yet when I try that, I get a "301 permanently moved". And the response contains :
Code: ags
Location: https://www.raidersofthesevencities.com/stats-startup.html

As you know this is the server's subtle way of telling you that you're a silly goose and that you should have gone straight away to HTTPS instead of starting with HTTP. Except... I did start with https, with exactly that URL.

What am I missing?
#250
Please note : While testing sending and receiving HTTP from AGS, I've noticed that this plugin ( AGS sockets, aka "ags_sock.dll" ) is more stable than the plugin used in the AGS awards ( Sockets for AGS, aka "agssock.dll" ).

- Sockets for AGS works well with IRC messages but it freezes when trying to poll ( server.Recv() ) the response from google.com or some other websites. I suspect an internal issue with some C buffer being too small or something like that.
- I've had no issue getting the response from an HTTP GET using AGS sockets, in an AGS 3.5.0 game.



EDIT: I might be wrong. Still researching it.
#251
Quote from: Snarky on Mon 18/05/2020 19:11:12
Anyway, this is not relevant, because what you're looking for is the sockets plugin, agssock.dll. This was developed by Wyz. He was also supposed to open-source it, but seems to have forgotten. Bug him about it.

Yes, don't bother releasing the client.
I have the DLL now, and I don't even really need its sources, I'll just use it as-is.
#252
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.

#253
Quote from: Crimson Wizard on Mon 18/05/2020 13:46:30
Quote from: morganw on Mon 18/05/2020 12:49:26
They are building all the time and have no known issues:
https://cirrus-ci.com/task/5955130990264320

But these aren't included with the editor since:

  • these are not signed or notarized
  • this is just the engine binary and not a .app bundle (although perhaps building an empty bundle is feasible)
  • the editor cannot build release archives to maintain the correct file permissions (so a .app bundle copied from Windows is likely to no longer run on macOS)

Perhaps we could include these to release downloads on github too, since Android unsigned launcher is also included?

Well at least it would make it clear to people that AGS can run on MacOS. I didn't believe it until recently, I thought the Mac branch had stopped at 3.4.
#254
Quote from: morganw on Mon 18/05/2020 12:49:26
  • this is just the engine binary and not a .app bundle (although perhaps building an empty bundle is feasible)
  • the editor cannot build release archives to maintain the correct file permissions (so a .app bundle copied from Windows is likely to no longer run on macOS)

Forgive my inaccurate comparison, but is it (roughly) the Mac equivalent of producing an .exe file without an installer/zip/msi file to contain it, except that in the case of Mac it's critical because the .app file also sets the correct permissions to what it contains?
#255
Thanks, that's very clear.

Oh well, if you happen to build that unsigned "Release" executable of the engine, then think about me.
#256
:-(

But is it possible to build an unsigned version for Mac that I would then distribute outside the store? I don't care about the store. Why would I even need a store to download a standard program on a standard (MacOS) laptop?
#257
Thanks.
Why does everyone make it sound crazy to release an unsigned app not through the store? Why don't I just set up a download link to an unsigned apk? I mean, I don't give a flying f**k about the stores and I genuinely don't understand why people seem to think it's so important?
#258
I'm in the situation where I know AGS for Windows inside and out (let me believe that, please) but have zero knowledge of AGS Linux and AGS MacOS. I'm talking about the engine, not the Editor.
However I understand that:
- AGS Linux can be taken for granted, whereas...
- ...AGS MacOS is still an elusive creature (it sorta works but requires some work).

Independently, I know that some people try to make AGS games run on Mac through emulation. (Right?)

Therefore, my thinking is as follows (I apologize in advance if it's completely idiotic and/or naive) :

Provided I don't have a MacOS version of the AGS engine, then as a game "publisher", can I make the life of my MacOS audience easier if I let them run the Linux version of my game on their Mac, rather than the Windows version?

In this fantasy scenario, I imagine that it's somewhat easier for the average MacOS end-user to run an emulated Linux version of an AGS game (due to the proximity of the systems) than an emulated Windows version. The reason for my belief is that I imagine that if they want to emulate AGS Windows they'd have to run the equivalent of Wine for Mac(which is probably complicated for the average Joe), whereas if they want to emulate AGS Linux I'd just need to provide them a few simple instructions or even ready-made files -- maybe some sort of Linux-to-Mac-converted package or whatnot.

Does any of that make sense?

#259
Quote from: morganw on Fri 08/05/2020 19:45:26
only the debug version is uploaded because a release version doesn't run (due to being unsigned).

I have zero knowledge about mobile apps so I'm wondering : What prevents me from shipping my game for Android with the Debug launcher instead of the Realease version then?
#260
I'm still interested in the MacOS executable though, even with the colors issue  :=
I can act as a tester if you guys wish.
SMF spam blocked by CleanTalk