Difference between revisions of "AGIWiki/AGI Studio Template Game"
(Created page with "{{AGIWiki}} The '''AGI Studio Template Game''' is a one-room game that serves as a starting point for game authors to build their own games. It features a defau...") |
m |
||
Line 26: | Line 26: | ||
You know if your version of the template game contains the bug if the following code appears in LOGIC.000: | You know if your version of the template game contains the bug if the following code appears in LOGIC.000: | ||
<syntax type="C++"> | |||
if (new_room) { // First interpreter cycle in a new room | if (new_room) { // First interpreter cycle in a new room | ||
// Note: Everything other than logic 0 is discarded | // Note: Everything other than logic 0 is discarded | ||
Line 39: | Line 39: | ||
// on this cycle (if turned on) | // on this cycle (if turned on) | ||
} | } | ||
</syntax> | |||
If this code ''does'' appear in your version of the template game, then you should change it to: | If this code ''does'' appear in your version of the template game, then you should change it to: | ||
<syntax type="C++"> | |||
if (new_room) { // First interpreter cycle in a new room | if (new_room) { // First interpreter cycle in a new room | ||
// Note: Everything other than logic 0 is discarded | // Note: Everything other than logic 0 is discarded | ||
Line 59: | Line 59: | ||
// on this cycle (if turned on) | // on this cycle (if turned on) | ||
} | } | ||
</syntax> | |||
This bug has since been corrected in the template game that is available from http://www.agigames.com<nowiki>; however, </nowiki>[[AGIWiki/AGI Studio|AGI Studio]] may still be packaged with the version containing the bug. | This bug has since been corrected in the template game that is available from http://www.agigames.com<nowiki>; however, </nowiki>[[AGIWiki/AGI Studio|AGI Studio]] may still be packaged with the version containing the bug. | ||
Line 67: | Line 67: | ||
The biggest trouble with this bug is that once you type "tp" and press Enter there is no way to cancel the teleport. Pressing Enter with a blank entry is the same as entering 0. Fortunately, there is a simple fix. In LOGIC.099, find the code that reads: | The biggest trouble with this bug is that once you type "tp" and press Enter there is no way to cancel the teleport. Pressing Enter with a blank entry is the same as entering 0. Fortunately, there is a simple fix. In LOGIC.099, find the code that reads: | ||
<syntax type="C++"> | |||
if (said("tp")) { | if (said("tp")) { | ||
get.num("new room: ", v255); | get.num("new room: ", v255); | ||
new.room.v(v255); | new.room.v(v255); | ||
} | } | ||
</syntax> | |||
Then change it to: | Then change it to: | ||
<syntax type="C++"> | |||
if (said("tp")) { | if (said("tp")) { | ||
get.num("new room: ", v255); | get.num("new room: ", v255); | ||
Line 85: | Line 85: | ||
} | } | ||
} | } | ||
</syntax> | |||
Alternately, you can eliminate the "Can't tp to room 0" message and change the inner [[AGIWiki/If statement|if statement]] to read: | Alternately, you can eliminate the "Can't tp to room 0" message and change the inner [[AGIWiki/If statement|if statement]] to read: | ||
<syntax type="C++"> | |||
if (v255Â != 0) { | if (v255Â != 0) { | ||
new.room.v(v255); | new.room.v(v255); | ||
} | } | ||
</syntax> | |||
This issue has also been corrected in the latest releases of the template game, available from http://www.agigames.com<nowiki>; however, </nowiki>[[AGIWiki/AGI Studio|AGI Studio]] may still be packaged with the buggy version of the template game. | This issue has also been corrected in the latest releases of the template game, available from http://www.agigames.com<nowiki>; however, </nowiki>[[AGIWiki/AGI Studio|AGI Studio]] may still be packaged with the buggy version of the template game. | ||
Revision as of 17:43, 17 February 2013
The AGI Studio Template Game is a one-room game that serves as a starting point for game authors to build their own games. It features a default view for ego, a blank picture resource that is used by the first room in the game, and a default inventory object.
Perhaps most importantly, the template game provides a significant amount of code that implements basic functionality such as setting up the game's menus, saving and restoring, and a set of [[AGIWiki/Debugging|debugging] commands. Without the template game, game programmers would have to implement these features themselves.
The template game also provides a file called [/agiwiki/index.php/Defines.txt defines.txt] that sets up defines for the special variables, special flags, and other data that are of special meaning to the interpreter or that are used by the template game itself. The game's author should use this file to avoid the need to redefine all those items.
Updates to the template game
Since the original version of the template game, there have been a few updates to make it even more convenient to use. Chris Cromer updated the template game to add a convenient debug menu, among other things.
Errors in the template game
Although the template game has been generally bug-free for a long time, from time to time, errors have slipped in. Some of these are not proper "bugs" but they nevertheless are worth mentioning.
input_recieved
The original template game misspelled the define name input_received
as input_recieved
. This is why programs such as the Base Logic Generator misspell the define name by default.
The spelling error was corrected in updates to the template game.
Memory leak on teleport (general)
During the attempts to update the template game with useful features such as a new debugging menu, a bug was inadvertently introduced that caused the debugging command "tp" to leak memory, eventually leading to an out of memory error.
You know if your version of the template game contains the bug if the following code appears in LOGIC.000: <syntax type="C++">
if (new_room) { // First interpreter cycle in a new room // Note: Everything other than logic 0 is discarded // from memory when new.room is executed load.logics(90); // Load game specific functions logic into memory clear.lines(24,24,0); // clear bottom line of screen (remove ego's coords if shown) animate.obj(ego); load.view.v(ego_view_no); set.view.v(ego, ego_view_no); observe.objs(ego); old_clock_seconds = 255; // make sure clock gets updated this cycle // on this cycle (if turned on) }
</syntax> If this code does appear in your version of the template game, then you should change it to: <syntax type="C++">
if (new_room) { // First interpreter cycle in a new room // Note: Everything other than logic 0 is discarded // from memory when new.room is executed load.logics(90); // Load game specific functions logic into memory if (debug_active) { load.logics(99); // load debug logic into memory } clear.lines(24,24,0); // clear bottom line of screen (remove ego's coords if shown) animate.obj(ego); load.view.v(ego_view_no); set.view.v(ego, ego_view_no); observe.objs(ego); old_clock_seconds = 255; // make sure clock gets updated this cycle // on this cycle (if turned on) }
</syntax> This bug has since been corrected in the template game that is available from http://www.agigames.com; however, AGI Studio may still be packaged with the version containing the bug.
Memory leak on teleport to room 0
While not properly a "bug," it is true that both the original and updated template games used to allow you to use a "tp" debugging command to teleport to room 0, which attempts to use logic 0 as a room. This causes memory leaks and can eventually lead to an out of memory error.
The biggest trouble with this bug is that once you type "tp" and press Enter there is no way to cancel the teleport. Pressing Enter with a blank entry is the same as entering 0. Fortunately, there is a simple fix. In LOGIC.099, find the code that reads: <syntax type="C++">
if (said("tp")) { get.num("new room: ", v255); new.room.v(v255); }
</syntax> Then change it to: <syntax type="C++">
if (said("tp")) { get.num("new room: ", v255); if (v255 == 0) { print("Can't tp to room 0"); } else { new.room.v(v255); } }
</syntax> Alternately, you can eliminate the "Can't tp to room 0" message and change the inner if statement to read: <syntax type="C++">
if (v255Â != 0) { new.room.v(v255); }
</syntax> This issue has also been corrected in the latest releases of the template game, available from http://www.agigames.com; however, AGI Studio may still be packaged with the buggy version of the template game.
Incorrect volume controls
The original versions of the template game attempted to control the sound volume by using the special variable v23
(or sound_volume
in the template game.
Counterintuitively setting v23
to 0 produces the loudest sound and setting setting v23
to 15 produces no sound. The original template game assumed that the volume increased as the value of v23
increased, but this is not the case.
This issue has also been corrected in the latest releases of the template game, available from http://www.agigames.com; however, AGI Studio may still be packaged with the buggy version of the template game.