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

#21
Hi!

I noticed that the RawRestoreScreen function is awfully slow.
Check out these frame dropoffs on my P4 2,4GHz (at 640x480):

8-bit:      390fps -> 280fps
16-bit:      200fps -> 145fps
32-bit:      100fps -> 75fps (even 45fps in a scrolling room of mine!)

Now imagine the framerate on slower computers...
All this by using a single RawRestoreScreen in the rep_ex, nothing else!

It's not surprising, I guess, since it has to copy an entire background image back onto the screen, right?

But most plugins don't seem to have this problem. Is it because they have direct access to the Allegro library functions? (I'm no programmer, so I'm sorry if I get this all wrong.)
If so, has the RawRestoreScreen function the potential for speed improvements in the future as well?

Since I suppose most of the time RawRestoreScreen is used just to clear the screen, how about this:
An additional layer/overlay of some kind in front of the background image. The rawdraw functions could draw upon this layer and a RawClearScreen(0) for example could simply wipe this layer clean?

There are so many sweet things that can be done with the RawDraw functions, it would be a shame not to use them because of speed issues of a single function.

Thanks for reading. :)
#22
Here's an example:

Global script

struct Type1 {
   int list;
   int position;
};
Type1 letter[2];

struct Type2 {
   int entries[20];
};
Type2 lists[10];

on_key_press

// init values for this example
letter[1].list = 1;
letter[1].position = 5;
lists[1].entries[5] = 666;

int result = lists[letter[1].list].entries[letter[1].position];
Display("%d", result); // returns 0

int templist = letter[1].list;
int tempposition = letter[1].position;
result = lists[templist].entries[tempposition];
Display("%d", result); // returns 666

It's not a problem since there's an easy workaround, but I'm curious as to why it behaves this way?

EDIT: Fixed since v2.62 Beta 1
#23
Currently, ambient sounds are replayed from the beginning if you use PlayAmbientSound to play the same file (when re-entering the room for example, with game.ambient_sounds_persist=1).

If you PlayMusic the same music file, it just continues playing.
Would it be possible to do the same for ambient sounds?

Thank you!

EDIT: Fixed since v2.61
#24
Is it possible to return the sprite slot of a frame in a view?

I've emulated the functionality of the rain plugin, but in order to draw the raindrops in front of the player character I have to hide him (with SetCharacterTransparency(EGO, 100) to retain interactions) and rawdraw his frames onto the background before drawing the rain over him:

// curslot = a whole lot of else-ifs here :(
RawDrawImage(player.x-(GetGameParameter(GP_SPRITEWIDTH, curslot, 0, 0)/2), player.y-GetGameParameter(GP_SPRITEHEIGHT, curslot, 0, 0), curslot);
// draw rain here

It would be a lot easier if I could just do

curslot = GetSpriteSlot(player.view, player.loop, player.frame);

Maybe if GetSpriteSlot returned a negative value for flipped frames, RawDrawImage could draw them flipped as well?
(Edit: AGS v2.71 RC 1: Added GP_ISFRAMEFLIPPED option to GetGameParameter.)

If not a seperate function, how about an addition the GetGameParameter function (GP_SPRITESLOT - Returns sprite slot number of frame DATA3 in loop DATA2 of view DATA1)?
(Edit: AGS v2.61 RC 1: Added GP_FRAMEIMAGE option to GetGameParameter.)
#25
Check out this demo.

Click on the marked spot on the bg. The character will walk from a scaled walkable area onto a non-scaled walkable area.
He will walk to the spot, stop, but keep animating, sometimes up to 2 seconds!

EDIT: Fixed since v2.61 RC 1
#26
If you assign (footstep) sounds to a character view, shouldn't they be less audible the farther he is away?
#27
Is there a way to return the relative (320x200-scale) width and height of the screen?

I have a function that includes continously setting the viewport around a point that is moving about the room:
SetViewport(x3-160, y3-120);

I'd like to replace the 160 (320/2) and 120 (240/2) as to make the function resolution-independent, so it can easily be pasted into any project.
The game.room_height and game.room_width variables return the wrong values in scrolling rooms.

EDIT: Added in AGS v2.61 RC 1: New variables system.viewport_width and system.viewport_height. Thank you!
#28
Hey there.

I wrote a function with which I intend to properly display accented characters with an SCI font. As you may know, this is currently only possible with a True Type font or by replacing existing characters in a SCI font.

With this method you wouldn't have to replace any existing characters, but can use the (nearly) empty slots 1-31 for accented characters (and probably slots beyond 126 in later AGS versions).
For example, this means that translators won't have to use characters like } for é when translating your game but can actually put the é in the text. And so could you in your code.

Of course for this to work, every string has to be treated with the above function before it is displayed on the screen, otherwise the game will halt if an extended character is to be used.

To make a long story short, I'd like to compile a list of accented and/or special characters that are used in your native language, with the most important characters on top and the least important on the bottom.
This way someone creating a custom font will know which characters are the most important for a given language and which ones can be ignored if necessary.

Lists of the accented characters themselves are found aplenty on the net, but no indication of how important a character is for a particular language.
For example, what are the spanish ¿ and ¡ used for and how important are they?

I'll start with my native language:

German
Ã,,,ä,Ö,ö,Ü,ü // pretty important, but can be expressed Ae,ae,Oe,oe,Ue,ue if necessary
àŸ // not as important, can be expressed ss
#29
Surprisingly, I couldn't find an earlier thread or a mention in the docs for this, so I don't know if this was asked before:

My inventory is on the screen the entire time.
I'd like to have my mouse cursors animate (>1 frames) not only when over hotspots or objects, but when over inventory items as well.
A function like AnimateMouseCursor to manually trigger the animation would be helpful.

This way it would also be easier to make the cursor animation in general depend on whether there is actually an interaction defined for the current cursor mode.
#30
SkipUntilCharacterStops is called with a doubleclick and a sound is played when you do, so this should be working:

When no other character is in the room or he is not moving or animating, EGO jumps to the mouse coordinates immediately, EVERY TIME, as it should be.

But when other characters move or just their idle animation plays, SkipUntilCharacterStops doesn't seem to work SOMETIMES and EGO just walks to the mouse position.

Check out this demo.

Double-click around the room several times.
Then try again after you removed the line from repeatedly_execute and reset GUY's idle animation to 0.
Notice the difference.

The manual for SkipUntilCharacterStops states: "Skips through the game until the specified character stops walking, a blocking script runs, or a message box is displayed."
There aren't any blocking calls in this demo, are there?

EDIT: Fixed since 2.61 Beta 6.
#31
How do I hide a string from translation? I can't find a function like SkipTranslation(string text) or something.

Fixed since 2.61 Beta 5:

"Make translation source..." outputs the default names of my hotspots (No hotspot, Hotspot 1, Hotspot 2, etc.).

Couldn't AGS just skip the default names? I'd like to keep the translation file as compact as possible.

Thanks
#32
The character [ is normally used to indicate a line break in strings, e.g. "Here comes [ a line break".

But how do I mask the character so it is displayed in dialogs/messages?

\[ doesn't work, nor does \\[ or /[

Edit:

AGS v2.7 Beta 11:
Quote* Added \[ to Display/Say/etc, to enable you to display the [ character rather than it doing a line break.
#33
Hi again!

I'd like to express my interest in the implementation of walk-to points for objects. They are mentioned in the future.txt so this must have been requested before.
I would rather use GetObjectPointX and GetObjectPointY than having to write fixed values in my code.

Thank you!
#34
Hi!

Is there a particular reason why SetDefaultCursor doesn't work after the mouse cursor has been changed with ChangeCursorGraphic?
It seems to work with the SetMouseCursor function only.

Currently I simply use another ChangeCursorGraphic to change the cursor back, but I'd like to use as little code references to sprite slots as possible.

Thanks
#35
I think a dialog script command like "option-off 0" to turn off the dialog startup after the first time would be very useful.
It was first mentioned in this thread in the beginner's forum.

Thanks.
#36
Would it be possible to let AGS check not only for music1.mid but also for music001.mid and so forth?
I'd like to name my files this way so the directory doesn't look like

music1.mid
music11.mid
music2.mid
sound1.ogg
sound11.ogg
sound2.ogg

Another suggestion: I suspect many beginners have the default Windows option "Hide file extensions for known file types" enabled.
When we tell them to name their files music1.mid, I imagine they rename it to music01.mid.mid actually and it won't play.
Could AGS compensate for that, i.e. check for .mid.mid etc. as well?

Thanks
Chris
#37
Hi!

I use this code

   int volume=0;
   PlayAmbientSound(1,12,255,0,0);
   SetChannelVolume (1,volume);
   while (volume<255) {
   volume=volume+3;
   SetChannelVolume (1,volume);
   Wait(1);
   }

in "Player enters screen (after fadein)" to fade in the ambience channel (rain starts falling).
It works basically, but there are artifacts introduced while doing this (listen to it here).

I had the same problem when trying to use a slider to set the ambience channel volume in my settings gui (with another ambience sound).
The sounds are uncompressed wave files, I use AGS 2.6 SP1, Win2k & SBLive! 1024 Player.

Strangely, this affects the ambience sounds only.
Does anyone else have this problem?
#38
Aside from all the great ideas and scripts I've found after browsing through the whole beginners and technical forum, I noticed the small things either not in the manual or easy to miss.
I've just sorted through my notes and thought I'd post what I've found, maybe some of you will find this useful at some point or another:

1.) RickJ: "The character's global inventory variables are integers and can be used to keep track of how many items the character has."
Thread

2.) inFERNo: "...every interaction in the [interaction menu] list is executed first, the run script always when all others are done."
Thread

3.) CJ: "RunInventoryInteraction (...) doesn't get run immediately - instead, it gets run when the calling script finishes."
Thread

4.) CJ: "Local room scripts have their data segment saved when the room is destroyed, so all variables retain their values.
I would recommend placing variables that are only needed by one room into that room script, in order to avoid clutter in the global script."
Thread
Comment: Useful to store the condition of a light switch, for example.

5.) CJ: "To totally revert to default fonts, close AGS and then delete any agsfntXX.wfn or agsfntXX.ttf files from the game folder."
Thread

6.) CJ: "(...) to ensure [the pathfinder] always works, your walkable areas should always be at least 3 pixels wide."
Thread

7.) Gilbot: "Sprite datas are always stored in the basic executable, the splitted resources only contain room data."
Thread

8.) CJ: "The maximum room height is 1400 pixels (at 320x200 resolution - you could have a 2800-tall 640x400 room)."
Thread

9.) CJ: "(...) in fact, [calling game.exe --setup] is all that the winsetup.exe program does."
Thread

10.) CJ: "You can rename winsetup.exe to anything you like, it will still work."
Thread?

11.) CJ: "(...) AGS doesn't actually use [Media Player] itself [to play avi videos], but it uses the same [DirectShow] that MP does."
Thread

12.) CJ: "(...) ReleaseCharacterView doesn't change the loop number back, so he will go to facing in whichever direction the loop that was playing in the animation was."
Thread

13.) CJ: "FaceLocation will only allow [a character] to face directions which he can actually walk in."
Thread

14.) CJ: "FaceCharacter/FaceLocation don't update the screen, you have to put a Wait(1); afterwards if you want that to happen."
Thread

15.) ???: "When using a NewRoom() or NewRoomEx() (...) AGS finishes the remaining lines in the script and then goes to the new room.
You can use 'return;' to abort the rest of the script.
____NewRoom(5);
____return;
will prevent the rest of the script running first."

16.) Scorpiorus: "(...) the [RunDialog command] is always started last."
Thread

17.) Scoriporus: "(...) [if music disabled or no sound card] GetMP3PosMills() always returns 0 (...)"
Thread

18.) ??? "(...) (music, sprites) are left 'as-is', so it's a good idea to use MP3's where you can."


The following may be obvious to experienced programmers, but I find it worth mentioning:

19.) Character to mask quotemarks in strings: \
Example: Display("These are called \"quotemarks\" ");

20.) Character for a line break in strings: [
Example: Display("Adventure Game Studio [ [ Copyright 1995-2004 Chris Jones");


As you can see I have numbered all of the above so feel free to comment, confirm or deny in regard to newer versions.

Do you have anything similar to add?
#39
I have a problem with my custom quit gui. It displays like it should, but a click on either button or the GUI (!) quits the  game. ???
I've posted my entire interface_click function, maybe it helps. Quit gui code is at the bottom (--- added for indentation):

(Code removed to conserve bandwidth)

GUI number is correct (5) and button (object) numbers are correct (1 and 2). GUI is "Popup modal" and buttons are "Run Script".
I'm clueless.
#40
Hi!

I tried to play Permanent Daylight the other day, but it wouldn't work with Win2k, since it was compiled for DOS apparently.

Renaming "daylight.exe" to "ac2game.dat" and trying with the latest acwin produces

Invalid file format. The file may be corrupt, or from a different version of AGS.
This engine can only run games made with AGS v2.5 or later.


Via "daylight.exe /?" I found out it was compiled using AGS 2.15 SR-2.
Can anyone provide me with said version of acwin.exe?

Thank you
Chris
SMF spam blocked by CleanTalk