Sunday, March 24, 2013
Thursday, March 21, 2013
Tuesday, March 19, 2013
Preparing sprites
Not sure if a design along the lines of this looks better. Let me know.
Started using Unity instead of XNA, cos XNA is DEAD.
Saturday, December 3, 2011
Farseer Engine
Up till this point I've played around with implementing the physics for collisions and reflections, but now I understand the complexities and what I was trying to achieve needed a little more than just axis-aligned shapes and pixel-perfect reflections. I've read up on how Farseer Physics Engine can solve all my world's problems :)
What I wasn't aware of was the Bayazit decomposition algorithm, which breaks up textures into convex polygons. This way, I wouldn't have to calculate the reflection angle based on the surrounding pixels.
I'll give the engine a crack, but for once I think there's some hope in getting these darn mechanics right, giving me more time to focus on gameplay.
What I wasn't aware of was the Bayazit decomposition algorithm, which breaks up textures into convex polygons. This way, I wouldn't have to calculate the reflection angle based on the surrounding pixels.
I'll give the engine a crack, but for once I think there's some hope in getting these darn mechanics right, giving me more time to focus on gameplay.
Monday, October 25, 2010
Seems like its working
I've sort of got it working, I've migrated the code over to XNA 4.0, and it's up and running. However the new Mercury Particle Engine doesn't load the old emitter files !@#$ So the next thing on my itineary is to create new particle effects...actually scratch that, I'll leave that to last. It's a real headache because for some reason whenever I scale my projectiles they don't collide properly. I'll have to look into that.
Anywho, I think I've got the mechanics working! Finally. Jeez. Turns out it wasn't a logic error, I'd written a for..loop incorrectly. How annoying is that! Kept getting 'divided by zero' errors (did I mention that?) because of an incorrectly populated array. I could probably move on to the level design, make a prototype so I have something to SHOW for all this.
Anywho, I think I've got the mechanics working! Finally. Jeez. Turns out it wasn't a logic error, I'd written a for..loop incorrectly. How annoying is that! Kept getting 'divided by zero' errors (did I mention that?) because of an incorrectly populated array. I could probably move on to the level design, make a prototype so I have something to SHOW for all this.
Friday, October 8, 2010
Long time no post
Dang, seems like this project closed huh. Some stuffs been going on in my life; new job, destroyed laptop, new house, new computer etc.
So yes, the project is still underway :)
Have been busy trying to get the project working on my new machine, and then I realise Microsoft upgraded from Game Studio 3.1 to 4.0 !@#$ Loads of changes, certain graphic types have been removed, and method declarations revamped, so I've been fixing it up...slowly but surely.
With that said, it's funny I've come back onto this project at this time, because if I'd done it any earlier the Mercury Particle Engine I'm using wouldn't have a release for XNA 4.0, but it came out yesterday!
That and I'm bored.
So yes, the project is still underway :)
Have been busy trying to get the project working on my new machine, and then I realise Microsoft upgraded from Game Studio 3.1 to 4.0 !@#$ Loads of changes, certain graphic types have been removed, and method declarations revamped, so I've been fixing it up...slowly but surely.
With that said, it's funny I've come back onto this project at this time, because if I'd done it any earlier the Mercury Particle Engine I'm using wouldn't have a release for XNA 4.0, but it came out yesterday!
That and I'm bored.
Sunday, April 4, 2010
Out of country
I've been in Singapore for the past 2 weeks, and havent had any internet access, so my updates have been rather limited.
I'm currently integrating Mercury's Particle editor with the project, hopefully I can create some nice effects.
I'm currently integrating Mercury's Particle editor with the project, hopefully I can create some nice effects.
Friday, March 19, 2010
Tuesday, March 16, 2010
Update
I got the state machine in working order! Switch..cases are history! It'll be alot easier to organize everything now.
Well actually, I completed the FSMs about a week ago. Had other personal stuff to get out of the way before a hearty blog write-up.
With player handling out of the way, I've begun character design. I've never been good at art, but I do love drawing, hence I'll probably end up doing all the art me self (artists hugely welcomed tho). Here's what I've got so far:
(expects harsh criticism) ..anyway, I reckon I can animate him effectively..will have to wait and see.
Well actually, I completed the FSMs about a week ago. Had other personal stuff to get out of the way before a hearty blog write-up.
With player handling out of the way, I've begun character design. I've never been good at art, but I do love drawing, hence I'll probably end up doing all the art me self (artists hugely welcomed tho). Here's what I've got so far:
![]() | ![]() |
(expects harsh criticism) ..anyway, I reckon I can animate him effectively..will have to wait and see.
Friday, March 5, 2010
Finite State Machines
So..in order to get any sort of AI down, I'm going to need FSMs. This made me think about the spaghetti code I'd already constructed for the player.
Hence, I shall rewrite the player code so everything stems from FSMs. Could take awhile.
Hence, I shall rewrite the player code so everything stems from FSMs. Could take awhile.
Wednesday, March 3, 2010
Enemies, no hard-coding
I've been losing a bit of motivation because of a lack of art, but I've done alot of thinking about which area I should move on to next, and have decided on enemy AI.
My plan is to load data for every enemy on the screen using XML. Sprite file name, locations, actions, whatever I can think of. Their paths will be determined by possibly a small text/XML file with all their locations at different times.
I'll try implementing all this, and see how it turns out.
My plan is to load data for every enemy on the screen using XML. Sprite file name, locations, actions, whatever I can think of. Their paths will be determined by possibly a small text/XML file with all their locations at different times.
I'll try implementing all this, and see how it turns out.
Saturday, February 27, 2010
About time!
I managed to get all the player mechanics and weapon collisions working! Now if I could get an artist & a music composer...
I can't believe I struggled for the last 2 days to get bouncing working correctly, only to find I made a mistake with the center of a rectangle! By 0.5 to be exact! The darn weapon kept going straight into the 2D terrain...
I really want to show some pictures..but only the mechanics are in working order, not the artwork. So once again..stay tuned! Hopefully a prototype will come under way, once I get enemy mechanics into it.
I can't believe I struggled for the last 2 days to get bouncing working correctly, only to find I made a mistake with the center of a rectangle! By 0.5 to be exact! The darn weapon kept going straight into the 2D terrain...
I really want to show some pictures..but only the mechanics are in working order, not the artwork. So once again..stay tuned! Hopefully a prototype will come under way, once I get enemy mechanics into it.
Tuesday, February 23, 2010
Basic 2D mechanics
Ah I solved my jumping problem, had to add a couple of booleans and update according to time instead of the actual states.
Now I will integrate the theory I mentioned in my second post. Stay tuned! (although I do hope no one is reading this.)
Now I will integrate the theory I mentioned in my second post. Stay tuned! (although I do hope no one is reading this.)
Monday, February 22, 2010
State machine roadblocks
Finding it difficult to get all the states to work together. The main issue is that if my character throws a weapon in the middle of a jump, the translation gets messed up.
Had an awkward cosine formula for the jump, but I redesigned the whole thing so I'd only need plus values and gravity values in the opposite direction, which is what I spent today doing. Quite pleased with the simplification. Probably easier to debug my problem now.
I'll make this short. It's 5am.
Had an awkward cosine formula for the jump, but I redesigned the whole thing so I'd only need plus values and gravity values in the opposite direction, which is what I spent today doing. Quite pleased with the simplification. Probably easier to debug my problem now.
I'll make this short. It's 5am.
Sunday, February 21, 2010
Collision with sprite map, no tiles

This is the solution I have come up with to solve bouncing off slopes.
1) Create a bounding circle around the sprite (black circle).
2) Similarly, create a bounding rectangle the same size as the 'weapon' on the collision mask. All my collisions are done this way.
3) Per-pixel collision between circle and rectangle, if no collision, no bounce.
4) Check all pixels within the map's collision rectangle against the circle. If the pixels can be contained within the circle, store their locations.
5) Using those stored locations, form a best-fit rectangle around them (red lines). From this, find the center of the rectangle.
6) The vector formed between the center of the circle and the circle of that rectangle is the line of incidence (blue line).
7) Reflect the direction vector of the weapon around the incident vector. (black lines)
Woah, that's a long explanation, but its pretty logical (at least to me).
A few other solutions which came up to mind are (briefly)
1) Line map; a text file with a series of 'points' defining lines. From those points I could then find the gradient; if there is a collision (using ray-casting), use some physics to calculate bounce angle. But then I'd need to manually come up with all the points, and read them from the file!
2) Colour map; use RGB values to define gradients (in a collision mask). Most certainly not.
Friday, February 19, 2010
Very first post
Alright let's get things started!
Been building a game in XNA since November 2009, sorta drifted away from the idea, and have now reopened the project.
I've had a general game design in my head, but not one solid enough to put down on paper. Basically, its a 2D platformer where the player shoots off a weapon which bounces off the screen & walls like in Pong, and hits enemies above him as though you were playing Galaxian.
I've pretty much been handling the coding of the player's states, and the collisions. Been struggling to understand how I'm going to get a weapon to bounce off a 2D map. Currently, I'm using a separate collision map.
Only yesterday did I manage to get some headway with the player's character's collisions. The player can now jump, and land on a 2D map, as well as going up slopes, all while being affected by gravity. I shunned using a tilemap, it just doesn't look spiffy enough, as such it's not as easy to calculate collisions against inclined surfaces.
I'll conclude this post for now, hopefully I'll get somewhere by today.
Been building a game in XNA since November 2009, sorta drifted away from the idea, and have now reopened the project.
I've had a general game design in my head, but not one solid enough to put down on paper. Basically, its a 2D platformer where the player shoots off a weapon which bounces off the screen & walls like in Pong, and hits enemies above him as though you were playing Galaxian.
I've pretty much been handling the coding of the player's states, and the collisions. Been struggling to understand how I'm going to get a weapon to bounce off a 2D map. Currently, I'm using a separate collision map.
Only yesterday did I manage to get some headway with the player's character's collisions. The player can now jump, and land on a 2D map, as well as going up slopes, all while being affected by gravity. I shunned using a tilemap, it just doesn't look spiffy enough, as such it's not as easy to calculate collisions against inclined surfaces.
I'll conclude this post for now, hopefully I'll get somewhere by today.
Subscribe to:
Posts (Atom)


