Jetstar Forever

Programming and Game Development

The Introduction!

Posted by jetstarforever on March 27, 2008

Hello everyone! I’m a 15-year-old computer programmer from a small country town in Indiana. Normally, you’d think I’d be busy hauling hay or doing typical farm-stuff; not true! Although I do enjoy physical activity (unusual for computer nerds) I also enjoy wading knee deep in code and game development fury! I’m currently in between using C++ and Game Maker. Yes, I know, Game Maker is frowned upon as the evil of the entire programming world, but I swear to you, this time it’s different. For now on I will record my progress and post code snippits from my game Zonerunners, and small helpful hints on proper Game Maker usage.

Day 1: 7:34 PM 3/26/2008

It’s been awhile since I started Zonerunners, but it’s never too late to start showing people the guts of the game without confusing them! I’m currently on Prerelease Version 2, which may not seem like much, but is actually a huge step forward into the game engine and theory. Right now I guess you could say that I’m finishing the A.I., basically doing a lot of polish to make it like good enough to release.

One of the biggest problems I’ve had with Zonerunners is the fact that most of the engine was new territory. I had never really went in depth into a platform engine until now, okay, I had messed with a few before, but never really went all that far into them. So as you can see from some of these code snippits the code is still rough since the focus has been on the A.I. since the beginning.

if tar=false{
if _y<300 and scan=1 {_y+=10} if tar=false and scan=1 and _y>=300 {_y=-300;scan=1}
switch (clan){
case "TESTERTOASTER":
for (t=1; t<=test[0,0]; t+=1){if distance_to_object(test[0,t])<=viewdistance{tarid=test[0,t];tar=true}}
break;
case "QWERTY":
for (t=1; t<=null[0,0]; t+=1){if distance_to_object(null[0,t])<=viewdistance{tarid=null[0,t];tar=true}}
break;
}
}

The above is from the main A.I. script, called ai_seek(). What this does is check to see if the object calling has already targeted something, and if not, find one by searching a list of enemies that are stored in an array depending on which “clan” the object is in. Each clan has an array of enemies, which are added to the array once they engage in some form of combat with a member of the clan.

Next up is a very very simple “console”. If you’ve ever encountered a console in a game you know what I mean. For those who don’t: It’s basically a text box from which you can execute/modify values from.

exec=string_delete(argument0,string_pos("(",argument0),string_length(argument0))for (i=1;i<=com_array[0];i+=1){
if exec=com_array[i]{
execute_string(argument0)
}
}

This console is called con_exe() (short for Console Execute) . What this does is takes the argument and checks it against an array of valid commands. But since most arguments would be along the lines of “move_object_to(100,200)” I have the string_delete() command automatically cut everything after the first “(” at which point a FOR loop checks the modified command against the previously mentioned array of commands. If the FOR loop detects a valid entry the unmodified argument is executed with execute_string().That’s all for today!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>