Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411505 Posts in 69374 Topics- by 58429 Members - Latest Member: Alternalo

April 25, 2024, 06:40:18 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)Archived ProjectsIndie BrawlIndie Brawl: Source Code
Pages: [1] 2
Print
Author Topic: Indie Brawl: Source Code  (Read 15540 times)
Soulliard
Level 10
*****


The artist formerly known as Nightshade


View Profile WWW
« on: August 03, 2008, 03:41:33 PM »

The source code for Indie Brawl is included in the download. To use it, you will need to put it in the same folder as the main game download. It is programmed in Game Maker. It's not necessary for team members to understand or even look at this file. However, the option is there if you would like to try programming a character yourself.


If you don't have the registered version of Game Maker, this is the last version of the source that will work for you. You will need to go to the Character's draw event and change draw_sprite_ext to draw_sprite and eliminate the last few arguments. If you would like a version of the source code that is compatible with the unregistered version of Game Maker, PM me.



If you are interested in programming characters, read on...

Each character has the following statistics:
maxhp - Character's total hit points. 30 is average.
weight - A rating of 1-5 that determines how heavy a character is. 3 is average, 1 is Gish, 5 is Balrog.
maxspeed - how fast the character can normally walk. 6 is average.
accel - How fast the character accelerates. 3 is average. If lower, character will be hard to control.
air_accel - How fast the character accelerates in the air. Should be about half of accel, but at least 1.
maxjumps - How many times the character can double jump. Typically 1.
jumpspeed - How high the character jumps. 16 is average. Raising or lowering this just a little vastly changes jump height.
doublejumpspeed - How high the character double jumps. 14 is average.
air_cooldown - The higher this is, the longer the delay between aerial attacks. 6 is average, but for some characters, it could be as low as 0.



Creating attacks is a little more complicated. Generally, just describing the attack will suffice, but if you would like a more in-depth look at how attacks are programmed, here's how it's done (if you're not interested in the programming, you can skip the rest of this post):

Attacks are performed in one or more steps, with a small delay between each step. At each step, the character will perform certain actions. It's easier to explain if I just show you. Here's a sample attack (this is the charging attack from the demo).

Performed when the button is pressed:
Quote
//First, we check to see if the player recently performed an aerial attack, since there's a cooldown period between attacks in the air.
//Some attacks (such as dodges and rapid gunfire) may not have cooldown times.
if(air_attack = 1)
{

//The character's movement (represented by the two momentum variables) freezes.
xmomentum = 0;
ymomentum = 0;

//While the attack charges up, the character is unaffected by gravity.
float = 1;

//The next step will occur in two frames.
alarm[0] = 2;

//The attack_start() method should almost always be invoked at the start of each attack. This method ensures that no other attacks can be performed while you're in the middle of this one.
attack_start();
}

Step 1:
Quote
//We set the character's horizontal speed very high. xscale is a variable that determines which direction the character is facing. x_add is a variable that increases the character's speed with each step. It is used to prevent the player from slowing down while charging.
xmomentum = 12*xscale;
x_add = xscale;
ymomentum = 0;

//The attack_create() method must be used to create the attack.
attack_create(test_attack2);

//The second step is next, and it will occur in four frames.
next_step = 2;
alarm[0] = 4;

Step 2:
Quote
//We set x_add and float back to zero so the character's movement returns to normal.
x_add = 0;
float = 0;

//Step 3 is next, an will occur in four frames.
next_step = 3;
alarm[0] = 4;

Step 3:
Quote
//The attack_end() method allows the character to attack normally again. If you do not want the attack to have an aerial cooldown timer, you can substitute "act = 0" for "attack_end()".
attack_end();

The attack itself has a duration of four frames. It has the following code for when it collides with an enemy:
Quote
//The attack_aim() method should always be called. It makes sure the attack doesn't hurt allies or hit an enemy multiple times. The method's argument determines how long the enemy will be immune to your attacks (it should generally be set to alarm[0], the attack's duration).
attack_aim(alarm[0]);

//target will be set to 1 if it hits an enemy (instead of an ally)
if(target = 1)
{

//The attack_hit() method has several arguments-
//1- The attack's damage. 5 is average.
//2- The attack stuns enemies of this weight or less. Should generally be 5.
//3- Horizontal knockback. 1 is average.
//4- Vertical knockback. 1 is average.
//5- The duration for which the enemy is stunned. 2 is average.
//6- Set this variable to 1 to make the attack unblockable.

attack_hit(4,5,1.5,-1.5,2,0);
}
« Last Edit: March 13, 2010, 07:03:44 PM by Soulliard » Logged

Skofo
Level 10
*****



View Profile
« Reply #1 on: August 03, 2008, 10:57:05 PM »

EDIT: Disregard, I suck cock. Seeing that project file just made me remember how messily Game Maker handles the source and it cramped my stomach a little.
« Last Edit: August 03, 2008, 11:04:34 PM by Skofo » Logged

If you wish to make a video game from scratch, you must first invent the universe.
Soulliard
Level 10
*****


The artist formerly known as Nightshade


View Profile WWW
« Reply #2 on: August 07, 2008, 11:31:33 AM »

I released the latest version of the code for those interested. Once you find your way around in there, you can do some cool things (like use a controller- set Player_Character's control_type variable to 2).
Logged

William Broom
Level 10
*****


formerly chutup


View Profile
« Reply #3 on: August 07, 2008, 05:46:45 PM »

Well, I'm not great at coding but I know my way around GM7, so I'm sure I can help with coding characters at least.
Logged

Derek
Bastich
Administrator
Level 10
******



View Profile WWW
« Reply #4 on: August 07, 2008, 10:40:50 PM »

Nightshade, can you put a version number next to the download and let us know what changes have been made with each update?  Would be helpful and also fun to see how the engine progressed. Smiley
Logged
Soulliard
Level 10
*****


The artist formerly known as Nightshade


View Profile WWW
« Reply #5 on: August 16, 2008, 02:25:26 PM »

Here's the latest release of the engine.

The most notable additions are:
-Three player combat- two on the keyboard, one on a controller
-Naija's moves have been rebalanced
-Many of Naija's moves are now animated

At this point, the engine can support 8-player combat with both keyboard and controller support, with just a little modification.
Logged

Mr.moo
Level 0
***



View Profile
« Reply #6 on: August 16, 2008, 11:32:46 PM »

what do you want for a title screen just to give it some zing when you open the game.....
Logged

DO THE R.O.B!
William Broom
Level 10
*****


formerly chutup


View Profile
« Reply #7 on: August 18, 2008, 02:28:31 AM »

Well, I tried to start work on Nikujin's code and it was... humbling, to say the least. The complexity of the code already in place is pretty much out of my league. I'll try to get to grips with it, if only for my own education, but I don't think you can count on me to make any real progress for a long time, if ever.  Sad
Logged

Soulliard
Level 10
*****


The artist formerly known as Nightshade


View Profile WWW
« Reply #8 on: August 18, 2008, 05:52:16 PM »

Heh, that probably has as much to do with my odd coding style than anything else. Most of the code just works in the background, though, so you don't really need to understand it (except for really complicated attacks).
Logged

necromian
Level 2
**

ʘ_ʘ


View Profile WWW
« Reply #9 on: September 07, 2008, 05:01:20 PM »

D:

No "release the jump key and end the jump"? Mind if I attempt to add this?
Logged
Soulliard
Level 10
*****


The artist formerly known as Nightshade


View Profile WWW
« Reply #10 on: September 08, 2008, 06:13:37 AM »

Yes, actually. From my experience, double jumping and variable jumping don't play well together.

(And you can hold 'down' to make short jumps)
Logged

Soulliard
Level 10
*****


The artist formerly known as Nightshade


View Profile WWW
« Reply #11 on: September 20, 2008, 08:33:18 PM »

Here's the latest version of the .gmk file.
Logged

William Broom
Level 10
*****


formerly chutup


View Profile
« Reply #12 on: September 20, 2008, 10:12:03 PM »

Hmmm, I'm looking through here and I think I'm starting to get to grips with the code. I don't know if you made it easier to understand or I'm just learning it better, but I'm pretty sure I'll be able to work it out eventually. If you're aiming to code Turner next, then hopefully I'll be able to start on Nikujin for character #4 or #5.
Logged

William Broom
Level 10
*****


formerly chutup


View Profile
« Reply #13 on: September 21, 2008, 06:04:23 AM »

Heh, I'm making progress this time. I've got Nikujin running and jumping OK, though I haven't started on the attacks yet.
Logged

Soulliard
Level 10
*****


The artist formerly known as Nightshade


View Profile WWW
« Reply #14 on: September 21, 2008, 07:59:11 AM »

Yep, I'm working on Turner next. Let me know how Nikujin's coming, and if you have any questions.
Logged

William Broom
Level 10
*****


formerly chutup


View Profile
« Reply #15 on: September 23, 2008, 12:51:44 AM »

OK, so the various _check and _press codes are to test whether various buttons are pressed. But am I right in thinking that, say, s_check will check if the button is depressed at all, while s_press will check if the button has been depressed this step? And if so, shouldn't s_check use keyboard_check instead of keyboard_check_pressed? I not doing a serve I just need to know.
Logged

Soulliard
Level 10
*****


The artist formerly known as Nightshade


View Profile WWW
« Reply #16 on: September 23, 2008, 04:26:16 AM »

Yeah, probably.  Embarrassed
Logged

William Broom
Level 10
*****


formerly chutup


View Profile
« Reply #17 on: September 24, 2008, 12:30:04 AM »

EDIT: n/m, it's fine now
« Last Edit: September 24, 2008, 12:42:19 AM by chutup » Logged

Soulliard
Level 10
*****


The artist formerly known as Nightshade


View Profile WWW
« Reply #18 on: November 21, 2008, 01:09:13 PM »

The source code file has been updated. It's important to look at this file if you are making a character, since the code for attacks has changed slightly to account for bonesaw absorption and destructable terrain (it's coming).
Logged

William Broom
Level 10
*****


formerly chutup


View Profile
« Reply #19 on: December 09, 2008, 11:08:39 PM »

I am thinking about how to make a Bonesaw stage. One of the features I want to implement is things you can hit (bomb blocks and bouncing bombs from cannons). I was wondering how best to incorporate this into the engine, since there will probably be a lot of such elements once we get into destructible environments and so on.

What I was thinking we could do is make a class object called 'hittable' representing all objects that react to attacks. Then we slip 'hittable' into the parent chain between 'Thing' and 'Guy'. Then, we go through the attacks and change their events from Collision(Character) to Collision(hittable). We won't need to change any of the code within the attacks, hopefully, because the level elements will make sure to have all the variables referred to by the attacks (such as hp, xmomentum, ymomentum and so on).

It's a pretty major change to the engine though, so I wanted to ask you about it first, Nightshade.
Logged

Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic