Jump to content


Rick_Slick

Member Since 20 Jul 2005
Offline Last Active Jul 19 2010 12:53 AM

Topics I've Started

Command & Debug (ai War)

02 August 2009 - 05:14 PM

http://gmc.yoyogames...p...t&p=3246998

http://gmc.yoyogames...p...t&p=2630210

As far as I can tell, no one has taken me up on the idea, and I've been thinking about it lately so I'm going to take a crack at it.  The game as I envision it would eventually have a single-player campaign, sort of like the old Origin Systems Inc. game OMEGA where you start out with some basic chassis, shielding, armor, and weapons options (balanced by weight restrictions and cost), and then develop a simple AI for your units depending on the role you want them to play and their loadout, and then face-off in a 5 v 5 battle vs "computer" opponents on a very basic playfield sparsely populated with obstacles (see image below).

The heart of the game, however, would be a simulation mode (maybe you have to unlock this by winning the single-player game?) where cost is no object, and you can build whatever unit you want with whatever components you want, subject to weight restrictions, and develop and plug in your AI code.  Then you can import/export teams of 5 units (identified by their total cost so you can either put restrictions on cost for tournaments, or so you at least know the guy's team you're downloading doesn't have 5x better stuff than yours does, although I would imagine everyone would try to max their units out with the best equipment).  Then you battle the other person's team in the simulation to see how your units fare against his/hers.

I would develop the simulation mode first, since the battle simulation is the main part of the game, and would allow me to test different AI code in different units, plus would provide the greatest community response here I believe.  The AI code language would be similar in vein to Carnage Heart in terms on command structures, but instead of using icon based commands with a flow diagram, I was planning to allow the user to program in a linear fashion, with line numbers for labelling code, and allowing the user to branch to another line (like a GOTO statement) or even return from a subroutine call to give it a little more complexity.  Each command has a "cycle count" (i.e. repairing an ally takes longer to process than moving one space), and an energy draw (comparisons don't require any energy, but moving does).

Here are the list of commands/comparisons I think would be useful... I was wondering if anyone had any more ideas:

MOVEMENT:
MOVE(DIR) - moves one space forward, backward, left, or right (strafing)
TURN(DIR) - turns left or right 90 degrees
JUMP(DIR) - jumps two spaces forward, backward, left, or right (if jumping into an obstacle or boundary, receives damage)

DEFENSE:
FIRE(MAIN|AUX, WIDTH) - fires main or auxiliary weapon forward at a random angle within WIDTH (usually you want this to be 0)
MELEE - performs a melee attack forward, damaging any adjacent unit
SHIELD(DIR|DOWN) - raises/changes shielding to FRONT, BACK, LEFT, RIGHT, or lowers the shield
IF_DETECT? (E/A/P/M/O/N/B, RANGE, DIR, WIDTH) - Scan for Enemy/Friendly/Projectile/Missile/Obstacle/Mine/Boundary in specified direction, range, width of scan (0-180)

COMMUNICATION:
TRANSMIT(CHANNEL, NUMBER) - Broadcasts NUMBER on specified CHANNEL to adjacent friendly units
IF_RECEIVE?(CHANNEL, NUMBER, DIR) - Check if received NUMBER on specified CHANNEL from specified direction (AHEAD, BEHIND, LEFT, RIGHT)

ABILITIES:
JAM(DIR) - attempts to jam a missile in the direction specified (the closer the missile, the greater chance of success, but the direction change may not be enough)
REPAIR(DIR) - repairs a certain % of armor on adjacent unit if a repair module is in the equipment loadout
TRANSFER(DIR) - transfers a certain % of energy to adjacent unit if an energy transfer unit is in the equipment loadout
DESTRUCT - self-destructs the unit and creates substantial splash damage
BATTERY - recharges the main battery with energy if a batter is in the equipment loadout
RELOAD(MAIN|AUX) - reloads the main or aux projectile weapon if a ammo pack is in the equipment loadout

MISCELLANEOUS:
NOOP - doesn't do anything for 1 cycle
GOTO(LINE) - branches to the specified line number
RETURN - returns to the line following the last branch operation (either from a comparison or a BRANCHTO)
REMARK(TEXT) - allows user to type in a remark, does not take any cycle count (interpreter will process the next instruction as well, unless its another REMARK/TAUNT)
TAUNT(TEXT) - unit displays a user-defined taunt on the screen in a chat bubble, can also be used for error trapping, does not take any cycle count (interpreter will process the next instruction as well unless its another REMARK/TAUNT)
CT(A|B|C|D|E, OPERATION, NUMBER) - performs the specified OPERATION with NUMBER to value stored in register A, B, C, D, E
IF_CT?(A|B|C|D|E, COMPARISON, NUMBER) - performs the specified COMPARISON (<, =, >, <=, >=) against the value in the register and NUMBER
IF_ALLYS?(COMPARISON, NUMBER) - performs the specified COMPARISON (<, =, >, <=, >=) against the number of friendly units remaining and NUMBER
IF_ENEMIES?(COMPARISON, NUMBER) - performs the specified COMPARISON (<, =, >, <=, >=) against the number of enemy units remaining and NUMBER
IF_TIME?(COMPARISON, NUMBER)  - performs the specified COMPARISON (<, =, >, <=, >=) against the time elapsed in the skirmish and NUMBER
IF_RANDOM?(NUMBER1, NUMBER2) - checks if NUMBER1 is equal to or less than RANDOM(NUMBER2)
IF_AMMO?(MAIN|AUX, COMPARISON, PERCENT) - performs the specified COMPARISON (<, =, >, <=, >=) against the % of ammo remaining in the MAIN or AUX weapon and PERCENT
IF_ENERGY?(COMPARISON, PERCENT) - performs the specified COMPARISON (<, =, >, <=, >=) against the % of energy remaining and PERCENT
IF_ARMOR?(COMPARISON, PERCENT) - performs the specified COMPARISON (<, =, >, <=, >=) against the % of armor remaining and PERCENT

The language allows for considerable flexibility without being too complex, with some basic comparisons and variable setting options.  Plus, with various equipment loadouts, it lends itself nicely to developing AI for certain roles for your units... for example, you could load up on Explosive Charges (which increase the yield of detonation and splash damage when the unit is destroyed) and pair it up with an AI that starts out the match by jumping forward a bunch of times if there are no obstacles in front of it until it finds the first enemy and then self-destructs, hoping to take out a few more units with it:

001 REMARK // See if there is an obstacle within 2 spaces directly forward of the unit, if so, branch
002 IF_DETECT? (OBSTACLE, 2, 0, 0) GOTO(009)
003 REMARK // Otherwise, look for an adjacent enemy
004 IF_DETECT? (ENEMY, 1, 0, 360) GOTO(015)
005 REMARK // No enemy, and no obstacle, so jump forward
006 JUMP(FORWARD)
007 GOTO(002)
008 REMARK // Obstacle avoidance
009 IF_RANDOM(1,2) = 1 GOTO(012)
010 MOVE(LEFT)
011 GOTO(013)
012 MOVE(RIGHT)
013 GOTO(002)
014 REMARK // Enemy is adjacent, self-destruct
015 DESTRUCT

(The code assumes the unit will detect an enemy before it reaches the far boundary, and so it doesn't have any code related to handling that, but you get the idea...)

I'm looking for other instructions/comparisons I could add to the language without making it too complex.  Keep in mind during the game, I have to parse through one instruction at a time for up to 10 objects.  Or if you can think of other abilities that would be useful, that would help too.  Credits given.

Here's a mockup of the playfield

Here's the title screen :)

Can We Get Rid Of The B) Emoticon?

10 May 2008 - 04:25 PM

A) In a programming forum where we are consistently discussing functions like abs(A-B) it can get annoying, or

B) When we might have to enumerate some different items in a list, it also gets annoying.

Is there a compelling reason for this emoticon?  I frequently have to end up going back, edit the post, and turn off enable emoticons.  As far as I can tell in the user control panel, there is no way to default "enable emoticons" to NO, but maybe I missed it?

Re: Ignored Code

02 March 2008 - 09:36 PM

Well, considering I spent 10 minutes of my life replying to that only to find it locked after I hit "reply" (let alone how many times I got the "too many connections" error), here's my response in an effort to help pinpoint the problem:

 if keyboard_key_press(vk_space)

This checks for one press of the space bar.  So you press the space bar once and the code executes:

    gravity = 0.32;
     gravity_direction = 270;
     acceleration = 2;

     y-=gravity*acceleration/gravity/234+2;

This essentially sets gravity to 0.32, so you have an acceleration in the 270 direction of 0.32 every step thereafter.  In the meantime, you are decreasing y by (2/234 + 2) which is essentially 2.  So you move up 2 pixels when you press the space bar but the gravity is still applying a downward acceleration of 0.32 (unless you set it to something else outside of this construct.)

What I think you want is:

 if keyboard_key(vk_space)

So that your object rises as you hold down the space bar?  If not... I have no idea what you're attempting to accomplish in your code.  All it does is raise the object 2 pixels per press of the space bar, without repeating as you hold the space bar down.

To All Gm Beginners

20 January 2008 - 08:19 PM

(If this would work better as a sticky in the Novice section, feel free...)

Computer programming is more often an art rather than a science. You can read all the books on computer programming that you want, but unless you're one of those people that just pick things up right away, the only way you are going to learn computer programming is to sit down and do it. This means trying different things, reading through the tutorials, tinkering with existing code to find out what the effects are, adding your own code to get the desired effect, and so on. Just like you can't expect someone to read a book on how to repair televisions and then automatically know how to fix every television you sit in front of him, you can't expect to learn computer programming overnight. It takes time, patience, trial-and-error, experimentation, and a willingness to learn on your own. I would be willing to bet that some of the top game makers on this site who have completed some of the most popular GM games available are all self-taught. That doesn't mean they never came here asking for help with how to do something, but they most likely didn't have anyone spoon-feed them an answer either.

All too often, there are various questions on the Novice/Beginner forum where the user is trying to jump in head-first into a project that is too far beyond them, and then they become frustrated when no one can offer any help to their questions like "How do I make a pokemon game?" or "I need to know how to make my platform guy jump, move, shoot, oh and I need enemies to attack him... how do I do all that?" My typical first response is... have you looked at the tutorials? Have you read through the GM manual to get a feel for what DND/GML commands are available and how you might use them? Is this the right project to be undertaking for your skill level?

I'm not going to sit here and try to tell anyone that there is one complete and proper path to learning how to use Game Maker, but I can provide some insight as to how to become self-taught. There's nothing wrong with asking people how they would go about doing things if you truly don't understand, but do you really learn anything if someone spells out all the code for you? Sure, you might get your feature working, but what happens the next time you reach an obstacle that you don't have an answer for?

The first thing I did when I started programming on the ol' Commodore 64 (keep in mind this was 25 years ago) was I took existing programs and changed them around, with my face in the C64 BASIC Reference Manual. Tinkering and trial-and-error are the best ways to learn about the commands and what they do. Have the GM Manual handy at all times, and be familiar with how to search for information. There is also a very good guide linked on this forum somewhere regarding DND commands and their GML equivalents. While DND is a good place to start for users with very little programming experience, you will soon find yourself limited and you will want to learn GML and its syntax soon thereafter to provide more functionality and fancier features in your game.

This means you look at the tutorials that came with Gamemaker and understand how they work. Can't figure out how to make your player move back and forth across the screen? It may not be the best thing to run here and ask a question that you could have figured out on your own and learned something in the process... because you'll be right back here again when you need to figure out how to make your player rotate. Check out the player object in one of the tutorials and read over the code that performs that function. Tinker around with it. Change some values. Run the game again to see what the effect was. Download another engine/tutorial and see how someone else handled it with their code. Change some of that, see what happens. If you find particularly useful bits of code that you can see yourself using frequently, copy it down and study how it works. Re-write it in your own fashion and save it so you can use it in your games, or if needed, write down whose code it is so you can give proper credit. Become familiar with the Debug windows... they're invaluable for determining whether those global or local variables are changing the way you want them to, or if you have a memory leak somewhere because instances aren't being destroyed properly.

Once you're comfortable with the syntax of the language and how to use it to perform the desired actions on your objects in the game, the next step is to attempt to make your own game. All too often, people screw this step up by attempting something way too difficult for their skill level. Then they become frustrated and run to the forum to ask all sorts of questions. My question would be... why are you starting out with a top down shooter or a role-playing game? These are some of the hardest types of programs even for veteran users to accomplish: a top-down shooter usually requires an extensive assortment of weapons and effects, as well as enemy AI, views, collision checking, and a HUD. Role-playing games require an extensive equipment/item list, skill and inventory systems, a variety of maps and enemies, magic spells and effects, and enemy AI.

Wouldn't it be easier to start simpler to get used to programming in the GM environment? As unexciting as it might seem, why not start out with a game like Pong or Space Invaders. Granted, it may not seem like much of an accomplishment, but Pong requires 3 moving objects, some rudimentary deflection physics, and collision checking. Space Invaders requires a bunch of moving objects, projectile firing, collision checking, and enemy pathing. Either would be a great first project for a GM beginner, and there are plenty of tutorial examples that have those features contained within so you can tinker and pick them apart.

Think of it like you're in your own role-playing game... there are certain programming skills you need to learn and develop before you can attain a certain goal. Think about how you would rate yourself in the following GM programming concepts (these are examples, this list is nowhere near complete) and then pick a project that helps you hone those skills:

Object Movement
Image Animation
Collision Checking
Particle Systems
Using Variables
Using Arrays
String Manipulation
Surfaces
Firing Projectiles
Tiles
Line of Sight
Enemy AI
etc
etc

When you've got the basics down, the next project that would match your skill level would probably be a scrolling shooter. There are also many tutorials on this type of game, but you can make it as simple or as complex as you want. Add different types of enemies with some rudimentary AI. Add some challenging bosses with different attack styles. Make some different levels/maps. Try some different explosion and weapons effects.

After you've finished something like that, the next good step would be a platformer. Now you will be using some image animation skills, obstacles, gravity, different attacks, level design and map making, enemy AI, items to collect, traps, etc. These are more tools in your toolbox that you can use in future projects as you build upon your game-making skills, and there are plenty of platformer tutorials/engines to modify, tinker with, and pick apart.

Once you've completed these initial projects, you should have enough experience with some of the simpler things that I see people asking about on the Novice/Beginner forum, such as score-keeping, health, lives, variables, collisions, gravity/friction, image_angle, how to make an enemy close on the player, how to execute an attack and remove health, animation, etc. At this point, then you would be in a better position to attempt that Pokemon game or that top-down shooter, or even an online game (after studying the multiplayer tutorials/engines inside and out.) Be an avid reader of the Game Design section of this forum... it'll help you think about how to design your game from the ground up before you even start to code, minimizing the chance that you run into a roadblock, balance issue, or design flaw. Plus, it's useful as a sounding board for some of your ideas.

The bottom line is programming is a skill that is best self-taught, and if you jump too far ahead with a project that is too ambitious for your skill level, you will become frustrated and most likely give up. And that would be a shame, because this community can always use more aspiring game developers. Don't be afraid to ask for help, but by all means make sure the answer is not just staring right at you in the GM manual first, and make sure you have attempted to understand and tinker with the appropriate tutorial or engine after you've searched for one on the forum. And don't just ask for the code... you won't learn anything that way. It's better if someone gives you a conceptual idea of how they would go about performing the particular task you are asking about (the "art"), leaving you how to translate that into code yourself (the "science").

Good luck!

How Long Should It Take...

15 January 2008 - 11:39 PM

For the virus scan to be complete after uploading a game to YoYoGames?  Mine has been in virus scan status for the last 3 days... is that normal?