HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Analysis of Game Messages

01-10-2007, 02:47 PM#1
Anitarf
I have recently done a lot of experiments with game messages. This thread is meant as a repository of my findings, as well as some general information about game messages.


Game messages are messages you display on screen with the Game - Text Message GUI trigger actions or JASS natives like DisplayTimedTextToPlayer(). They are typicaly displayed in the bottom left corner of the playable screen, however with JASS functions, you can specify an offset from that point at which to display the game message. Here, the tricks begin.


If you display multiple game messages one after another, the earlier ones will be pushed up as new ones are displayed below them. Game messages therefore always appear in a "block", the oldest ones being at the top and the newer ones at the bottom. Whenever you specify coordinates for your game message to be displayed at, the whole block gets moved to those coordinates. This means you can't display game messages at independant positions on the screen.

Another problem with the offset is that it does not accept negative values. This means you can't display game messages lower than the height they normaly appear at, which is at coordinates 0,0. This leaves a notable ammount of room on screen that can't normaly be filled with game messages, however a trick was discovered that supposedly allows this.

The last oddity about offsets is that they work differently for game messages displayed at map initialization. In game, an x (horizontal) offset of 2.4 would push a game message almost off-screen, however if the same game message is displayed at map initialization, the same result is achieved with an x offset of 0.82.


Excessive use of game messages can cause the game to lag horribly. The cause is unknown, I discovered this in a map where I displayed 200 game messages per second, after a minute or two the lag became very noticeable. As long as you don't use game messages with very fast periodic triggers, this isn't a problem, though. For example, an AoS map that uses game messages to display notifications about hero kills and tower kills would probably use less than 100 game messages in a whole game.


Game messages have a fixed width, which is about 2/3 of the screen. Any game message longer than that is displayed in multiple lines. The ammount of characters that can be displayed in one line varies, depending on their width. You can fill in many more "I"s than "W"s. Once a character breaks the line length limit, all the following characters are moved to the next line, so a line of "W"s can appear just slightly longer than a line of "I"s, since the last "W" can stretch further over the length limit than the last "I". This difference is not very significant, though.


The fonts used for game messages have a fixed width relative to the screen width, so the same game message should be equaly long no matter what resolution you use. This, however, isn't exactly the case. The width of individual characters is always rounded to the whole pixel. Because of this, it takes a different number of (for example) "M"s to fill a line in one resolution than in another.

I have done a lot of testing on this, in an attempt to be able to center game messages on screen no matter how long they were. I have documented for all characters of the english alphabet how many can be placed in a single line on four different resolutions. I am attaching the test map as well as the results (in an excel table) for anyone who might be interested.
Attached Files
File type: w3xSubtitleTestMap.w3x (17.5 KB)
File type: zipGame message font widths.zip (6.1 KB)
01-11-2007, 12:32 AM#2
Pyrogasm
Not that I'll ever use this, but I rep'd you for taking time to research these things. Where would we be without Anitarf to unravel the mysteries of Game Messages?
01-11-2007, 07:01 AM#3
blu_da_noob
You haven't seen the stuff he pastebin'd. Good job.
01-12-2007, 02:17 AM#4
Pyrogasm
Quote:
Originally Posted by blu_da_noob
You haven't seen the stuff he pastebin'd.
Oh boy...
01-12-2007, 11:03 AM#5
Toadcop
Quote:
200 game messages per second, after a minute or two the lag became very noticeable.
the problem must be in strings are they different ? such as I2S(GetRandomInt(0,100000)) ? because i had this lags then i was useing this func 1000 times per second (if less i must wait longer)
first time i have discovered this by gamecache storages (with peopdical interval like this). but then i have tested only string and it lags any way.

btw as for me it's nothing new... i know it long ago but ofc not all what you have write here.
GJ !
01-12-2007, 05:38 PM#6
karukef
No, my experience also suggests that even if you print the exact same string, it will start to lag if you print it often enough.