Recent posts by JayHobsie on Kongregate

Flag Post

Topic: Game Programming / How Would You Do This? - #6 - Pathing

If you move an entity along a bezier curve walking along it’s parameter you’ll see the entity speeding up and slowing down in places.

You can treat a bezier curve simply as a lot of points and thus lots of little lines between these points. (Say a point every 0.01t depending on how accurate you want it to be).
However, this gives you lots of little straight lines of varying length meaning your speed varies if you increase the curve parameter at a consistent rate. To correct this you’d need to convert your physical speed into the line parameter delta of the current ‘little line’ of the curve your entity is on (and take into account that your speed may/will make you move to the next little line etc etc).

So while making a bezier curve is probably the easiest way to generate a curve, moving an object along it at a conssitent rate turns into a bit of a ballache.

Elyzius appraoch seems get around the bezier problem, but how do you go about generating all of those spheres apart from manually plotting them?

(This example of smooth bezzie movement with a ball walking along its parameter, though it has gravity to accelerate it)

Flag Post

Topic: Game Programming / Linked Lists?

It depends on the usage whether you wanna use a vector/array or a linked list!

Linked lists are good for very fast insertion/deletion/splicing (e.g to remove a node from the middle you simply link the 2 at either side of it) where as deleting an entry in the middle of a vector would invole moving half the entries down one.

vector is good for random access (indexing into it ‘vec45’ ) you can’t do this in a linked list, you’d have to start at the beginning and iterate through the list to the entry you want which could be quite expensive!

Flag Post

Topic: Game Programming / Multiplayer Game Dev Contest - Play Entries!

Unity uses C# or javaScript not AS3, but it still can compile to a .swf. So you’ll need to clarify if Unity is an acceptable to be used!

If there can be some clarification on this as the rules specifically say ’’target Flash Player using ActionScript 3"

This rule would also rule out using language like HaXe too?

Flag Post

Topic: Game Programming / AS3 FlashDevelop - how to attach static JSON [SOLVED]

Well Here is a working example of embedding and getting data from a json string…

	import flash.display.Sprite;
	import com.adobe.serialization.json.JSON;
	public class Main extends Sprite
		[Embed(source="myJsonFile.json",mimeType="application/octet-stream")] private const JStr:Class;
		public function Main():void
			var dataObj:Object = JSON.decode( new JStr() );

If you want your program to be able to edit and re-save out the json string you’d wanna edit an Object and then call JSON.decode on it rather than actually edit the string itself. Then use the FileReference class to save that out.

Flag Post

Topic: Game Programming / Show us a screenshot of what you're working on!

Here’s a brawler type game me and my mate have been working on for a bit now. Been working on it totally aimless and not sure where to go with it. We’ll see, but hay the art is pretty

Flag Post

Topic: Game Programming / User-defined base class + stage instance names

Originally posted by qwerber:

Problem 1:

Haha you’ve got to be kidding. A child of the movieclip with an instance name must be a property of the Movieclip. That’s how it works. If you are using Movieclip without a derived class, then there is no written class, thus making the last part of the question pointless.

My point is that the stage instances are getting auto declared on the wrong class, rather than the class that actually uses these instances, it is getting declared on the base class (if the base class is Movieclip these instance’s are not properties of MovieClip itself but of the Class, which is my expected behaviour!)

Flag Post

Topic: Game Programming / User-defined base class + stage instance names

A clearer description of the problem is here:

But my expected result would have been that the instances are declared in the auto generated Class rather than the base class to save the base class getting bloated up with random properties.

Flag Post

Topic: Game Programming / User-defined base class + stage instance names


I am using my own extended MovieClip (MC) class instead of just MovieClip but have noticed 2 big problems if anyone is able to shed some light!

Problem 1:
Firstly I have 2 MC’s with 5 children each that are also MC’s. These children are all given unique instance names. When i was debugging around I saw that all 10 of these instances names are declared as variables in my MC class (unused ones with a null value). This means the more instance names I use the more variables created on the MC class so every single instance of an MC contains loads of deadweight variables. By the time I am finished this game, MC will be bloated as fuck!

So my question is why does flash do this? Why do these instances have their variables created on the base class rather than the auto-generated class? This is not the case when using the MovieClip class, so why is it the case with an extended MovieClip?

Problem 2:
It will not allow you to have duplicate instance names if the MC you are giving the instance names too are not of the same class, even if they are in different MC’s. For example if the 2 MC’s described, Are Monkey and Horse. And their 5 children are Monkey_idle, Monkey_run, Monkey_attack / Horse_idle, Horse_run, Horse_attack.. (you get the idea). If you give both Monkey_idle and Horse_idle the same instance name ‘idle’,
then you will get the following warning:

Warning: All instances named 'idle' will be automatically declared as Monkey_idle in symbols that use Game.MC as their base class. In symbols that are linked to user-defined base classes, instances with the same name must be of the same type.

Relating to problem 1 i understand why this warning comes up, I just don’t get why this is the behaviour in the first place. Especially only on MC, and not MovieClip.

Hope the descriptions are clear, it is a little wordy!


Flag Post

Topic: Game Programming / I'm getting security errors and I dunno how to fix it (AS3) (SOLVED)

Go to the Global security settings panel at

Add the folder your flash is in as a trusted location. This should allow calls and such from external places sending stuff to your flash when testing it locally.

Flag Post

Topic: Game Programming / Seeking advice regarding programming professionally

Here is a survey of what companies are looking for in graduate programmers. I took this from LinkedIn.

May be more geared towards 3d games programming but it is interesting.

Graduate Programming Survey 2010 Results:-

Top Ranked Skills:-
1) C++
2) Maths
3) Problem Solving
4) Team Work
5) Direct X / Open GL
Main Weaknesses in Graduates:-
1) C++
2) Maths
3) Communication
4) Poor / No Demos
5) De bugging / poor memory allocation skills.
On a scale of 1 -10 (10 =high) how do you rate qualifications when deciding whether to offer / interview?
Average answer – 6.75 / 10
What degree discipline provides the best grounding for a career in game programming?
1) Computer Science 59%
2) Games Technology / Programming 31%
3) Maths / Physics 8%
4) Other 2%
On a scale of 1 -10 (10 =high) how do you rate Demo’s when deciding whether to offer / interview?
Average answer – 7.75 / 10
Do you have a structured Graduate training plan?

80% respondents train graduates on the job

How long does it take for graduates to become productive members of staff?

Average Answer – 6 mths

Flag Post

Topic: Game Programming / I need to understand more about Super. error 1201

In your Hero class you have the following:

super.zCoordinate = yv;
super.Health = maxHealth;

you dont use super to call variables like this. zCoordinate is a public variable so it is accessible to hero anyway so jsut remove the ‘super.’ before it.
If you don’t declare public/private/protected before var it is private by default I believe? so that means your Health variable is inaccessible in the hero or Enemy class.

If you have variables/functions in the bass clas you need to use in children, declare them as protected (only accessible internally and in children) or public if they are used outside too.

The way you’re passing the stageRef down into the Actor class is fine!

Flag Post

Topic: Game Programming / Optimization

Originally posted by UnknownGuardian:

I believe people are testing this wrong. You aren’t hitting anywhere near a performance stressing level which might cause something. I’m fairly certain that what is happening is this, a diagram of one ‘frame’ in Flash Player:

Where there is time where its running nothing making the tests appear close in results to each other. At least that is what I got from looking at Senekis’s post and JayHobsie.

Yes at first.. But as i said, I increased the number of objects until it did not reach the fps cap so there was never a yield period after finishing a frame (Although the best result was almsot at the cap)

Senekis’ results are clearly all…30fps which I imagine what he has his .fla fps set to.

I’ll post my code when I get home from work tonight..

Flag Post

Topic: Game Programming / Optimization

Originally posted by player_03:
Originally posted by JayHobsie:

I did a quick test with this enterFrame business, each object listening to their own enter frame versus each object listening to 1 object’s enter frame (1 event versus many).

How about using one listener total, and directly calling the other objects’ enter frame functions from this central listener?

This also hit the 120fps cap, its probably the same/comparable to all listening to 1 object’s event. Its my preferred way of doing things though, certainly makes pausing the game a lot easier! I only drew up the comparison above to show that it is the allocating and garbage collecting of all the events that slows things down, only new things up at run time if necessary.

*I increased the number of objects to 20k to see the difference. 1 listener to call all the objects updates was sitting at 9ms per frame still, while all objects listening to 1 object’s event was up to around 12ms

Flag Post

Topic: Game Programming / Optimization

Can’t see what is happening under the hood but I imagine Bob is right about what is the biggest performance impact by having multiple listeners.

If you have 100 different movieclips listening to their own enter frame event then that is 100 events getting new’d up and forgotten about every frame which is a lot of garbage!

If you’re looking at performance gains something like the overhead of a function call is a pretty moot point. Creating less garbage in a language such as actionscript would be a good place to start, recycling objects instead of new’ing things up every frame for example.

I did a quick test with this enterFrame business, each object listening to their own enter frame versus each object listening to 1 object’s enter frame (1 event versus many).

With 10,000 movieclips all listening to their own enter frame event it was taking 45ms (~22fps) to complete a frame.
With 10,000 movieclips all listening to the document classes enter frame event, ~8ms (120fps this was the highest I could set the fps to in flash, so it could’ve been computing each frame faster than this!)

Flag Post

Topic: Collaborations / Artist looking for AS3 Programmer?

Feel free to!

Flag Post

Topic: Collaborations / Artist looking for AS3 Programmer?

Nice to hear someone else not in it for the money!

I’d be interested in seeing if I can make your ideas come to light if you wanna throw me some more details/ideas!

And whats wrong with Newgrounds? :p
Here’s some stuff I made for 3 day game jams on…. cough Newgrounds

And raster or bitmap???? Rasterisation is taking vector graphics and converting them to pixels for y’know.. storage as a bitmap format :p

Lemme now if yer interested,

Flag Post

Topic: Game Programming / Making a game that uses scroll wheel? Read this!

I had a glance through this topic and don’t think i saw this solution.

I found it here:

“Dennis Kolyako created a clever workaround that captures the mouse wheel by loading an AS2 movie inside the AS3 movie, allowing us to get the desired AS2 mouse functionality. This seems to be the best solution, so be sure to check it out. Thanks to Gaen for pointing it out!”

Its a single .as file and you simply call

might also want to call this on flash deactivated

I havn’t tried on kongregate but I have a game up on FGL and newgrounds which uses the mouse wheel and it works fine

Flag Post

Topic: Collaborations / Help Us Design Levels

Cheers for the input guys, one of the things I’d like from this as well is some user input on how to make the editor a bit..nicer to work with, the controls are very clunky at the moment! I know all the keybaord shortcuts and controls yada yada so it’s hard for me alone to judge what makes it so cumbersome. Would rather not have to bog the user down with an 8 page instruction manual, but perhaps have the instructions open up on entering the editor?

A birds eye view is probably out of the question at this stage, but you can zoom out (space + mouse scroll).

The moving sand can actually be rotated by the mouse wheel, of course thats not really clear or conveyed at all so its hard to know. The cat statue and pillar can also be rotated.

Flag Post

Topic: Collaborations / Help Us Design Levels

I’m not sure where people are getting this virus stuff from? The page doesn’t even have adverts?

Anyway, you can also view it from the Newgrounds dumping grounds:

Seems it’s hard finding any interest for this, so instead I would appreciate some feedback for any bugs/improvements. How to make the editor a bit easier/less clunky to use!