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 - Crimson Wizard

#11241
Yes, your code allows to run two ChangeRoom commands in a sequence.
First is run if PlugIn = true, and then the second runs if SinkFilled is either true or false.

To deal with situations like this you need to exit the function prematurely. This is what "return" command for ().

Code: ags

{
  if (PlugIn==true)
  {
    cEgo.Walk(575, 650, eBlock, eWalkableAreas);
    cEgo.ChangeRoom(8, 0, 0);
    return; // this terminates function and returns back to where it was called
  }
  <...>
}


Another way is to use "else if" structure, in which case only one of the blocks can be processed at a time:
Code: ags

{
  if (PlugIn==true)
  {
    cEgo.Walk(575, 650, eBlock, eWalkableAreas);
    cEgo.ChangeRoom(8, 0, 0);
  }
  else if (SinkFilled==true)
  {
    cEgo.Walk(575, 650, eBlock, eWalkableAreas);
    cEgo.ChangeRoom(9, 0, 0);
  }
  else
  {
    cEgo.Walk(575, 650, eBlock, eWalkableAreas);
    cEgo.ChangeRoom(2, 0, 0);
  }
}

I actually think that the second solution is better in this particular case, because you do not have anything else in this function.
#11242
AGD2, I cannot figure out how to get same results as you have. Regardless of what I try, I get something different. Maybe I am doing something wrong...

Can you explain which combination of Guis/Gui Controls/sprites are in use there?
Maybe it is possible for you to send me some kind of demo version, or one-room version of your game, which would have those guis?


EDIT: Hmm, I was able to reproduce such effect, but it looks the same both in 3.2.1 and 3.3.0. It happens if I have a GUI background image without alpha channel and with magic pink areas. In such case the text on the label becomes not anti-aliased when drawn over those pink areas... That's the only thing I found so far.

One more question: did it work correct for you in 3.2.1 (or whichever version of AGS have you used), and with which settings?
#11243
Yes, I made a very small typo in the code, that broke character animation timing. Please, delay using this build. I'll reupload fixed version as soon as I check out that problem with string drawing.
#11244
Quote from: DoorKnobHandle on Tue 01/10/2013 17:22:59
Just a minor correction, the above code would compile in C++ but doesn't compile in AGS Script, you do need to use:

No, it does compile :).
When pointer is the only argument in the expression, it does compare it with 0.
What does not work, is when you have a pointer used with other arguments:
Code: ags

if (music_channel || true)
{
}

In such case you would need to write:
Code: ags

if (music_channel != null || true)
{
}

#11245
Well, first of all, whenever you are using audio channel pointer, it'd be wiser to make a check beforehand, because you can't guarantee it will point to something all the time:

Code: ags

if (music_channel)
{
   music_channel.Volume = 10;
}


Now, the question is, why is it null just after calling aKentyTheme.Play()? Hmmm... does the music actually play?


EDIT: Now, wait a second.
This does not make a sense:
Code: ags

aKentyTheme.Play (eAudioPriorityHigh, eRepeat);
music_channel =aKentyTheme.Play(); 

First time you make it play, and it returns an AudioChannel pointer, which you ignore.
Second time you make it play AGAIN.
Instead, do this:
Code: ags

music_channel = aKentyTheme.Play (eAudioPriorityHigh, eRepeat);


Ok, I got it. The error you are having is because FIRST time you started playing a sound with High priority, and then you tried to re-start them using Normal priority. Since they did not override the first played instance of the clip, they return null.
#11246
Quote from: Ryan Timothy on Tue 01/10/2013 08:52:15
Mainly you should try to allocate any memory for your objects at load time.
Yes, I know. :tongue:

I was planning to revise those parts of code for a long time, but can't get to that yet.
There were other things that raise questions, like is it really necessary to redraw things so often as AGS does (about every time you move mouse around); this may be related to how software renderer works though...
#11247
Quote from: tzachs on Tue 01/10/2013 08:27:56
Basically the garbage collection runs repeatedly in a separate thread, which is good, but, if it sees it's low on memory it will do an "emergency" garbage collection on the UI thread which causes slowdowns.
The only reason I do not like automatic garbage collectors: you never know when they decide to start working hard :P.

PS. Can't watch the youtube video right now, maybe later this day.
#11248
@Radiant:
I was half-asleep when writing last posts here yesterday. Now when I am awake, I clearly remember, that the text and portrait were never removed before voice clip has finished.

In PM you wrote:
Quote
The issue is as follows. In a game with Sierra-style portraits (not the full-screen type) and a voice pack and standard SetSkipSpeech timeout, currently the portrait animation plays for an amount of time based on the length of the text string, whereas the portrait is visible (in still frame with closed mouth) for the amount of time the voice sample plays.
Meaning (if I understood correctly): the text & portrait remain visible, but animation stops too early.
If this is the case, it is indeed fixed with the latest beta.
And, yes, this was caused by "play.close_mouth_end_speech_time": because it caused animation to stop by 10 game loops (by default) before the text timer runs out (which could run out before voice stops).

If you are getting different problem, that is - portrait dissapears before voice has finished - this is something I never experienced in AGS, and might be something completely different...
Please, clarify, what is happening?
#11249
Quote from: Ryan Timothy on Tue 01/10/2013 06:25:52
The only other thing I can warn you about is the garbage collector. It's a beast and can kill almost any simple game on the phone. Avoid any looping occurrences of creating and disposing of objects; aka: temporary objects.
Does this refer to C++ objects as well? To my shame I have no idea how the Java wrapper (?) works with underlying C++ program. Does it put everything engine creates on managed memory too?
Because, actually, engine does create (and re-create) number of objects (e.g. temporary bitmaps) during running/drawing routines.
#11250
EDIT: Hmm, no, I was thinking about different thing... I should look into this again.
EDIT2: Sorry, I am a bit sleepy right now. For some reason I thought I fixed that ... maybe I did? Heh. Better check it.
EDIT AGAIN: Erm, I think this actually should have work properly in 3.2.1. Are you sure it is the problem you are getting?
Whenever I tested the speech, the text & portrait stayed until voice ends. It is animation that could be stopped too early.
#11251
JJS should know better about this, but I think OpenGL graphics driver should be enabled for Android port. Are you running games with Software renderer or OpenGL?
#11252
Quote from: Radiant on Tue 01/10/2013 00:02:10
Could you let me know about the issue we discussed in PM, about speech with a voice pack animation time depending on the length of the text string, instead of on the length of the voice sample?

It is already fixed in this release:

Quote
- Fixed play.close_mouth_end_speech_time variable from making effect in voice mode and Sierra-style speech (which it wasn't supposed to do).

(That could be also fixed earlier by setting this variable to 0)
#11253
AGS 3.3.0 BETA 8 released (engine version 3.3.0.1144)
-------------------------------------------------------
Hopefully, the last Beta before the Release Candidate. Unless bugs are found, my only TODO is updating documentation.

-------------------------------------------------------
Changes from BETA 7:

Features:
- Increased maximal Font number from 15 to 30;
- Proper alpha blender for blending two 32-bit sprites with alpha channels. Used for:
  a) GUI controls
  b) Cursor crosshair sprite
  c) DrawingSurface.DrawImage()
  For gui set "Visual: GUI alpha rendering style" setting to "Multiplied Translucence, Blend Colors".
  For the last two ones set "Visual: Sprite alpha rendering style" setting to "Improved".
- Improved character walking at 60%-80% scaling (courtesy of Alan v. Drake).
- New function in the Dialog class:
Code: ags

/// Manually marks whether the option was chosen before or not.
void SetHasOptionBeenChosen(int option, bool chosen);

- New properties in the Speech class:
Code: ags

/// Stop speech animation this number of game loops before speech ends (text mode only)
int             AnimationStopTimeMargin;
/// Gets/sets extra time the speech will always stay on screen after its common time runs out
int             DisplayPostTimeMs;


** WARNING **
Deprecated one variable from "game" object:
Code: ags

int game.close_mouth_end_speech_time; // use Speech.AnimationStopTimeMargin


Compatibility:
- Properly handle null Strings passed into various formatting functions (Display, etc) for games built with AGS 3.1.2 and lower:
  In older versions of AGS engine printed "(null)" in such case; AGS 3.2 and higher raises error.
(This change is mainly important for the users of AGS ports, who cannot run originally built games)

Bug fixes:
- Fixed crash in the Editor, that occured when user added or deleted objects in room, then loaded another room (regression);
- Fixed "Output", "Call Stack" and "Find Results" panes, which had a pane's drag handle overlay the report table's header when in docked position;
- Fixed sprite lookup in folders, differing only by name case;
- Fixed text color for WFN fonts (regression);
- Fixed error which took place when user restored a game saved with background music playing, in case the music is not found in resources anymore;
- Fixed audio behavior during cutscenes (error caused audio volume to reset to default). Also AudioChannel.Volume will now return correct value when called from skipped cutscene.
- Fixed play.close_mouth_end_speech_time variable from making effect in voice mode and Sierra-style speech (which it wasn't supposed to do).


Templates:
- Fixed "Default Game" template to be compatible with 3.3.0;
- Updated "MI 9 verbs" template by abstauber;
- Added "Lightweight BASS" template by Ghost.

Download links (also updated at first page):
EXE:
http://www.adventuregamestudio.co.uk/betas/AGS-3.3.0-beta8.exe
ZIP:
http://www.adventuregamestudio.co.uk/betas/AGS-3.3.0-beta8.zip
#11254
Quote from: rickious on Mon 30/09/2013 20:28:50
when you say 'call', how do i do that?  :-[

"Call" = "Call function" (programming/scripting term) = write function name with parameter list between opening and closing brackets.
Examples:
Code: ags

RestoreGameDialog(); // no parameters expected, hence nothing between brackets
SaveGameDialog();
float x = Math.Cos(1); // "calling" cosin function

#11255
Advanced Technical Forum / Re: Music jitter
Mon 30/09/2013 17:57:11
AGS 3.3.0 currently incorporates threaded audio (i.e. all audio run on a separate program thread, which may decrease load on the process) that JJS initially made for one of his ports (PSP?), although I don't know much details and how well it may improve audio perfomance on Windows. Maybe we could make a test?
#11256
Quote from: Construed on Mon 30/09/2013 09:50:44
What I was trying to achieve is a random factor to the damage, you see:   int dmg2 = Random(4);
and I was trying to assign a different damage to each of the 4 random results.
So that one time he may hit you for 3, the next time for 1 etc...
I don't understand how: health -= dmg2 + 1; could change the value of those 4 random results.
But I took you guys word for it because I suck at coding and math.

Hmm, it is not a good idea to just believe into this ;).
To be honest, I do not fully understand why this causes confusion, but I'll try to elaborate.

You are getting a random factor "dmg2", which may take a value from the range of 0 - 4.
Then you are decide how much health to subtract, depending on dmg2. This means, that you are getting another value, let's call it "minus_health". We may present things this way for simplicity:

Code: ags

int dmg2 = Random(4);
int minus_health;

if (dmg2==0)  minus_health = 0;
else if (dmg2==1) minus_health = 2;
else if (dmg2==2) minus_health = 3;
else if (dmg2==3) minus_health = 4;
else if (dmg2==4) minus_health = 5;

health -= minus_health;


So, what you do is making a rule of relation between dmg2 and minus_health values (which way minus_health depends on dmg2).
What kind of rule it is?
If you look closer, you may notice that whichever dmg2 is, the minus_health is 1 larger:
- if dmg2 = 1, then minus_health = 2;
- if dmg2 = 2, then minus_health = 3;
etc
So, we may write this as a formula:
Code: ags

minus_health = dmg2 + 1;
health -= minus_health;


There is only one case when this relation is broken: if dmg2 = 0, then minus_health = 0 too; that's why we add an exception:
Code: ags

if (dmg2 == 0)
    minus_health = 0;
else
    minus_health = dmg2 + 1;
health -= minus_health;


Now we remove separate minus_health variable and simplify this even more:
Code: ags

if (dmg2 == 0)
    health -= 0;
else
    health -= dmg2 + 1;


Because there's no sense in subtracting 0, we simplify this even further:
Code: ags

if (dmg2 > 0)
    health -= dmg2 + 1;

#11257
Simple BASS template: Lightweight BASS
Extended template with some extra functionality: Extended ALARCOST
#11258
1. Wood Chips?
#11259
I tried the template, and want to mention few things.

1. When hovering the mouse over character, the icon displayed is "Interact". Maybe change it to "Speak" icon (unless this is a strict design rule)?
2. Perhaps the inventory "tab" could be made little larger? Since the inventory itself is rather wide, player might need to first move mouse to the very top-left corner of the screen, then move it back to select item in the rightmost part.

3. If there's no "Readme.txt" in the game folder, the game crashes with "null pointer" error:
Code: ags

   File*output = File.Open("Readme.txt", eFileRead); // reads the file under the Compiled folder
   String readmetxt = "";
   String temp;
   while (!output.EOF) { // make sure there's a "Readme.txt" in the Compiled folder

Thing is that if there's no file opened, the "output" pointer remains 'null'.

I also noticed that there are numerous commented out parts of the code. Are these left on purpose (so that developer could uncomment them to get an optional functionality), or this is an old version of the code that don't work anymore?
#11260
Just a note, by Radiant's request, I am adding "Dialog.SetHasOptionBeenChosen(int option, bool chosen)" to AGS 3.3.0.
SMF spam blocked by CleanTalk