Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.

Messages - Snarky

Pages: [1] 2 3 ... 267
Nah, it's fine. Repeatedly editing the title just for the sake of it might be frowned upon, but a straight-forward, reasonable edit for good reason is absolutely encouraged (though of course it's always better to get the thread title right the first time around).

How about "[SOLVED] Selecting graphics for GUI depending on parameters"?

I don't know about the +6, but the -1 is because you've numbered the ShipPowerLevel options from 1, while frames are numbered from 0. (BTW, this is a typical case for using enums: you have variable that can take on some small set of different values, where each value represents a different option. Instead of having the values be just 1, 2, 3, etc., the enum allows you to give the options meaningful names.)

Try this:

Code: Adventure Game Studio
  1. NPCGoToCharacter(cBodyguard, cMonk, 4, true, eBlock); // Though instead of "4" I would use one of the named enum values that should pop up when you type it in

It's important to understand the format of a function and what the different parts of the definition means.

So for example, when the code says int NPCGoToCharacter(...), that doesn't mean you should put a number before the function when calling it. It means that it's a function that returns a number, so that you could write, for example:

Code: Adventure Game Studio
  1.  int returnval = NPCGoToCharacter(cBodyguard, cMonk, 4, true, eBlock); // The returnval int will be set to the value returned by NPCGoToCharacter()

You have to look in the documentation to see what this number means.

Similarly, Character*charidsomething means that this argument is of type Character*, and charidsomething is just a name that is meant to help describe what it represents. So you have to fill it in with a Character* – which is what the character script names (e.g. cBodyguard, cMonk) are. In this case it's a little confusing since the argument names use "charid", wrongly suggesting that you should use the character ID, but if you just focus on the variable type you won't get confused.

General Discussion / Re: Trumpmageddon
« on: 19 Aug 2017, 21:05 »
ITYM Washington and Jefferson rather than Lincoln, Ali. At least those were the presidents Trump originally compared Lee to.

And Confederate "heroes" may or may not have been personally racist (or more racist than the average person of the day), but they fought for a racist cause. A statue honoring Robert E. Lee is problematic just as a statue honoring Erwing Rommel would be: both had admirable qualities, both are highly respected as military geniuses, but both fought on the side of an evil regime and seem to have been in sympathy with many of the basic aims of that regime.

General Discussion / Re: Trumpmageddon
« on: 17 Aug 2017, 09:50 »
Ah yes, good old "both-sides-are-equally-bad"-ism. Lowering my respect for AGSers since 2004.

Bumpity bump...

OK, I now want dramatic readings of all my forum posts. Thanks!

Listening to an old episode (#56, I think), I noticed something relevant to my other topic suggestion. You addressed one pitfall of the AGS community: accepting the community's (freeware) standards and becoming a bit naive about what's required of a commercial release. (Vice versa, I'd argue that the rise of commercial AGS games is in danger of putting the threshold too high for newbies.)

I also had another topic idea: When to give up. You've talked about the skills needed to finish a game, you've talked about cutting stuff that isn't working, and you've occasionally mentioned games you never finished. But how do you know when it's time to walk away from a project? (Either your own projects or collaborations.)

The Rumpus Room / Re: *Guess the Movie Title*
« on: 15 Aug 2017, 12:57 »
Well, like I said it was a thematic connection: they're both absurdist anti-war comedies with scenes of harrowing tragedy.

The Rumpus Room / Re: *Guess the Movie Title*
« on: 14 Aug 2017, 14:20 »
Sure is! Just a shame that I didn't get a chance to post one of the finger-severing scenes (this film has several)... (laugh)

Good solve, too. It's cool when people use clues and details to figure it out even if they haven't actually seen it.

The Rumpus Room / Re: *Guess the Movie Title*
« on: 14 Aug 2017, 13:36 »
No and no.

Hint: It's technically in the same genre as the last film, though at just about the other extreme of the budget range.

The Rumpus Room / Re: *Guess the Movie Title*
« on: 14 Aug 2017, 10:41 »

The Rumpus Room / Re: *Guess the Movie Title*
« on: 13 Aug 2017, 20:31 »

The Rumpus Room / Re: *Guess the Movie Title*
« on: 13 Aug 2017, 15:09 »
All right, let me try to think of something more in line with AGSers' viewing...

The Rumpus Room / Re: *Guess the Movie Title*
« on: 13 Aug 2017, 13:36 »

Cloud Atlas?

If the effect you're going for is something like this, you can probably achieve something quite close just using a semi-transparent overlay of the pattern on a GUI.

What blocks you from using the draconian build for your game?

The Rumpus Room / Re: *Guess the Movie Title*
« on: 12 Aug 2017, 00:46 »
But it's not an obscure movie. It came out quite recently, in 2011, played at Cannes, won the audience award at the Toronto Film Festival, had a theatrical release in lots of countries, and was widely reviewed (the first page of Google results include the NYT, WaPo, Guardian, and New Yorker; I first read about it on the AV Club). It's available on disc and streaming from Amazon.

OK, final try:

The titles are in French and Arabic, and many reviews compare it to Lysistrata.

Well, I think you're just confusing yourself by not clearly distinguishing between position and movement. The thing you need to store is the position (which we can also represent as "how far along we are": a proportion of the total distance), and then you just use the movement speed to update the position.

There are lots of different ways to figure out how to do that update (some of which are more efficient to calculate), but let's take a general example, where you want to move from point x_start,y_start to x_end,y_end, and we store it as a proportion. To calculate a position x,y that is proportion of the way between, you can do it like this:

Code: Adventure Game Studio
  1. // Variables declared either globally or as function arguments
  2.   int x_start, x_end, y_start, y_end;
  3.   float proportion;
  5.   // Calculation of coordinates
  6.   int x = FloatToInt(IntToFloat(x_end) * proportion + IntToFloat(x_start) * (1.0 - proportion), eRoundNearest);
  7.   int y = FloatToInt(IntToFloat(y_end) * proportion + IntToFloat(y_start) * (1.0 - proportion), eRoundNearest);

We do all the calculation in floats for maximal accuracy, and then round off to the closest int. You see that we just take a weighted average of the start and end coordinates, according to the proportion (when proportion is 0, we use 100% of the start coordinate and 0% of the end coordinate, when it is 0.1 it's 90% to 10%, and so on).

OK, now we just need to update the proportion, which is pretty simple:

Code: Adventure Game Studio
  1. float proportion;
  3. void MoveBackdrop(CharacterDirection direction, float speed)
  4. {
  5.   if (Backdrop == null || direction == eDirectionNone) return;
  7.   // Update the proportion by a certain amount (the movement speed)
  8.   proportion = proportion + speed;
  9.   // Make sure the proportion is in the [0.0, 1.0] range
  10.   if(proportion > 1.0)
  11.     proportion = 1.0;
  12.   else if(proportion < 0.0)
  13.     proportion = 0.0;
  15.   // We set x/y_start/end with the particular values for the movement we want
  16.   if(CharacterDirection == eDirectionDownLeft)
  17.   {
  18.     int x_start = Room.Width * 2;
  19.     int y_start = 0;
  21.     int x_end = Room.Width;
  22.     int y_end = Room.Height;
  23.   }
  24.   else if(CharacterDirection == eDirectionDownRight)
  25.   {
  26.     // etc.
  27.   }
  28.   // etc.
  30.   // Calculate the coordinates from the proportion
  31.   int x_offset = FloatToInt(IntToFloat(x_end) * proportion + IntToFloat(x_start) * (1.0 - proportion), eRoundNearest);
  32.   int y_offset = FloatToInt(IntToFloat(y_end) * proportion + IntToFloat(y_start) * (1.0 - proportion), eRoundNearest);  
  34.   // Render
  35.   DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
  36.   surface.DrawImage(x_offset, y_offset, Backdrop.Graphic, 0);
  37.   surface.Release();
  38. }

This all assumes that the CharacterDirection doesn't change during the scrolling. If it does, it'll suddenly jump from one position to another when it changes direction.

If you want the movement to just be along a straight line (the diagonal), I say create a function that draws it in a position between 0 and 1, where 0 is the start (upper right) and 1 the end (lower left) position – from this you calculate the x and y offsets. Keep a variable of the current position value. Then adjust the value each turn to move the background, depending on the speed you want (e.g. from 0 to 0.05, 0.10, 0.15... to move slowly, with a speed of 0.05 per turn, or from 0 to 0.2, 0.4, 0.6... to move more quickly, at a speed of 0.2 per turn).

If you want the speed to vary, this is where differentiation/derivation comes into play:

Your basic value is the position
The change in the position each turn (first derivative) is the movement speed
The change in the movement speed each turn (second derivative) is the acceleration

So if you want the movement speed to change gradually, you need to store not only the position, but the current movement speed, and then adjust that each turn. If you increase it by a constant value each turn you'll get steady acceleration, faster and faster, like when something is falling. If you first increase it and then decrease it (e.g. increase until speed is 5 and then decrease again, or increase while the position is less than 0.5 and then decrease), you'll get an ease-in, ease-out effect, more like a camera move.

If you're confused by the distinction between bits and colors, you can think of it by analogy to salary: What is better, earning $60,000 a year or earning a 6-digit salary? Well, 6 digits is at least $100,000, so that's higher, even though 60,000 is more than 6.

Pages: [1] 2 3 ... 267