Hey guys,
Here's the second part in the series of tutorials I'm running on Nape physics engine, this tutorial goes over sprites and how to get them into your game!
Let me know what you all think and as I say at the end of this movie, part three is going to deal with joints and moving objects with the mouse!
Thanks guys,
David
Friday, November 18, 2011
Box2D and Flash Develop - Tutorial 2: Sprites
Hey guys, here's the second part in my Box2D tutorial series, it's fairly short, but goes over the important method of how to give physics bodies a physical representation!
As always if you go to my youtube page you'll get the link to the github repo to download source code if you're lazy and don't want to type it out yourself! :P As I say in the movie, part three will be out soon enough with how to do joints! Thanks guys! David
As always if you go to my youtube page you'll get the link to the github repo to download source code if you're lazy and don't want to type it out yourself! :P As I say in the movie, part three will be out soon enough with how to do joints! Thanks guys! David
PxlSmshBox2D
Hey guys, here's a video that I've been wanting to post up for quite some time about Pixel Smash, a funky little thing developed by the guys over at Photon Storm, basically it couples pixel art with the ability to back it with physics. Makes for some really cool effects etc. I've taken some time to develop out the code into Box2D and have put it onto my GitHub account here.
I hinted that I was going to write a video about this last time and here it is:
I'm working on pulling down the amount of "uuuuums" and "aaaaahs" that I say, but bear with me, I'm not used to recording what I do :).
I'm going to be working on this project till I figure out it's either impossible or what's wrong with it, I'm hoping I come across the latter, and am able to produce a fully working version for you all.
Thanks heaps!
David.
I hinted that I was going to write a video about this last time and here it is:
I'm working on pulling down the amount of "uuuuums" and "aaaaahs" that I say, but bear with me, I'm not used to recording what I do :).
I'm going to be working on this project till I figure out it's either impossible or what's wrong with it, I'm hoping I come across the latter, and am able to produce a fully working version for you all.
Thanks heaps!
David.
Thursday, November 17, 2011
Musings of a occupational nature.
Hey team,
Just wanted to post up a little bit of info on why there's been a massive gap in-between posts (again.) Well, to put it plainly, daddy needs a job, or I can't buy nice things. As I'm sure some of you have dealt with first hand - the games industry within Australia is very very very small, and getting smaller by the day. And subsequently, the skillset that one possesses in order to become a successful applicant of the games studios left in Melbourne is getting bigger and bigger, almost beyond what one person can learn and demonstrate with no proir experience within the industry.
This poses a Catch 22 problem (my favorite,) one is unable to obtain a job as one doesn't have experience within the industry, and yet, the only jobs that are obtainable to gain said experience, themselves request that experience within the industry be had as a requisite for applying.
As such, it's come to my attention that the games industry, by and large is NOT the way that any young programmer / designer / smart guy should look. And that's not to say that any readers should be perturbed from reading further, don't lose faith just yet. I haven't finished. As I said - the issue is that to earn a LIVING off of creating computer games, is next to impossible. And for myself, that's certainly something that's very hard to let go of, from day one of Uni I've thought of working in a team of professionals creating the next big game, and in reality, it's just not happening any more. So - where do you go from here? I'm putting games to the back of my mind, into the drawer marked "one day, but not today." Because I know that there are a lot of good ideas swimming around out there, in the ether, and certainly many in my own head. But in the mean time, I need to focus in on what is important, and that's getting a job.
As a consequence (I say that, but it's not really,) I'm going to be pushing out a new Flash program which I'm yet to name. The purpose of the program is to allow mobile app developers that have selected the Flash environment to monetize their app. There are a huge number of mobile networks to chose from - InMobi, AdMob, Millennial Media, Tapjoy, JumpTap, Inner-Active - the list goes on and on and on and on. What I intend to create is a method by which, a user can simple enter in which network their app is to choose and then issue a simple call which will display the ad at a given location.
I will be developing this as an open source project and would love for anyone that thinks they have something important to input to take part. This will be the first step, developing this "Network Selector." Where I plan to go with it? Well, suffice to say, Australia is yet to have a fully Developed Mobile Network, and it's a very lucrative and economically advantageous thing to take part in.
Stay tuned.
David.
P.S. I won't stop with my physics engine tutorials, I started them and intend to continue, if you have a good idea for a tutorial, email me!
Just wanted to post up a little bit of info on why there's been a massive gap in-between posts (again.) Well, to put it plainly, daddy needs a job, or I can't buy nice things. As I'm sure some of you have dealt with first hand - the games industry within Australia is very very very small, and getting smaller by the day. And subsequently, the skillset that one possesses in order to become a successful applicant of the games studios left in Melbourne is getting bigger and bigger, almost beyond what one person can learn and demonstrate with no proir experience within the industry.
This poses a Catch 22 problem (my favorite,) one is unable to obtain a job as one doesn't have experience within the industry, and yet, the only jobs that are obtainable to gain said experience, themselves request that experience within the industry be had as a requisite for applying.
As such, it's come to my attention that the games industry, by and large is NOT the way that any young programmer / designer / smart guy should look. And that's not to say that any readers should be perturbed from reading further, don't lose faith just yet. I haven't finished. As I said - the issue is that to earn a LIVING off of creating computer games, is next to impossible. And for myself, that's certainly something that's very hard to let go of, from day one of Uni I've thought of working in a team of professionals creating the next big game, and in reality, it's just not happening any more. So - where do you go from here? I'm putting games to the back of my mind, into the drawer marked "one day, but not today." Because I know that there are a lot of good ideas swimming around out there, in the ether, and certainly many in my own head. But in the mean time, I need to focus in on what is important, and that's getting a job.
As a consequence (I say that, but it's not really,) I'm going to be pushing out a new Flash program which I'm yet to name. The purpose of the program is to allow mobile app developers that have selected the Flash environment to monetize their app. There are a huge number of mobile networks to chose from - InMobi, AdMob, Millennial Media, Tapjoy, JumpTap, Inner-Active - the list goes on and on and on and on. What I intend to create is a method by which, a user can simple enter in which network their app is to choose and then issue a simple call which will display the ad at a given location.
I will be developing this as an open source project and would love for anyone that thinks they have something important to input to take part. This will be the first step, developing this "Network Selector." Where I plan to go with it? Well, suffice to say, Australia is yet to have a fully Developed Mobile Network, and it's a very lucrative and economically advantageous thing to take part in.
Stay tuned.
David.
P.S. I won't stop with my physics engine tutorials, I started them and intend to continue, if you have a good idea for a tutorial, email me!
Tuesday, October 18, 2011
Box2D Pixel Smash... Or not.
Hey guys,
A while ago I came across this awesome little program made by Photon Storm called Pixel Smash, which is essentially a really cool way to mix pixel 8-bit like games with modern day graphics. Check it out here, as you can see, there are quite a number of possibilities that come to mind when you've got what is essentially a destructible pixel environment (think Modern Warfare 2D or similar) how cool!!?
One thing that this particular demo got me on to was of course Nape, as this is the engine that is powering it. However, as many flash developers are aware, the major physics engine of favor in and among game titles is of course Box2D, so I went about porting the Nape Pixel Smash example over to Box2D, with outstandingly disappointing results, I use a simple plugin class called "stats" which was developed by a guy called Mr Doob, and can be githubbed here, which gives you an awesome looking run down of what framerate you're running, how many objects you've got in your scene and also monitors memory and even refresh rates.
Here's the annoying thing though, the Pixel Smash Nape demo gave me a steady 60fps, with 1017 objects and a refresh rate of around 17ms. Now, when I run my Box2D version of it:

Suffice to say, pretty disappointing, and this is with an image that only generates 236 objects! For the purpose of this I've opened up a github account and y'all can browse and pickup the code there.
https://github.com/SPGamesStudio/Pixel-Smash-Box2D
Be gentle with me, still learning all the stuff that goes with github, so I hope it's all working.
Anyway, basically, the major problem with the Box2D version (I think) is that when the objects spawn into the world, they are all colliding off of one another. So if every object has 8 objects surrounding it, all colliding together, then that's a problem and very computationally hard.
So, with that, I am still at a loss as to how to improve the performance of the Box2D version, if you feel so inclined, feel free to grab the code off of github. And remember, credit given where it's due, this isn't my code to start with, I simple ported it. It's really Rich Daveys' from Photon Storm, I just played with it and got it to Box2D. I'm now in the process of re-writing the code in Nape with the most recent milestone, and will probably end up making a little movie out of it, we shall see.
In the mean time, yeah, get on it! Github it up people!!!
David
A while ago I came across this awesome little program made by Photon Storm called Pixel Smash, which is essentially a really cool way to mix pixel 8-bit like games with modern day graphics. Check it out here, as you can see, there are quite a number of possibilities that come to mind when you've got what is essentially a destructible pixel environment (think Modern Warfare 2D or similar) how cool!!?
One thing that this particular demo got me on to was of course Nape, as this is the engine that is powering it. However, as many flash developers are aware, the major physics engine of favor in and among game titles is of course Box2D, so I went about porting the Nape Pixel Smash example over to Box2D, with outstandingly disappointing results, I use a simple plugin class called "stats" which was developed by a guy called Mr Doob, and can be githubbed here, which gives you an awesome looking run down of what framerate you're running, how many objects you've got in your scene and also monitors memory and even refresh rates.
Here's the annoying thing though, the Pixel Smash Nape demo gave me a steady 60fps, with 1017 objects and a refresh rate of around 17ms. Now, when I run my Box2D version of it:

Suffice to say, pretty disappointing, and this is with an image that only generates 236 objects! For the purpose of this I've opened up a github account and y'all can browse and pickup the code there.
https://github.com/SPGamesStudio/Pixel-Smash-Box2D
Be gentle with me, still learning all the stuff that goes with github, so I hope it's all working.
Anyway, basically, the major problem with the Box2D version (I think) is that when the objects spawn into the world, they are all colliding off of one another. So if every object has 8 objects surrounding it, all colliding together, then that's a problem and very computationally hard.
So, with that, I am still at a loss as to how to improve the performance of the Box2D version, if you feel so inclined, feel free to grab the code off of github. And remember, credit given where it's due, this isn't my code to start with, I simple ported it. It's really Rich Daveys' from Photon Storm, I just played with it and got it to Box2D. I'm now in the process of re-writing the code in Nape with the most recent milestone, and will probably end up making a little movie out of it, we shall see.
In the mean time, yeah, get on it! Github it up people!!!
David
Friday, October 14, 2011
Nape and Flash Develop - Tutorial 1: Hello Nape World
Hey guys,
Just made another movie for ya'll, this one is a implementation of the much lighter physics engine Nape, here it is!
Let me know your thoughts!
package
{
import flash.display.Sprite;
import flash.events.Event;
import nape.geom.Vec2;
import nape.phys.Body;
import nape.phys.BodyType;
import nape.shape.Polygon;
import nape.space.Space;
import nape.util.ShapeDebug;
/**
* ...
* @author Sp Games
*/
public class Main extends Sprite
{
public function Main():void
{
var space:Space = new Space(new Vec2(0, 600));
var debug:ShapeDebug = new ShapeDebug(600, 600, 0x333333);
addChild(debug.display);
var border:Body = new Body(BodyType.STATIC);
border.shapes.add(new Polygon(Polygon.rect(0, 0, -40, 600)));
border.shapes.add(new Polygon(Polygon.rect(600,0,40,600)));
border.shapes.add(new Polygon(Polygon.rect(0,0,600,-40)));
border.shapes.add(new Polygon(Polygon.rect(0, 600, 600, 40)));
border.space = space;
var block:Polygon = new Polygon(Polygon.box(50, 50));
var body:Body = new Body(BodyType.DYNAMIC);
body.shapes.add(block);
body.position.setxy(stage.stageWidth / 2, stage.stageHeight / 2);
body.space = space;
addEventListener(Event.ENTER_FRAME, function (_:Event):void {
debug.clear();
space.step(1 / stage.frameRate, 10, 10);
debug.draw(space);
debug.flush();
});
}
}
}
Thanks again guys.
Thursday, October 13, 2011
Tutorial 1: Hello Box World!
Hey Team,
Here is the first in my series of Flash Develop Tutorials, this is entitled: Box2D Hello Box World!
Super excited to be hearing my voice on the YouTubes. It was only a matter of time...
Here is the source code that you will end up with once you have finished this tutorial. In the future, and as the tutorials get bigger, I'll get a github account to upload to otherwise my blogs are going to get even longer :O.
Here is the source code that you will end up with once you have finished this tutorial. In the future, and as the tutorials get bigger, I'll get a github account to upload to otherwise my blogs are going to get even longer :O.
package
{
import Box2D.Collision.Shapes.b2CircleShape;
import Box2D.Common.Math.b2Vec2;
import Box2D.Dynamics.b2BodyDef;
import Box2D.Dynamics.b2Body;
import Box2D.Dynamics.b2DebugDraw;
import Box2D.Dynamics.b2FixtureDef;
import Box2D.Dynamics.b2World;
import flash.display.Sprite;
import flash.events.Event;
/**
* ...
* @author Sp Games
*/
public class Main extends Sprite
{
public var world_scale:Number = 30;
public var world:b2World = new b2World(new b2Vec2(0, 9.8), true);
public function Main():void
{
addEventListener(Event.ENTER_FRAME, update);
add_circle();
debug_draw();
}
public function add_circle():void
{
var my_body:b2BodyDef = new b2BodyDef();
my_body.position.Set((stage.stageWidth / 2) / world_scale,
(stage.stageHeight / 2) / world_scale);
my_body.type = b2Body.b2_dynamicBody;
var my_circle:b2CircleShape = new b2CircleShape(10 / world_scale);
var my_fixture:b2FixtureDef = new b2FixtureDef();
my_fixture.shape = my_circle;
my_fixture.density = 1.0;
my_fixture.friction = 1;
var body:b2Body = world.CreateBody(my_body);
body.CreateFixture(my_fixture);
}
public function debug_draw():void {
var debug_draw:b2DebugDraw = new b2DebugDraw();
var debug_sprite:Sprite = new Sprite();
addChild(debug_sprite);
debug_draw.SetSprite(debug_sprite);
debug_draw.SetDrawScale(world_scale);
debug_draw.SetFlags(b2DebugDraw.e_shapeBit);
world.SetDebugDraw(debug_draw);
}
private function update(e:Event):void
{
world.Step(1 / 30, 10, 10);
world.ClearForces();
world.DrawDebugData();
}
}
}
Subscribe to:
Posts (Atom)
