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 - Snarky

#201
Quote from: lafouine88 on Mon 07/10/2024 15:48:57I remember one advice from Khris I think who said that most of the time there is a better way than to use 'repeatedly execute' to save RAM.

It's hard to judge the pros and cons without seeing some examples, but creating ~1000 DynamicSprites seems almost certainly like overkill.

I'd probably go with CW's suggestion, but if you ever find yourself in a position where you do need to generate a thousand DynamicSprites, my suggestion would be to not do it all in one go, but do a small number each game cycle. (Assuming that not all the sprites need to be immediately available.)

In this case, since you already have it broken into 10 different functions, I would start by calling them in subsequent game cycles:

Code: ags
int skinUpdateCounter;

void reloadskin(int base, int slot)
{ 
  Skin_stuffed[slot]=base;
  skinUpdateCounter=1;
}

void updateSkin()
{
  switch(skinUpdateCounter)
  {
    case 1: AlterEgoNormalView(); break;
    case 2: AlterEgoIdleView(); break;
    case 3: AlterEgoaoeView(); break;
    case 5: AlterEgoatkView(); break;
    case 6: AlterEgocryView(); break;
    case 7: AlterEgodeathView(); break;
    case 8: AlterEgokickView(); break;
    case 9: AlterEgosweepView(); break;
    case 10:
      AlterEgoLHView();
      skinUpdateCounter = -1;
      break;
  }
  skinUpdateCounter++;
}

function repeatedly_execute_always()
{
  if(skinUpdateCounter>0)
    updateSkin();
}

This will spread out the processing over 10 cycles (1/4 second). Since you say it takes 1-2 seconds, this would not be enough, and you would have to handle each of the AlterEgo functions in several steps as well (most easily using a second counter, with some modifications to the counter incrementing logic).
#202
Do you mean that there's a fixed set of possible movement arrows (e.g. four directions) but not all arrows are available in every room?

You could set up some standard format to hold all the valid ways to navigate from the room. For example, you could add four custom (int) properties to the room: "North", "South", "East" and "West".

Then for each room you would set each compass direction value to the room number you go to if you click in that direction (leaving it as 0 if no navigation is available that direction).

Now you could use the same GUI always, and in the function to display it, it would check the compass properties for the current room and hide unused buttons as necessary.
#203
Quote from: Danvzare on Thu 03/10/2024 11:31:50This is what you get with MovementLinkedToAnimation is set to false, and it's set correctly:


As you can clearly see, setting it to false not only gives a much smoother scrolling effect and less choppy character movement, but when the character animation delay and speed are set correctly, it even removes the gliding effect that people like Snarky think MovementLinkedToAnimation is required to fix.

Do you not see the feet gliding in this gif? He's practically moonwalking!
#204
Quote from: Danvzare on Wed 02/10/2024 12:38:55
  • Select the player character in the editor, and look at the list of options to the side.
  • There should be one option that says "MovementLinkedToAnimation", set it to "False".
  • Enjoy your smooth scrolling screen.

It's an option that's set to true by default because it makes walking animations look decent with zero effort on the part of the artist or programmer.
But the cost can be jerky movement that is enough to give someone motion sickness in my opinion.

I strongly disagree with this advice.

If you turn off "Movement linked to animation" you get a gliding effect when walking, since the character moves even when the animation frame doesn't change, making the feet slide across the ground. This looks very bad, and is a bigger issue than the scrolling, which can anyway be fixed in other ways.

And in this case it shouldn't have anything to do with the issue at all, since there is no walking character on the screen. The original poster must be doing something in a non-optimal way.
#205
Quote from: Jordanowen42 on Tue 01/10/2024 07:30:08Thanks for all the great ideas tho.

 ???
What you ended up doing was literally the first thing anyone suggested:

Quote from: RootBound on Sun 29/09/2024 11:35:16There are multiple ways to do it, but you should only need nine objects. You can change each object's graphic depending on which inventory is used on it

In any case, now I feel more comfortable answering your earlier question:

Quote from: Jordanowen42 on Tue 01/10/2024 05:39:21How do I change the number of objects?

You update AGS to the latest version and use that version to edit your project.
#206
Quote from: Jordanowen42 on Tue 01/10/2024 05:39:21How do I change the number of objects?

You don't have to because the solutions to your problem only require 9 objects at most. Please don't implement your original idea of using 81 different objects.
#207
I don't remember if we already discussed this, but I think this might work as a puzzle for an adventure game:

You learn that someone always uses the same starting guess in Wordle, but not what it is. You have a small handful of color-grids of puzzles they've solved, and what the actual solutions were. Your task is to try to figure out their initial guess. To do so you have to reconstruct the intermediate guesses, working backwards. For example, in this case it is pretty easy to see that cat's second row must have been:

Spoiler
COULD
[close]
#208
General Discussion / Re: So what did I miss?
Mon 30/09/2024 12:41:11
We're now at almost exactly the point where AGS has been open-source for longer than it was closed-source.
#209
The BBC has made an archive of sound effects available here: https://sound-effects.bbcrewind.co.uk/search
#210
Quote from: Crimson Wizard on Fri 27/09/2024 15:38:55(and ~1101 = 0010)

Though it's worth pointing out that the bitwise negation operation acts on 32-bit ints, so it would actually be (in binary representation):

~00000000 00000000 00000000 00001101
=11111111 11111111 11111111 11110010


Which in decimal works out to ~13 == -14
The perhaps surprising result is a consequence of how negative integers are stored as bits. (The largest bit is negative while all the others are positive, so that -1 is stored as all bits set to 1.) The upshot is that ~a == -a - 1

But since when you use bitwise negation you're usually only concerned with the individual bits, not what number they all represent together, and you can typically ignore any bits apart from the ones you're interested in, this doesn't really matter.

If you do need to limit the negation to certain bits, you can use a bitwise AND filter to zero out the others. For example, if you only want the last four bits:


 11111111 11111111 11111111 11110010
&00000000 00000000 00000000 00001111
=00000000 00000000 00000000 00000010


So that you get binary ~1101 == 0010 as expected. (In decimal: ~13 & 15 == 2)
#211
Moderator note: This topic was split from here: https://www.adventuregamestudio.co.uk/forums/adventure-related-talk-chat/i-started-a-devlog/

Good stuff! But this bit threw me:

Quote from: ThreeOhFoura few issues that were specifically related to the quirks of the AGS script language. For example, assigning an integer variable as the size of an array of floating point variables requires that you refer to the integer variable with the "float" type, despite the fact that you're calling an integer and that the array size cannot be a floating point variable, and yet AGS's rule for requiring an IntToFloat call to handle this conversion breaks the script. He pointed out that I could simply refer to the integer with the "float" type and that this would pass in this specific exception

It sounds like there must be some sort of misunderstanding. To use an integer variable to set the size of an array of floats, you would write something like:

Code: ags
  int arraySize = 15;
  float floatArrayDynamic[] = new float[arraySize];

This is not "referring to the integer variable with the 'float' type." The new float[arraySize] bit doesn't mean that arraySize is being used as a float; it's an instruction to "create an array of floats, with size arraySize." And the size of an array is always an int, of course.

It would be the same whatever we make an array of:

Code: ags
  bool boolArray[] = new bool[arraySize];
  AudioClip* clipArray[] = new AudioClip[arraySize];
  // ...

In each case, the bit in the brackets is giving the size of the array, and has nothing to do with the array type.
#212
Sweet! Sounds like a great solution. I like that a lot better than having the script name in the handler function name (especially if you move stuff around later).
#213
Quote from: AGS Manual
Code: ags
static DynamicSprite* DynamicSprite.Create(int width, int height, optional bool hasAlphaChannel)

You have to set hasAlphaChannel to true.
#214
I don't think there's any way to do that, and I'm 99.9% sure that the new website is just the web pages, not the forum.

I would stick to font colors that work against both the light and dark theme backgrounds.
#215
The Rumpus Room / Re: What grinds my gears!
Sun 15/09/2024 19:42:43
When people who ought to know better pronounce "mischievous" as if it's "mischievious."
#216
Has someone done it? I don't know.
Could someone do it? Sure.

Are you looking for advice on how to do it? Then please ask what you want to ask.

One way might be to store the target crossword solution as an array of Strings. (So if the grid is 20x20, it's an array of 20 Strings, each String 20 characters long, using e.g. '_' for blacked-out blocks.) The benefit of this is that it's easy to edit in a text editor and then import into AGS. You could also store the player's proposed solution (i.e. the current state of the crossword) in a similar array of Strings, or alternatively an array of chars. A char array might be easier to work with since the state needs to change a lot, letter by individual letter.

To draw the crossword I would recommend just rawdrawing it (using DrawingSurface functions), since drawing and interacting with a regular grid is trivial. I think this will be more straightforward than using Objects, GUI elements or some other existing elements. For the input you could use a TextBox that you reposition to each square as it gets focus, but you'll have to decide just how the interaction should work (how to navigate to different parts of the grid, what happens after you've entered one letter, etc.).

You would also have to decide how the puzzle solving should be done. One easy way would be to keep count of how many squares are filled in, and when the whole puzzle is filled in compare the answer to the solution, character by character, to check that they are identical. If you wanted to give players feedback along the way (for example a confirmation for each word correctly filled in) that would be a little more work.

Edit: This proposal doesn't consider the clues. Here it depends a bit on what style of crossword you want. I'm assuming it's the "proper" kind where some squares in the grid are numbered, with a corresponding numbered list of clues outside of the grid itself. In that case, I'd simply keep a separate list of clues (possibly two lists, one for horizontal and one for vertical words), with a set of coordinates into the grid for each clue corresponding to the square that should be numbered.
#217
Wordle 1,183 6/6*

⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜
⬜🟨🟨⬜🟨
⬜🟨⬜🟨🟨
🟨🟨🟩🟨🟩
🟩🟩🟩🟩🟩

Spoiler
WHINE, SULKY, PORTA, FAVOR, ABORD, BROAD

To mix things up I always pull the first word from whatever's going through my mind at the moment, sometimes adapted to fit the letter count.
[close]

Incidentally, I suspect Wyna Liu has been listening to Chappell Roan.
#218
Dave has talked about it in lots of different interviews. Here are just the first couple that came up in a Google search:

https://www.gamedeveloper.com/business/as-i-blackwell-i-comes-to-an-end-what-s-next-for-wadjet-eye-
https://kritiqal.com/articles/kritiqal-care-ep-32-dave-gilbert
#219
Yeah, makes sense. Maybe a space? Just looks better aesthetically, IMO... As long as that doesn't interfere with any command-line tools (where spaces in file names often require special handling).
#220
Quote from: eri0o on Mon 09/09/2024 15:25:59Anyway, this may take a little bit I will get there, sorry for the wait.

No worries! I've made the fixes for the issues I encountered in my local copy, so they're not showstoppers. (I thought I'd even experiment with forking the repo and trying to submit my edits as pull requests.)

Ultimately I'm hoping to be able to do something like:

Code: ags
// In Player.asc, for a custom "Player" struct 
void LoadFromJson(this Player*, JsonParser* json, String path)
{
  if(json.KeyExists(path, this.Id))
  {
    JToken* t = json.Select(path, this.Id);
    this.name = t.StringValue("name");
    this.age = t.IntValue("age");
    this.leftHanded = t.BoolValue("left-handed");
    this.hairColor = HexToAgsColor(t.StringValue("hair-color"));
  }
}

// In GlobalScript.asc, on startup
bool LoadJsonConfig(String jsonString)
{
  JsonParser* json;
  // Omitted: parse the string

  // Load player config
  String path = "players";
  for(int i=0; i<playerCount; i++)
    player[i].LoadFromJson(json, json.SelectArrayIndex(path,i).path);

  // TODO: Load other stuff
  // ...
}

(I haven't thought through the precise API, but essentially I want to be able to freely select/search for particular keys within a particular token and its children and read the corresponding values.)
SMF spam blocked by CleanTalk