Recent posts by IndieFlashArcade on Kongregate

Flag Post

Topic: Game Programming / Loading data from File objects

It sounds like your solution will work even better than using XML, glad you were able to figure it out. Good luck on your game!

 
Flag Post

Topic: Game Programming / Loading data from File objects

You definitely want to go with embedding the file. It embeds at compile-time, so you won’t need to upload a separate file to Kong. The formats that would work best for you are either XML or JSON. Here’s some sample code for embedding an XML file (JSON would be a little different):

[Embed(source="atlas.xml", mimeType="application/octet-stream")]
public static const AtlasXml:Class;

var xml:XML = XML(new AtlasXml());

 
Flag Post

Topic: Game Programming / Memory traps

You shouldn’t need to force the garbage collector to run, if you’re in a situation where you’re allocating that much memory frame over frame, you might reconsider your approach. Others have mentioned pooling, and I would recommend this method especially for objects that need to be created and destroyed very frequently (such as bullets, particles, enemies, etc.).

The key to avoiding memory leaks is to remember that every time you invoke the new keyword, you are allocating memory. If you continue allocating memory but don’t release it, you have a memory leak.

So your options to avoid memory leaks are either pooling, or to make sure that the objects you create are properly de-referenced when you’re done with them, so they can be garbage collected. Personally, I prefer the pooling method— it takes a little more engineering up front, but it will benefit performance and lets you avoid having to rely on the garbage collector too much.

Pooling

The goal of pooling objects is to avoid having to constantly be creating and destroying new objects— also what’s known as memory churn. We want to reduce our memory churn. The whole process of creating a new object in memory takes processor cycles and if you’re not careful it opens you up to memory leak issues. The goal of pooling is to only invoke the new keyword once, when your program is initialized, and then re-use the same objects over and over. Each time you re-use the object, you don’t need to allocate memory for it, you just take it from your pool and reset its properties. When you’re done with it, you put it back in the pool.

De-referencing

If you can’t pool your objects (or in places where pooling doesn’t make sense, but you will need to free an object from memory), you’ll want a strategy to de-reference them properly so the GC can clean them up. Others have touched on this already so I’ll just mention what I tend to do. First make sure that it’s not on the display list (call removeChild), and also that no other objects or event listeners are referencing the object. Then you set the object’s reference to null (object = null). If it’s part of an array or other collection, remove it from the collection. At this point it should be good for garbage collection.

 
Flag Post

Topic: Game Programming / Make yer own spaceship!

YEE-HAW
http://www.indieflasharcade.com/tutorials/SimpleShip.php

 
Flag Post

Topic: Game Programming / how to set an area to click?

yay SimpleButton!

 
Flag Post

Topic: Kongregate / Ultimate Kongregate Photo Topic

This is me in a cafe in Berkeley, CA

 
Flag Post

Topic: Game Programming / graphics class in AS3

Not wasteful. The computer does all the work for u :P

Besides, I’d wager that by including all those circles in one fill, you’re putting more stress on the vector engine than by separating them out.

On your second question, you can always draw the background before drawing the circles. Or, separate them into different Sprites (better than MovieClips unless you need a timeline), and do like:

parentSprite.addChild(backgroundSprite);
parentSprite.addChild(circleContainer);

Now you just render your circles in the circleContainer. Badda-bing.

 
Flag Post

Topic: Kongregate / Home Page Upgrade -- Looking Good

Hey I just surfed in and noticed that Kong made a new upgrade to the featured games portion of the home page. Me likey! It’s always good to have more variety and besides, I like moving things.

What do other people think?

P.S. lol this is my first post in ages! So, if this topic is old hat.. that’s why.

 
Flag Post

Topic: Game Programming / Collision Detection Help

LOL, after reading fucrate’s post, I’m so tempted to bust out a simple moon lander game… sooo tempted.

 
Flag Post

Topic: Game Programming / AS 2 Classes

Well, I did say “periodically”…. :)

 
Flag Post

Topic: Game Programming / AS 2 Classes

Pretty much.

At this point, you need to “abstract” the functionality of your basic mech class so you can create an object.

Say for instance each one has a velocity, speed, direction, size, etc. You can create variables to hold all of those values internally, which means that each mech object will have its own velocity, speed, direction, size, and so on. So, no more arrays, no more mess. Creating custom objects really is about organization, and making things easier for the programmer to design and conceptualize what each object needs to do. It also keeps your code from getting really messy, since everything is tidied up into separate classes. That way, the functionality that is related can be grouped together, and vice-versa, the functionality that is not related to a class, can be kept outside, or in another class.

Ok I’ll write a simple mech class here and show you how easy it is (this will take me like two or three minutes):

class mech extends MovieClip {

  static var nConversion:Number;
  private var nSpeed:Number;
  private var nSize:Number;
  private var nRadians:Number;
  private var vx:Number;
  private var vy:Number;

  public function mech() {
    nConversion = Math.PI / 180;
  }

  public function moveForward() {
    doVelocity();
    //using the 'this' keyword...
    this._x += vx;
    this._y += vy;
  }

  public function moveBackward() {
    doVelocity();
    //...is the same as not using it
    _x -= vx;
    _y -= vy;
  }

  private function doVelocity() {
    nRadians = this._rotation * nConversion;
    vx = Math.cos(nRadians) * nSpeed;
    vy = Math.sin(nRadians) * nSpeed;
  }

}

Then, back in your main code, you will probably use an Array to keep track of all the mechs on stage, but you will now only need to keep track of the objects themselves, and not manage huge arrays of other data. Assuming you export a MovieClip (the graphical element) from your library with the identifier “alphaMech”, and export it as the mech class, you can write:

var allMechs:Array = new Array();

//create mechs
for(var i:Number = 0; i < numberOfMechs; i++) {
  var newMech:mech = attachMovie("alphaMech", "newMech", this.getNextHighestDepth(),
                                                  {nSpeed:10, nSize:20});
  allMechs.push(newMech);
}

selectedMech = 0;

//key left
this.onEnterFrame = function() {
  if(Key.isDown(Key.LEFT)) {
    allMechs[selectedMech]._rotation -= 5;
  } else if(Key.isDown(Key.RIGHT)) {
    allMechs[selectedMech]._rotation += 5;
  }
  if(Key.isDown(Key.UP)) {
    allMechs[selectedMech].moveForward();
  } else if(Key.isDown(Key.DOWN)) {
    allMechs[selectedMech].moveBackward();
  }
}

Something like that. You can take that code and play around with it, and find something that works for you.

Incidentally, I have a tutorials section on my Web site, but I am too lazy to update it most of the time (http://www.indieflasharcade.com). Check it out, and I think I may add this as an example of how to write a simple class ;)

-Indie

 
Flag Post

Topic: Game Programming / On Ads and Latency

As a game developer, I work hard to try and make my games run at as high a framerate as possible, which invariably means optimizing my code in every way possible, trying to squeeze out that extra frame or two per second that will make all the difference in the user experience.

That’s why I find it quite frustrating when a game (so lovingly optimized) is running on the same page as some poorly-coded, graphically intense banner ad which uses tons of video and graphics processing and essentially just sits there, completely useless. This happened to me today while trying to play Fancy Pants world 2. This ad (the one with a wizard shooting fire or something like that), completely sucked up all the bandwidth— FP was forced by the browser to share processing with this pile of crap ad, which was probably coded by some intern somewhere, and it could barely even run.

As a developer I find this sickening and say to these so-called Flash designers who create monstrosities like that one: Nobody is impressed by your ostentatious use of Flash video and fancy gradients, so just give it a rest and make an ad that doesn’t crash the content that it’s supposed to be sponsoring.

Yeesh.

 
Flag Post

Topic: Game Programming / AS 2 Classes

It won’t help unless you use it properly, but that’s not too difficult to imagine a scenario where you might need them.

Ok, so say your ball needs to have a few variables (properties), like velocity:

private var vx:Number;
private var vy:Number;

Maybe the ball is supposed to move across the stage, so you write a function that will move the ball:

public function moveBall() {
  this._x += vx;
  this._y += vy;
}

So now, imagine that you want to have 10 balls on the stage at once. Instead of writing some complex logic to keep track of all the balls and their velocities, and a function to move them all, you only need to use one command on each ball: moveBall(); That way, you can “encapsulate” all the funcionality of the ball into a single class, and create as many balls as you need.

Also you can use inheritance to create different types of ball, each building on the basic ball class, simply by extending the class. That way if you need three different types of ball that all have the same basic functionality, you don’t have to re-write the code for each one— just extend the class and add on the additional functionality to the new class.

 
Flag Post

Topic: Game Programming / AS 2 Classes

Yeah that code would work if you had a ball class defined in ball.as. The as file could look something like:

class ball extends MovieClip {

  private var myVar:String;

  public function ball() {
    //constructor
  }

}
 
Flag Post

Topic: General Gaming / New Look

You make some good points, underseige. You’re right I wasn’t aware that you are a game programmer; I played Sketch Pac and it was pretty good.

As for my site being “mainly” Flash, I think it’s actually mainly HTML. Also, being a Flash developer doesn’t preclude me from being a Web designer also, and I have developed other sites before without even using Flash. The pages on Indie Flash Arcade are all HTML, and all the game and tutorial pages are also in html. I used Flash to develop the functionality of my game section, which is still not very useful admittedly, but will soon be integrated with other site features vis JavaScript. I’m adding some new features to it as we speak ;) But, only the menu and certain other things like the games browser are done in flash, the rest is HTML.

Anyway you said:
bq. My site was completely made by me, so I don’t know what you are implying by saying you’ve seen dozens of sites with the same layout. Hopefully you are not saying you think it is an off the shelf script.

And I think I should clarify, I don’t think it’s an off-the-shelf script or anything like that. I can tell that it’s an original site and it looks pretty good, I’m really not trying to criticize it too much because it’s not bad at all. I do feel like it’s pretty similar in it’s general design to a lot of sites, with sections for different genres, main page, etc. Taking a closer look, I see you’ve got a list of planned features that seems interesting, so hey more power to you man.

 
Flag Post

Topic: General Gaming / New Look

Hi undersiege,

I just happened across this thread and, after reading the thread and checking out your homepage, want to throw in my two cents.

It should be said that I also have a small, relatively unknown games site, http://www.indieflasharcade.com. Now, I’m not advertising on my site and hence not making any money, it’s mostly there for fun and to show off some of my work, and I’m not claiming to be a portal either — I spend most of my time developing Flash content, rather than working on my Web site (although incidentally, another major update is coming in a week or so).

As an independent Web site owner, there is no way that I can compete with the juggernauts like Newgrounds or Kongregate, who employ dozens of people, and if you’re independent like me you’re probably going to realize that it’s a TON of work to try and keep up. I find it interesting that you didn’t mention Bubblebox, because there is another small site, which I believe is run by two or so people, which does rather well and seems to share a certain aesthetic with your own. Bubblebox develops their own games like I do, and that is a big traffic draw (I got 12,000 hits a day when POD was in full swing), but without that, you will need something else to bring people in.

Seriously though, I’ve seen a TON of sites out there with almost the exact layout that you’re using, the exact features, the same general aesthetic. I don’t think you can just show up, build a site, and expect to immediately be in the same league as your Kongregates or your Newgrounds, or sites like ArmorGames, CrazyMonkey, and etc., etc., etc.

Now this isn’t to say that you can’t do it; I say “go for it!”, but it’s a bit premature to say that you’re already competing with NG and Kong :)

 
Flag Post

Topic: Kongregate / Some Questions

To put as simply as possible, the best almost any flash developer will ever get for his/her game is about $1000.

Not quite true. I know as one example, AdamSchroeder made upward of $4,000 off of Asteroids Revenge III, so it’s possible to get that much or more from a Flash game.

Sounds like Wan2Play is just trying to find another excuse to hate on Kongregate, when it’s really one of the few sites out there that even tries to share their ad revenue with developers. I’ll be happy to share what I’ve made so far in ad revenue… it’s about $10-15 dollars so far. Hey not too bad, considering it’s extra on top of sponsorhips and contest winnings.

Kong is a great site, run by great people, and the more people support it, the more money we all can make.

 
Flag Post

Topic: Game Programming / Triginometry/Shooting help

x+=(sin(angle)speed) y+=(cos(angle)speed)
Off the top of my head I can’t guarantee that is totally correct.

Well I hate to break it to ya, but cosine is for X, and sine is for Y. That’s about the most basic trig you’ll ever see.

 
Flag Post

Topic: Game Programming / java

Not too many Java games on this site… maybe not the best place for Java questions.

 
Flag Post

Topic: Serious Discussion / TragicSpill

For more information, visit The news article about this topic.

 
Flag Post

Topic: Serious Discussion / TragicSpill

This is terrible.. I hope the drunken captains of that ship get some jail time.

 
Flag Post

Topic: Game Programming / help coding!!!!

The use of extraneous exclamation points is unnecessary. Your question is quite ambiguous.

 
Flag Post

Topic: Game Programming / interview

1.when did you start making games/animations with flash?
About 2 years ago, in 2004/2005.

2.how old were you?
23.

3.how much time do you usually spend making a game/animation?
Anywhere from 4 hours to 6 months or more.

4.were (sic)do you get your ideas for games animations?
Pop culture, internet, other artists, classic art, music, hallucinations.

5.what version of flash do you use
Flash 8. um.. yeah.

6.what got you started in games/animations?
I made my first game when I was 9 years old, it was a halloween text adventure. It was out of sheer boredom.

7.what do you think is your best game/animation?
Judge for yourself.

8.do you have a website? if so what is it?
indieflasharcade.com

9.what websites to you put your games on?
My games have appeared on many web sites, but some of the best are: JayIsGames.com, GameBalance.com,
IndieFlashArcade.com, Kongregate.com, Bubblebox.com, Jiggmin.com, UgoPlayer.com, Newgrounds.com, Gamegum.com, and some
other sites.. there are so many.

10.have any of your games been sponsored?
My most elaborate game to date, POD, was sponsored by Kongregate.com.

11.what was your first game/animation made with flash? thank you for taking the time to take this interview
First game: Q-Zoid. First animation: A little-known cartoon adventure featuring a character I invented.

 
Flag Post

Topic: Game Programming / Mouse follower code

This is a cool example of how to make a MovieClip follow the mouse, and “spring” to the mouse position.

Create a MovieClip on the stage and give it an instance name of ‘ball’

// two-dimensional springing example
// spring to mouse!


var spring:Number = 0.1;
var friction:Number = 0.85;
ball.x = 0;
ball.y = 0;
var vx:Number = 0;
var vy:Number = 0;
onEnterFrame = function() {
var ax:Number = (xmouse – ball.x) * spring;
var ay:Number = (
ymouse – ball.
y) * spring;
vx += ax;
vy += ay;
vx *= friction;
vy *= friction;
ball.
x += vx;
ball.
y += vy;
};

 
Flag Post

Topic: Game Programming / Bullet problem.

Awesome. I’m just going to stop posting for awhile…