Author Topic: Introducing Flag Quest! (includes 'move.straight' and custom status demos)  (Read 1445 times)

0 Members and 1 Guest are viewing this topic.

Offline AGKorson

In another thread, I was asked about the custom algorithm I created to move objects in a straight line, instead of AGI's default (that moves objects diagonally, then horizontally).

To demonstrate how it actually works, I created this little demo game - Flag Quest.


Flag Quest is a simple arcade-style game, where the object is to collect the flags on the screen while avoiding bombs that are shot at you by a roving saucer.

To play the game, you'll need your own interpreter files. It needs to be a version that supports menus and multiplication/division (MSDOS version 2.411 or higher on DOSBox). I haven't tested it on NAGI or SCUMMVM, but I think it should work just fine on those platforms too.

The bomb object (I guess I could have called it a missile, but I'm not much of an artist, and a simple pulsating 'bomb' graphic is about the best I could draw!) uses what I call the 'move.straight' custom movement method, instead of AGI's built-in 'move.obj' method. This custom method moves the object in the straightest possible line, so it looks more natural on the screen.


I developed this algorithm independently, but it is basically an implementation of the Bresenham line-drawing algorithm (which I only recently learned of). It uses signed 16-bit integer math to do the calculations that control the object movement. This means that some math 'tricks' are necessary to get AGI's unsigned 8-bit variables to mimic 16-bit signed numbers. The source code contains a lot of detailed comments explaining exactly how to do it.

The game also includes a detailed example of the custom status line feature that I discussed in this post. It's actually pretty easy to create any kind of status line that you want. Again, detailed comments are in the source code.

Speaking of the source code, Flag Quest was developed on WinAGI, so if you want to open it in AGIStudio, you will need to add include statements for the globals.txt file and reserved.txt file to every logic (WinAGI does that automatically). With a bit of minor tweaking, you should be able to get a version of this to compile in AGIStudio. But of course, because it's so much better, I'm sure you'll just use WinAGI anyway! :-)

In addition to the source code, I'm also attaching a copy of just the game files, if all you want to do is play the game without looking at the source code.

If you have any questions at all about how either technique ('move.straight' method and custom status line) works, just ask! I'd be happy to answer any questions!.

Oh, and if you encounter any bugs in the game, let me know! I did as much testing as I could, but it's always hard to get all the bugs out without an extra set of eyes doing the testing.

Enjoy! (And post a screen shot of your highest score. I'm curious to see that - I haven't made it past level 5!)

« Last Edit: March 09, 2022, 03:34:47 PM by AGKorson »



Offline doomlazer

This is a fun little game. If I had one suggestion it would be to bind the actions to single key presses such as 1, 2 & 3 in addition to the existing controls. It's difficult for me to switch to the dodge reliably and my hand cramps up using Alt+F so much. Maybe that's not possible in AGI though.

Great proof-of-concept. My high score was only 60 points :(
« Last Edit: January 18, 2022, 08:41:26 PM by doomlazer »

Offline AGKorson

This is a fun little game. If I had one suggestion it would be to bind the actions to single key presses such as 1, 2 & 3 in addition to the existing controls. It's difficult for me to switch to the dodge reliably and my hand cramps up using Alt+F so much. Maybe that's not possible in AGI though.

Great proof-of-concept. My high score was only 60 points :(

Thanks for the feedback! Changing/adding to the keypresses is actually quite easy. If you have WinAGI, you could even do it yourself!

Are you suggesting '1' for 'getflag', '2' for 'duck' and '3' for jump?  If so, I can add them as options, and update the game files very quickly.


Offline doomlazer

Yes, I think those key bindings would work well. I'd like to find time to load it up in WinAGI and read through the source files - just haven't gotten there yet. TY!

Offline AGKorson

Here is a new version that adds the '1', '2', '3' keys as alternates for the get-flag, duck and jump commands and fixes minor restart bug that doesn't display score correctly.
« Last Edit: January 20, 2022, 11:27:45 PM by AGKorson »

Offline doomlazer

Much easier to control in my opinion and I understand the jump and duck mechanic better. The timing is still tricky, but it can save you in a pinch now that I can use them reliably. I'm going to read through the source comments tonight as I'm interested in learning more about both AGI and assembly. Cool project!

Edit: There does seem to be a score bug; after clearing stage one and getting the end of level bonus, when the game is restarted, flags become worth 10 points each according to the status bar. If you open the menu, to adjust speed for instance, the status bar starts displaying the score correctly again.
« Last Edit: January 20, 2022, 08:10:04 PM by doomlazer »

Offline AGKorson

Good catch. It's because the score drops from two digits to one. The ones digit from the previous score wasn't being erased, so you are seeing the correct single-digit score with the old ones digit from the previous score. If your score goes to 10, it will 'self heal'. I hadnn't anticipated scores going down in value (which is exactly what a restart does!)

It's an easy fix. I replaced zip files above with version 1.0b, which does fix the problem.

Offline Cloudee1

Re: Introducing Flag Quest! (includes 'move.straight' and custom status demos)
« Reply #7 on: February 10, 2022, 10:54:03 PM »
To play the game, you'll need your own interpreter files. It needs to be a version that supports menus and multiplication/division (MSDOS version 2.411 or higher on DOSBox). I haven't tested it on NAGI or SCUMMVM, but I think it should work just fine on those platforms too.
That's a negative on SCUMMVM, the message appears that menus need to be supported. I also gave it a whirl with nagi, but I am short a dll, that's probably just my own issue. Dosbox got me there in the end.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline AGKorson

Re: Introducing Flag Quest! (includes 'move.straight' and custom status demos)
« Reply #8 on: February 11, 2022, 11:08:02 AM »
To play the game, you'll need your own interpreter files. It needs to be a version that supports menus and multiplication/division (MSDOS version 2.411 or higher on DOSBox). I haven't tested it on NAGI or SCUMMVM, but I think it should work just fine on those platforms too.
That's a negative on SCUMMVM, the message appears that menus need to be supported. I also gave it a whirl with nagi, but I am short a dll, that's probably just my own issue. Dosbox got me there in the end.
Yeah, I see what I did. In an early version of this, I didn't bother with the version check, figuring the players would have to be responsible for using the right interpreter. But I decided to be 'clever' and use a technique I learned that will dig into the program's code and determine the version number, but that only works for the original MSDOS files; not for newer interpreters.

If you really want to play on SCUMMVM or NAGI, just comment out the line 'call(lgc.VersionCheck);' in the main logic (lgc.Main) and recompile. I haven't tested it yet, but I'm confident that's all it would take to let it run in SCUMMVM or NAGI.

I'll post an update that provides improved checking soon.


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.041 seconds with 22 queries.