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 - Joacim Andersson

#1
20 years ago I made 3 games using the AGS engine, this trilogy was about a magician named Melrin.

I also had plans for a 4th game that took place before the original trilogy, but work got in the way and I never finished that game.

Until now!

Well, it's not finished yet but it's in development, and it's called Betrayal of the Crown.

The Story
There has been an assassination attempt on the King, and the main suspect is the King's brother Prince Eevail, however, the King himself doesn't want to believe that his own brother would try to do something like this.

So the Magician Council of the land decides to send out one of their prominent wizards, Alfrin, to investigate the crime. However, during the planning, someone broke into Alfrin's house and ripped out all the pages of his book of spells, without them he can't perform his magic. This act of thievery reveals that there is a spy within the Magician Council.

So Alfrin asks his disciple to follow him along on his journey, their task is to find the missing pages of Alfrin's book, find out who the spy within the council is, and find evidence that the Prince is responsible so they can convince the King.

Playing the game
So this game has two playable characters and you can freely switch between them. The left mouse button, except for walking around, does all the main interactions, Talk to/Open/Pick-up, and so on, while the right mouse button means "Look At".

Progress
* Graphics ~85%
* Puzzles ~50-60%
* Scripting ~60%
* Music 0%
* Sound Effects ~75%

I have a demo available, it contains parts 1 and 2 of one of the characters and part 1 of the other in this 3-part game. The Demo is fully playable and you will be told when you've reached the end of it.

A Web and Windows version is available:
https://brixoft.itch.io/betrayal
Password: Pnc4dvBoC

Screen shots




#2
I have a mini puzzle game within my game that works perfectly in the editor or compiled for Windows but acts very weirdly when compiled for the Web.

I can't explain why, I have created a minimum version that only has the mini puzzle game and uploaded the source to:
https://brixoft.itch.io/unblockme

Password: UnblockMe

Can any of you AGS experts help me understand why this code doesn't work on the web?
#3
I want under certain conditions to show a GUI when an inventory item is used on a hotspot, character, or object in the scene. In most cases this inventory item can't be used on that hotspot (object or character) but in any case, I want a GUI to be shown, but then my function code should pause until the GUI is closed.

So my question is: Does AGS have something like coroutines or something else I can use to yield the execution of a function?

I'm using version 3.6.1
#4
Some of the built-in API functions in AGS allows for a variable number of arguments to be passed to them. Does the script language also support that?

For example in Java you can write:
Code: ags
private int addUp(int ... nums) {
  int sum = 0;
  for (int num : nums)
    sum += num;
  return sum;
}
Or in C#:
Code: ags
private int AddUp(params int[] nums)
{
  // Before anyone tells me, yes I'm aware that you can use 
  // the Sum extension method from System.Linq:
  // return nums.Sum();
  int sum = 0;
  foreach(int num in nums)
    sum += num;
  return sum;
}
#5
Today, you can add several backgrounds to create an animated background, but what about different layered backgrounds to create a parallax effect?
#6
In a game I want the character to look into a telescope and I then switch room, where the player isn't visible, instead it only sees part of the room, like a circle and everything else is black. However, this circle should be controlled by the mouse so you can see different parts of the room.

I similar effect is done in King's Quest II: Romancing the Stones, when Graham enters a dark area near the Sharkees, only the area around the player is lit up and the rest is dark.

I know about SetAmbientLight and Region.LightLevel but that doesn't affect the background.

Is there any way I can do this?

EDIT: I solved this by using an object that has a black sprite with a transparent "hole" in the middle. The sprite is twice the size of the room, and I move the object relative to the mouse position. However is there a smarter way of doing this?
#7
Does AGS support multidimensional or jagged arrays? I've tried to declare one but only get errors, my workaround is to create a struct containing one array member and then create an array of that struct.

That works, for now, I'm just interested if there's a "traditional" way of doing it.
#8
First I want to start with an apology since I, asked for 2 different things in this post, but in my mind, they are connected.

1. The File* functions in AGS seem simple enough to use, I just wondered about file locations when building for the web or Android, I only need read permission but the files also have to be "installed" somehow.

What is the best solution for this? Can the $DATA$ tag be used and if so where do I place the files for them to be included in the build?

2. Are any modules available for AGS to read and traverse a structured file, as in JSON or XML format?
#9
I'm currently developing a game that includes a few mini-games as part of the puzzles. I've already created one, but I had the idea of another that is like the Unblock Me game, except instead of a red block, you would unblock a key.

I wanted to do this in a GUI, but I'm OK with it being its own room if I can't use GUI controls. The thing is that I want to have buttons (or Objects) that you can drag & drop, but if you're familiar with the Unblock Me game, you can either drag a block horizontally or vertically, not in both directions.

A GUI control has a very limited number of events, so is there a way to implement this?
#10
In a game I'm working on some pages of a book have been lost and are spread around in the world. Now, I thought that I could use a single inventory item and add a "PageNum" property to it and then create different instances of this item in different locations, but that doesn't work. When I change the PageNum property of one, they all change.

Is there a way I can do this or do I have to have to have different inventory items for each page?
#11
When my game starts the user has to play through a very restricted part of the game that sets the premise off the rest of the game. This is not really a cutscene since you still play the game and have to move through a few rooms. However, I want the user to be able to skip this part of the game from the start screen if they so desire, especially if they've played the game before. I did this in an old game of mine, but that was 20 years ago and I can't remember the code I used.

If anyone understands what I'm talking about and can give some advice I surely would appreciate it,
#12
I've uploaded a zip file containing the output of the Compiled\Windows folder to itch.io, when I tried to download it Windows 11 marked the file as a Trojan, how can I get around that? I have no Trojan warnings on my machine except for this.

I also tried downloading an older game, which worked before, but now gives me the same Trojan error warning from Windows.
#13
In the Default Setup I have "Start in Windowed Mode" set to false. I compile my program and run the exe file, it runs in a window. I run the Winsetup.exe program, it has the "Fullscreen as borderless window" checked, I click the Save and Run button and my game still opens up in Windowed mode instead of in full-screen.

I've tried to delete everything in the Compiled\Windows folder and rebuild the game with the same result, what am I missing?
#14
I've been reading through the AGS documentation, the help file that AGS is shipped with, and found some inconsistencies in the language. I know that Chris Jones, an Englishman, originally created AGS, so the spelling Colour makes sense, however for a DrawingSurface it's suddenly spelled DrawingColor, shouldn't it be DrawingColour? Also, the X and Y coordinates for an Object use capitalization as opposed to character placement, I'm guessing that this has to do with Room coordinates vs Screen coordinates so I'm fine with that but shouldn't then the parameters of the DrawXXX methods for a DrawingSurface also use capital X and Y?

I might be picky here, but I wondered about the consistency.
#15
The Maths object has all the trigonometry functions, and you can raise a number to a power, logarithmic functions, and the like. Still, I'm missing some fundamental functions like Abs(), Max(), and Min() to get the absolute number and the largest or smallest number of two values (calculations). Are they missing, or am I just missing something in the documentation?
#16
EDIT: I'm being stupid, read my own reply below.

I've been writing some test code to learn how AGS implements OOP. So my very first struct in AGS looks like this:
Code: ags
struct List
{
  protected int arrSize;
  protected String list[];
  protected int count;
  import writeprotected attribute int Count;
  import attribute String Items[];
  import int Add(String value);
  import function Remove(int idx);
  import int get_Count();
  protected import function set_Count();
  import String geti_Items(int idx);
  import function seti_Items(int idx, String value);
  protected import function ExpandArray();
};
Obviously, it's a try to implement a Collection object in AGS that is a bit more dynamic than to work with arrays (the code works fine BTW).

My question is why I'm required to implement the set_Count() function for a writeonly attribute, I understand that within the struct I can use this.Count but in my case I only use the count (with lowercase letters) to change the Count property. In my opinion, the set_Count() function should be voluntary to implement, AGS should be smart enough to just throw a runtime error if I ever use this.Count = someValue in my code if I haven't implemented the set_Count() function.

Another question related to my implementation above: This List struct only accepts strings. Is there any generic type in AGS that can accept any value, either a number or a String, such as an object (and I'm talking about the type here, not Room Object)?
#17
I have this in a scripts header file:
Code: ags
#define PLAYER_ON_PORTAL 13;
Then elsewhere I have this:
Code: ags
function PlayerOnPortal()
{
  Object* portal = Object.GetByName("oPortal");
  if (portal != null)
  {
    if (Object.GetAtRoomXY(player.x, player.y) == portal)
    {
      player.StopMoving();
      player.FaceDirection(eDirectionDown, eBlock);
      CallRoomScript(PLAYER_ON_PORTAL); 
    }
  }
}
If I replace the line CallRoomScript(PLAYER_ON_PORTAL) to CallRoomScript(13) it works, but when I try to use the defined value I get "Parse error in expr. near '13', so the parser has replaced the PLAYER_ON_PORTAL macro with the value 13, yet it doesn't work. Any help?
#18
This is strange. I make my backgrounds using Tiled and I've used the same spritesheets for the tiles in all rooms. I export the background as a PNG and open it in Paint.Net where I change the height of the image (instead of the 640x384 that I get from using 32x32 pixel tiles, I want 640x360, so I get the correct aspect ratio). I have done this with all my backgrounds, but when I suddenly created a new one and tried to import it into AGS room editor today, I got the error 'The background could not be imported. The error was: Unknown pixel format'. What's up with that?
#19
Today, I must open the General Settings and turn off Debug mode. It would be nice if debug mode was only on when I compile with the debugger attached (F5 key) and not otherwise. It's so easy to forget to turn Debug mode off before a release, and all the handy Debug() function calls are still available in the game.

I don't know about the complexity of this request, but I don't imagine it would be that hard to automatically inject the DEBUG definition based on how I choose to compile the project.
#20
I'm not sure if this belongs here or in the Editor Development forum, but since I'm requesting a feature of the debugger (even though the actual window would be in the Editor), I'm posting it here. Would it be possible, in some near future version of AGS, to get a watch window? When I set a breakpoint in a function and I hit it I would love to be able to see the values of all the local variables within that function. Today, I have to add extra debugging code like:
Code: ags
System.Log(eLogInfo, "myVariable = %d", myVariable);
I don't like to add too much debug code within my project.
SMF spam blocked by CleanTalk