Jump to content
A nice cup of tea

The Game Development Thread

Recommended Posts

I think it's pretty shocking that this sub-forum is barely touched so I've started this thread for people to discuss what new things their teaching themselves in regards to game programming.

I wrote a pathfinder for the first time last week, I used this article as a guide but mine ended up much simpler, only using one variable to determine the optimal path, but it hasn't failed me yet. Drawing the path was much easier than getting a sprite to actually follow it but I worked quite hard on it over the weekend and apart from a few bugs its working smoothly even with collision turned on, I was expecting a lot of getting stuck to walls.

Writing this also helped me with my trigonometry, I learnt to use atan2(y, x) to point the sprite at the next node. Got stuck for a while when I forgot to convert the result back into degrees. Doh

  • Upvote 1

Share this post


Link to post
Share on other sites

I wrote an incredibly over engineered OpenGL 3.2 based sprite renderer at the weekend that uses instancing and geometry shaders. Going to use it to create a tile engine this weekend and see if I can hook my deferred lighting shader into it for that cool realtime lit sprite game look.

  • Upvote 1

Share this post


Link to post
Share on other sites

I'm getting to grips with GameMaker and using it's script editing and other functions while I work on my Shmup. It's difficult to get my head around the whole process but it's really exciting.

  • Upvote 1

Share this post


Link to post
Share on other sites

Anything your stuck on in particular that we might be able to help with?

I'm thinking I might next work on giving my sprites a field of view for a natural stealth element. I can define the triangle quite easily but detecting Triangle intersects Rectangle looks quite tricky.

Share this post


Link to post
Share on other sites

I'm still working on my XNA platform shooter, although progress has slowed ever so slightly upon resuming full time employment.

Currently, my focus is on getting the thing functionally complete, then it's just a matter of adding more content and polish. I'm nearly there. Nearly.

  • Upvote 1

Share this post


Link to post
Share on other sites

I'm currently working on our mutiplayer Xbox game, Chompy Chomp Chomp. We're just finishing a rewrite so we can implement online multiplayer a bit better (I say we, it's not me that's doing that bit... that stuff is hard!)

  • Upvote 1

Share this post


Link to post
Share on other sites

How about a sneak peek screenshot from you guys developing XNA stuff.

I did dip into XNA but I will never finish a project, I get bored as soon as I have an engine up and running and want to move onto something else or lose interest entirely for a few months. Its tough trying to come up with a vision you think is worthy of your time and viable with the lack of asset resources, and I am particularly uninspired by gaming at the moment.

Share this post


Link to post
Share on other sites

What happened to the existing "what are you working on thread"? I can't find it at all...

Anyway I've been messing around with Unity with the intentions of using it for Bit By Bit Games' first big project. I've rolled out one update for Endless Lines this year, but I've reached the number of sales I said I'd wait to hit before adding achievements - since most of the reviews wanted achievements... in a action puzzle game... Need to update website. Need to finish the iOS game I've got half written. And I'm lending my programming skills as a contractor to an unannounced game at the moment - was not in the plans when I left AAA dev, but it's going to help pay for me to live during the indie years for a while.

(edit: added some missing words)

Share this post


Link to post
Share on other sites

What happened to the existing "what are you working on thread"? I can't find it at all...

Anyway I've been messing around with Unity with the intentions of using it for Bit By Bit Games' first big project. I've rolled out one update for Endless Lines this, but I've reached the number of sales I said I'd wait to hit before adding achievements - since most of the reviews wanted achievements... in a action puzzle game... Need to update website. Need to finish the iOS game I've got half written. And I'm lending my programming skills as a contractor to an unannounced game at the moment - was in the plans when I left AAA dev, but it's going to help pay for me to live during the indie years for a while.

It's there if you filter to posts from further back via changing timeframe in the custom option above the topics list.

Achievements has undoubtedly changed games to a somewhat weird place. Now that they are there people need them everywhere for that target to aim for or they feel aimless which is kind of fair enough really if going for hiscores doesn't hold enough drive. Plus at least some of them hold novelty value too, but I wish some games would reclaim the goldeneye style targets for achievements where they actually rewarded you ingame instead of being just a meaningless point value....

Share this post


Link to post
Share on other sites

Anything your stuck on in particular that we might be able to help with?

Not really, the whole experience is just new and I'm getting used to it. I've got a framework up and running for my static, one screen shooter/puzzler hybrid, but one of my core gameplay mechanics (cutting things) is giving me a bit of a headache.

I'm going to set up a blog and start updating my progress on the whole project as soon as I've decided on a name to use, putting a splash screen with "Patrick Allen" on it doesn't feel very gamey so I'm trying to think of a company/studio name and logo.

Share this post


Link to post
Share on other sites

It's an interesting challenge dependant on what sort of object your cutting and how free form you want the cutting to be. I might try something like it myself, I reckon I could take the angle and entry point of the cut and map it with the sprite data and produce 2 new sprites.

Share this post


Link to post
Share on other sites

That's what I'm trying to achieve I guess, I want the laser weapon to cut objects but I'd like the 2D objects to be cut exactly where the laser hits and divide into unequal pieces accordingly. It's confusing and I wish there was more art work to do, as at least I'm familiar with the principles of that :)

Share this post


Link to post
Share on other sites

I have no idea about game maker scripts but is there a function to capture an area of the screen and store it as an image? You could then use the sprite and lasers position to define the area it should capture, do that either side of the laser, delete the original and replace.

Just watched this amazing talk http://vimeo.com/36579366 well worth checking out the first 20 minutes, this is the future.

  • Upvote 1

Share this post


Link to post
Share on other sites
I did dip into XNA but I will never finish a project, I get bored as soon as I have an engine up and running and want to move onto something else or lose interest entirely for a few months. Its tough trying to come up with a vision you think is worthy of your time and viable with the lack of asset resources, and I am particularly uninspired by gaming at the moment.

This sounds exactly like me. I was working on something before Christmas but got distracted by Christmas, a couple of games and work being particularly busy so not wanting to code at home. I occasionally load up the project and tidy bits up but then get to the points I was stuck on previously and find something else to do. The things I'm stuck on aren't even hard problems, they're just annoying/time consuming and I can't find the motivation to work around them.

Share this post


Link to post
Share on other sites

Just watched this amazing talk

well worth checking out the first 20 minutes, this is the future.

I watched that the other week, the entire thing is brilliant - the animation app is brilliant.

Share this post


Link to post
Share on other sites

I hate to be the one to spam the thread but I have a question about collision detection.

Obviously by detecting intersections between the sprite and walls I can tell him when to stop moving when he contacts a wall but I want him to slide against it in the way we're all used to. To do this I need extra information about the collision.

First method I tried: I defined a thin rectangle around each side of the main rectangle and checked for collision in each one to see which side was colliding. I found this very fiddly and imagine it's something I would be debugging till the end.

Second method: I calculate a normal of the intersection and then work out which side it's closest to and go with that. This feels a bit more solid but I'm still having some problems with it.

I can't find the perfect solution for this and it was obviously solved a very long time ago. I would love to see the code for the original mario's collision. I have looked into 3d collision detection, defining line segments from intersecting planes and stuff but I wouldn't have thought it was necessary for a straightforward 2d game.

Share this post


Link to post
Share on other sites

yeah, collision normals and you have to solve for both axis at the same time, you can't do one then the other (a mistake I've personally make). I can look out the collision code for the

I wrote last year. It looks like it's tile based but the collision is actually arbitrary rectangles (easily translatable to tiles) and collision lines too (can jump up through them but not fall through them) but we didn't use them in the end. The player has a simple collision rect, well actually two - one for standing still and one for moving.
  • Upvote 1

Share this post


Link to post
Share on other sites

Using a pretty standard rectangle intersection function as far as I'm aware, no problems with this


Update.prototype.IsRectIntersect = function(arg1, arg2) {
if(arg1.position.x + arg1.size.x - Game.colBuffer > arg2.position.x) {
if(arg1.position.x < arg2.position.x - Game.colBuffer + arg2.size.x) {
if(arg1.position.y + arg1.size.y - Game.colBuffer > arg2.position.y) {
if(arg1.position.y < arg2.position.y - Game.colBuffer + arg2.size.y) {
return true;
}
}
}
}
return false;
}

and heres my method for determining the side, this is the first time I've tried this method. <bad code defence>Obviously a rough draft of the code, all sprites are 32x32 which is why 16 is hard coded in</bad code defence>


Update.prototype.WhichSide = function(argNormal) {
var sides = Array();
sides[0] = false; // Top
sides[1] = false; // Bottom
sides[2] = false; // Left
sides[3] = false; // Right

var normal = new Vector2();

normal.x = Math.floor(argNormal.x + 16);
normal.y = Math.floor(argNormal.y + 16);

if (normal.x < 0) { var xScore = normal.x + 16; }
if (normal.x > 0) { var xScore = normal.x - 16; }
if (normal.y < 0) { var yScore = normal.y + 16; }
if (normal.y > 0) { var yScore = normal.y - 16; }

if (xScore > yScore) {
if (normal.x < 0) { sides[2] = true; }
if (normal.x > 0) { sides[3] = true; }
if (normal.x == 0) { sides[2] = true, sides[3] = true; }
}
if (xScore < yScore) {
if (normal.y < 0) { sides[0] = true; }
if (normal.y > 0) { sides[1] = true; }
if (normal.y == 0) { sides[0] = true, sides[1] = true; }
}
if (xScore == yScore) {
if (normal.x < 0) { sides[2] = true; }
if (normal.x > 0) { sides[3] = true; }
if (normal.y < 0) { sides[0] = true; }
if (normal.y > 0) { sides[1] = true; }
if (normal.x == 0) { sides[2] = true, sides[3] = true; }
if (normal.y == 0) { sides[0] = true, sides[1] = true; }
}

return sides;
}

and the next problem is reacting to the collision of course, I'm currently just storing the last good position and returning to that which is working fine for now.

Share this post


Link to post
Share on other sites

I'm just about to put my third game in for review on XBLIG. It began because I wanted to simulate rope swinging, which I'm proud of myself for doing, but it was a bit too accurate and not fun enough, so I made it you could accelerate yourself whilst swinging, and then the rope stuck to all the surfaces it touched,and from that a game was born.

Regarding collision detection, I'm no programmer, and thhe biggest headache I had was working out which side the collision happened when using rectangles, and that all came down to trig in the end.

Share this post


Link to post
Share on other sites

Gadabout, in order to react to the collision when you're using rectangles, you simply need to determine how far the first rectangle has intersected the other.

This is pretty easy - you can use the centre point of the two rectangles to determine which side the intersection is on (if the centre of rect1 is to the right of the centre of rect2, then the intersection is on the right hand side), then calculate the overlap (for the right hand side, that's rect2.Right - rect1.Left, giving you a positive value which you can add to rect1 in order to push it outside.

You also only need to fix one axis to push the rectangle outside. The benefit of this then is that with rect-rect collisions the collision normal isn't required for the fix, as it's basically the unit vector on either axis and applying it to the velocity of the moving object will eliminate movement on that axis, leaving the other on touched.

Bingo - you have your collision detection, response and sliding.

The collision normal comes into play when the collision surface isn't aligned with either axis, for example if you collide a rect with a circle, or a sloped surface. Here, you use the same basic principle - calculate the extent of the intersection, apply the fix, and then apply the collision normal using the dot product. I'll fish out my code for this later this evening when I get home (and if I remember! :P)

  • Upvote 1

Share this post


Link to post
Share on other sites

This is pretty easy - you can use the centre point of the two rectangles to determine which side the intersection is on (if the centre of rect1 is to the right of the centre of rect2, then the intersection is on the right hand side), then calculate the overlap (for the right hand side, that's rect2.Right - rect1.Left, giving you a positive value which you can add to rect1 in order to push it outside.

But won't the rectangle be to one side horizontally and vertically (unless exactly in the middle on one axis) at the same time, how would you determine whether its a vertical or horizontal collision. I guess you could use the current velocity/direction.

Actually I think you explained it in that next paragraph, I'm not quite getting it tho, I will do some research.

Good thread.

Share this post


Link to post
Share on other sites

I'm a PHP developer by trade, but in my spare time I'm trying to write a game from scratch using the Android SDK. I did a little Java at university but I've not used it in years so this is learning experience for me with three aspects: a new language; a new environment; and a new type of software design.

I've started by downloading the source for Replica Island, which is sufficiently documented for me to use as my sole learning resource. Getting an app running on my phone was a piece of cake, but getting it to do anything interesting is naturally a whole different kettle of fish.

At the moment I'm knee-deep in OpenGL ES, sprite rendering, frame buffering, game state graphing, and UI-threading. I've been taking on too much at once I know, but I remain enthusiastic about my endeavours, despite the sum of my rewards of an evening of programming often being little more than an app which does nothing, but executes without throwing exceptions.

I have managed to get it to change the colour of the GL surface depending on the co-ordinates of a touchscreen press, and play a "ping" sound, so I do have something to show my wife for my efforts staring at a computer screen for long hours after dinner, but eventually I'd like to have an actual game to show people. I've made it a goal to actually have something for sale on the Android Marketplace by the end of the year, I just hope our impending house move doesn't shake my resolve. :)

Share this post


Link to post
Share on other sites

I think it would be nice if we could cover a lot of the standard areas of simple game programming in this thread. With people adding their advice tips and tricks it could be a great resource for people.

Revlob, whats your next task with your app? Get some graphics on the screen maybe?

I did play around with Android SDK but I only did 3D stuff. I managed to write an importer for RAW mesh files which worked but I have no idea how to texture them and gave up. Texturing a cube or plane, yeah fine, texturing a random mesh of triangles, NO.

Share this post


Link to post
Share on other sites

Revlob, whats your next task with your app? Get some graphics on the screen maybe?

Yes. I've getting the hang of simple 2D vector spaces, and I have a simple camera which is a 2D vector in my game space. In between the frame buffer and the graph I'll need a renderer which queries the graph to determine which nodes are currently drawable, and then pull their sprites out of a pool of pre-loaded sprite instances and draw them in their relevant positions in the frame.

  • Upvote 1

Share this post


Link to post
Share on other sites

But won't the rectangle be to one side horizontally and vertically (unless exactly in the middle on one axis) at the same time, how would you determine whether its a vertical or horizontal collision. I guess you could use the current velocity/direction.

Use whichever has the smallest absolute value. If they're both the same, give priority to one axis over the other, as it produces a smoother result than fixing both axes - if your character was to fall towards a wall and hit the exact corner of it, you'd rather he either landed on it or slid down it than coming to an immediate halt at the corner before falling again.

Generally this will produce an accurate result, but if your character is moving fast enough when he runs into a thin wall, he might pop through to the other side. That's an inherent flaw in the collision system being used, and can be avoided with sufficient update rates (mine's 60fps) and ensuring that any fast moving object is tested in multiple steps so that in any one step, it never moves further than its own radius.

  • Upvote 1

Share this post


Link to post
Share on other sites

My current stuff is now hosted here if you want to see a demo. It's just my test bench for collision and path finding. Sprite on sprite collision is switched off. The buttons on the left side of view ports switch it with the main view port, the buttons on the right will make that sprite move to the sprite in the main view port. Theres a bug where if you don't have the sprite thats following the path in the main view port when it reaches its destination it will run off the screen.

Share this post


Link to post
Share on other sites

My current stuff is now hosted here if you want to see a demo. It's just my test bench for collision and path finding.

If you are interested in collision detection I recommend the book "Real Time Collision Detection" http://realtimecolli...net/books/rtcd/ it is very good. Though it doesn't cover response so much, the section on Separating Axis Tests might be useful to you.

edit:

Actually looking at your game, after you know it is colliding with a wall, move it so that it is not colliding and then perhaps you could just take the perpendicular vector of the normal to the wall (Norm(x,y) becomes Perp(-y,x)) and then move the object based on a dot product between the intended movement and Perp vector. i.e. if Move dot Perp is positive move in the direction of Perp, if negative move in the opposite direction of Perp.

/edit

I am slowly working on a game involving lights in my spare time.

Still not much of a game in there. I do have a much more structured, less pretty test bed for the game side of things but it is still very early on. I've been making really slow progress recently as i've decided to throw out a lot of the old OpenGL (older than 3.x/4.x) code from my framework which also resulted in me doing a bit of a clean up in other areas too.

Share this post


Link to post
Share on other sites

Presently my ever-more-fucking-tedious game metrics suite for my dissertation. I'll post up some screenies on my blog and in here when it's in a more functional form. Shouldn't be far off.

I'm also teaching myself Gamemaker to knock together a few prototypes (because I'm doing testing for the people who make it and maybe if I make something okay they'll help me finish and publish it).

Also I finally got that fuckbag Bada phone I got back in August working with the default SDK example programs, so I'll be knocking up some things with that.

And there's that Edge Unity Jam thing in March I think I'll take part in.

All of that might seem a lot but I'm going to start on little things and give myself clear, easy-to-achieve goals that I can build on. Maybe I'll try porting a prototype from Android to Bada.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.