Well, been a while since I updated this.
Appropriate though, as I haven't done much in months due to work & health issues.
On the plus side, finally got to the bottom of my health issues and now on the mend - going to take a while but things looking up. Thankfully turns out it wasn't serious, but the knock on effects were worse than the actual problem (as well as masking it).
So, finally picked this up again after a bit of a hiatus, and promptly got lots done.
First off, finished the alien movement routine off - so thats working properly now. Contemplating on whether to add some other types / modes, but Im getting a little bored with this now, and function creep is always a problem. Originally wasn't going to have aliens in the game at all.
Next was the biggie - while trying to bughunt down a couple of particularly persistent issues, I got hacked off enough to say "screw it" and ended up re-writing the entire collision detection routine again, then optimising it.
This has massively simplified things (to the point where the code for collisions has dropped in size by 75% - yeah, my coding is somewhat sloppy during the dev process, but thats a bit much even by my standards), had some beneficial side effects, increased my understanding and caused a few things to break too.
Most of the breakages seem to be in the powerup side of things and should be relatively easy to fix - I'm going through them at the moment to determine what works and what doesn't.
And I finally found the source of a particularly pernicious bug. I was getting a large "lag" or "stutter" when the first block was being destroyed on the first level - and it didnt occur after that. After much headscratching it turns out the problem was down to the sound effects playing for the first time. Even though theyre pre-loaded, it was acting as if they werent loaded into memory. Simple fix, play the sounds at zero volume during game loading - bye bye issue.
Showing posts with label WIP. Show all posts
Showing posts with label WIP. Show all posts
Thursday, 17 November 2016
Saturday, 27 August 2016
Retronoid Update XXI
Lets get this ball rolling again, shall we?
This week, I have been mostly dealing with... aliens! Well, I call 'em aliens, but who really knows what they're supposed to be.
I finished off the graphics for my first "proper" alien sprite, which I'm really happy with. If youve been following this for a while, you'll recall I'm largely in the "programmer graphics" camp - so if I get anything that looks even halfway decent then I'm over the moon. So far for this game I'm unbelievably happy with how the graphics are turning out, given that (lack of) skill set. Might do another one or two in a similar theme when I've finished the routines for collision, but this will do for a start & all the testing that needs doing.
Did the "shadow" graphics for the sprite above.
Here's a single frame of what it looks like - its animated around the vertical axis so it looks like two sets of spheres rotating..
Added some code to animate the alien based on whether they're moving left or right.
Added the ball / alien collision code - this was actually only a minor modification of the big collision routine I rewrote to allow for a new class of collision object, tested it and it seems to work perfectly!
Tweaked some of the border graphics.
Just starting in on the actual alien / brick collision code & resultant movement routines.
And that's it for this week as I'm trying to ease myself back into stuff gently. When I've finished the "alien" code I might do another quick video.
This week, I have been mostly dealing with... aliens! Well, I call 'em aliens, but who really knows what they're supposed to be.
I finished off the graphics for my first "proper" alien sprite, which I'm really happy with. If youve been following this for a while, you'll recall I'm largely in the "programmer graphics" camp - so if I get anything that looks even halfway decent then I'm over the moon. So far for this game I'm unbelievably happy with how the graphics are turning out, given that (lack of) skill set. Might do another one or two in a similar theme when I've finished the routines for collision, but this will do for a start & all the testing that needs doing.
Did the "shadow" graphics for the sprite above.
Here's a single frame of what it looks like - its animated around the vertical axis so it looks like two sets of spheres rotating..
Added some code to animate the alien based on whether they're moving left or right.
Added the ball / alien collision code - this was actually only a minor modification of the big collision routine I rewrote to allow for a new class of collision object, tested it and it seems to work perfectly!
Tweaked some of the border graphics.
Just starting in on the actual alien / brick collision code & resultant movement routines.
And that's it for this week as I'm trying to ease myself back into stuff gently. When I've finished the "alien" code I might do another quick video.
Sunday, 21 August 2016
Retronoid Update-ette
Hi folks
been a while, so time for a quick update.
Health issues continuing - so far doesn't seem to be anything serious, but so far they haven't found whats keeping me in constant pain. Between that, work, family and KSP / No Mans Sky - not a lot going on.
However - I've been looking at the code this week and managed to scrape out some odds and ends, as follows:
Collision routines for the alien / block collisions next to get the movement routines fully implemented, then it will be alien / ball collisions.
TTFN!
been a while, so time for a quick update.
Health issues continuing - so far doesn't seem to be anything serious, but so far they haven't found whats keeping me in constant pain. Between that, work, family and KSP / No Mans Sky - not a lot going on.
However - I've been looking at the code this week and managed to scrape out some odds and ends, as follows:
- Tied the transition effects into the frame limiting code (which I'd forgotten to do)
- Tied the Ball Launch Indicator into the frame limiting code as well
- Fixed a bug where the ball would very occasionally go right through the bat
- Added some code to clean the aliens up correctly at the end of a level / game
- Drew my first proper "alien" animation - although its not finished yet, I'm really happy with it.
- Tweaked the spawn points and associated graphics
- Started in on the alien code proper, added direction code, animation controls, and a few other odds.
Collision routines for the alien / block collisions next to get the movement routines fully implemented, then it will be alien / ball collisions.
TTFN!
Friday, 29 April 2016
Retronoid Update XX
Hello! Update 20 already... yeah, I know I'm slow :-)
What's been happening since the last update? Well, quite a bit actually....
First off, I added some debris particles to the bat explosion - just some simple stuff using existing code.
Tidied up some code and got rid of some that was no longer needed, tidied up a couple of routines.
Arena Changes
As alluded to last week, I've made the arena a bit smaller by 2 blocks width. I updated the relevant bits of code pretty quickly, but as suspected, it pretty much took a couple of evenings to update all the level data (as its hard coded into the game, I'm too lazy to make a level editor). Took the opportunity to tweak some of the levels while I was at it.
Had a good test and it plays much better - here's a quick screenshot of one of the later levels..
I'm Telling You...It was ALIENS!
Yep, finally started work on adding the aliens.
And that it for another update.
TaTa!
What's been happening since the last update? Well, quite a bit actually....
First off, I added some debris particles to the bat explosion - just some simple stuff using existing code.
Tidied up some code and got rid of some that was no longer needed, tidied up a couple of routines.
Arena Changes
As alluded to last week, I've made the arena a bit smaller by 2 blocks width. I updated the relevant bits of code pretty quickly, but as suspected, it pretty much took a couple of evenings to update all the level data (as its hard coded into the game, I'm too lazy to make a level editor). Took the opportunity to tweak some of the levels while I was at it.
Had a good test and it plays much better - here's a quick screenshot of one of the later levels..
![]() |
| (Level 33) |
I'm Telling You...It was ALIENS!
Yep, finally started work on adding the aliens.
- Finished amending some of the arena graphics to accommodate the spawn points. They're unnoticeable unless they spawn an alien.
- Knocked up a quick graphic so I can actually test something.
- Created the alien object and code to actually create them in game.
- Added a spawn timer & trigger for each of the doors.
- Worked out on paper what I want the spawning effect to look like.
And that it for another update.
TaTa!
Saturday, 23 April 2016
Retronoid Update XVIIII
Hello folks.
Not done too much this week, been laid up for most of it with a nasty stomach bug, and what little time I had left was spent finishing the prep work in the spare bedroom ready for the plastering next week.
That said, some stuff got done (mostly just after last weeks update), a lot of which was polish:
Powerups :
Still some very minor tweaks to do to stop rares popping up too often, and to avoid duplicates immediately after one another, but that should be pretty simple.
Other:
Big Change:
After a fair bit of playtesting I've decided that the levels are too large horizontally, so I'm going to remove two columns from each level and make them a bit narrower. I threw in a test level at the relevant width, and that played much better.
This will mean a little bit of a re-write of some code, but most of it is already built to accommodate such a change. Worst will be going through each level already coded in and changing those. Probably no more than an evenings work though.
And that's about it for this time, thanks for reading.
Not done too much this week, been laid up for most of it with a nasty stomach bug, and what little time I had left was spent finishing the prep work in the spare bedroom ready for the plastering next week.
That said, some stuff got done (mostly just after last weeks update), a lot of which was polish:
Powerups :
- Level Skip is now in and working correctly - just got to add some particle effects to it. Basically the bat gets "rocketed" off the top of the screen as the level transition happens, and descends back in before play restarts on the next level.
- Added some messages to let the player know when the Destroyer, LaserBall, Graviton Beam and Forcefield are depleted.
- Completely re-wrote the powerup spawn routine - each block now has a drop chance, and when its destroyed this is added to the drop chance running total. If that hits 100, or if the random check produces a number less than the current dropchance, it will spawn a powerup.
- Powerups are now split into 4 categories, common, uncommon, rare and very rare, and spawn accordingly.
- Removed any powerups that were dropping down the screen when a level ends.
Still some very minor tweaks to do to stop rares popping up too often, and to avoid duplicates immediately after one another, but that should be pretty simple.
Other:
- Added a coloured "flash" to the blocks when they are hit, and trigger this before they're destroyed.
- Changed the level switch trigger so that it occurs when the last block has actually finished its animation on destruction.
Big Change:
After a fair bit of playtesting I've decided that the levels are too large horizontally, so I'm going to remove two columns from each level and make them a bit narrower. I threw in a test level at the relevant width, and that played much better.
This will mean a little bit of a re-write of some code, but most of it is already built to accommodate such a change. Worst will be going through each level already coded in and changing those. Probably no more than an evenings work though.
And that's about it for this time, thanks for reading.
Friday, 15 April 2016
Retronoid Update XVIII
Hi there!
It doesn't feel like I've done much this week as I've had a houseful of kids underfoot all week - kids + noise does not make for a conducive coding environment.
So lets see what got done...
Powerup Balancing
This was proving a bit more complex than I originally thought, but finally think Ive nailed the last of it.
Block Destroyer & Laserball - these now scale with the number of playthroughs, keeping the block destruction consistent. When active, neither contribute to the score multiplier.
Block Destroyer - When active, ball only passes through blocks that require 1 hit (multiplied by playthrough), and blocks that require more than one hit will take a bigger chunk of damage AND cause the ball to bounce. Bounces off indestructible blocks. All of which leads to some nice gameplay.
Tripleball - Fixed a bug with tripleball not refreshing correctly.
Forcefield - now refreshes if another forcefield drop collected, and if fully powered grants a score bonus.
Also increased the drop speed of the powerup containers as well.
Other Stuff
Tweaked the player death effect
Reset the ball launch angle indicator when switching levels or life lost
Heres a couple of screenshots of the latest build.
And thats it - a little more than I was hoping, to be honest.
It doesn't feel like I've done much this week as I've had a houseful of kids underfoot all week - kids + noise does not make for a conducive coding environment.
So lets see what got done...
Powerup Balancing
This was proving a bit more complex than I originally thought, but finally think Ive nailed the last of it.
Block Destroyer & Laserball - these now scale with the number of playthroughs, keeping the block destruction consistent. When active, neither contribute to the score multiplier.
Block Destroyer - When active, ball only passes through blocks that require 1 hit (multiplied by playthrough), and blocks that require more than one hit will take a bigger chunk of damage AND cause the ball to bounce. Bounces off indestructible blocks. All of which leads to some nice gameplay.
Tripleball - Fixed a bug with tripleball not refreshing correctly.
Forcefield - now refreshes if another forcefield drop collected, and if fully powered grants a score bonus.
Also increased the drop speed of the powerup containers as well.
Other Stuff
Tweaked the player death effect
Reset the ball launch angle indicator when switching levels or life lost
Heres a couple of screenshots of the latest build.
(Menu with HiScore)
(Level Transition)
(Level 4, with ball angle indicator visible)
And thats it - a little more than I was hoping, to be honest.
Friday, 8 April 2016
Retronoid Update XVII
Time for an update methinks.
The spare room proceeds apace. Almost at the point for the replastering to be done, been a slog but almost there.
Oh, you wanted to know about the game? Sorry....
Despite the building work and the release of Kerbal Space Program 1.1 PreRelease, I managed to get some stuff done..
Stuff!
Game Over! - yes, the fail state is in and working. One minor cosmetic tweak to do, but its a proper playable game now. (Has been for ages really, just worked as if it had infinite lives - note to self, add infinite lives cheat).
Tweaked a couple of powerup states that Id missed, resetting things correctly.
Tweaked the brick graphics (again) to better match the new backgrounds.
Started tweaking the border graphics to allow for the aliens to spawn.
Started on the code for adding hiscores.
Did a bit of a code tidy, removing some defunct code.
Did a bit off research on the boss levels in Arkanoid to get an idea of what to do.
Fixed a couple of small bugs.
Added a couple of additional level transition effects.
The Issue
As a funny aside, the law of unintended consequences decided to bite me in the arse. I've had a bug I've been trying to track down for ages - its been pretty rare and tough to duplicate, a real edge case, thought I'd nailed it, and it comes back. What was happening was that occasionally, near the edges of the play area, the ball would pass through the edge of the bat.
Turns out it wasn't a bug. Everything was working as intended.
Basically, the collision routine Id worked out is based of finding the nearest blocks to the ball and working out what one it was going to hit - this was based off centre of ball to centre of block distances. Which is great if everything is the same size, not so great if the bat is bigger or smaller.
Now, it was going to manifest more when I add aliens, so its good I've found it now.
The Solution
In the process of coding it at the moment, but it should be easy to fix. As my objects are all AABB (Axis Aligned Bounding Box) rectagles, instead of checking against the centre of the collision object I can check against the corners, find the nearest, and use that to identify the target block.
Simples!
The spare room proceeds apace. Almost at the point for the replastering to be done, been a slog but almost there.
Oh, you wanted to know about the game? Sorry....
Despite the building work and the release of Kerbal Space Program 1.1 PreRelease, I managed to get some stuff done..
Stuff!
Game Over! - yes, the fail state is in and working. One minor cosmetic tweak to do, but its a proper playable game now. (Has been for ages really, just worked as if it had infinite lives - note to self, add infinite lives cheat).
Tweaked a couple of powerup states that Id missed, resetting things correctly.
Tweaked the brick graphics (again) to better match the new backgrounds.
Started tweaking the border graphics to allow for the aliens to spawn.
Started on the code for adding hiscores.
Did a bit of a code tidy, removing some defunct code.
Did a bit off research on the boss levels in Arkanoid to get an idea of what to do.
Fixed a couple of small bugs.
Added a couple of additional level transition effects.
The Issue
As a funny aside, the law of unintended consequences decided to bite me in the arse. I've had a bug I've been trying to track down for ages - its been pretty rare and tough to duplicate, a real edge case, thought I'd nailed it, and it comes back. What was happening was that occasionally, near the edges of the play area, the ball would pass through the edge of the bat.
Turns out it wasn't a bug. Everything was working as intended.
Basically, the collision routine Id worked out is based of finding the nearest blocks to the ball and working out what one it was going to hit - this was based off centre of ball to centre of block distances. Which is great if everything is the same size, not so great if the bat is bigger or smaller.
Now, it was going to manifest more when I add aliens, so its good I've found it now.
The Solution
In the process of coding it at the moment, but it should be easy to fix. As my objects are all AABB (Axis Aligned Bounding Box) rectagles, instead of checking against the centre of the collision object I can check against the corners, find the nearest, and use that to identify the target block.
Simples!
Thursday, 24 March 2016
Retronoid Update XVI
Another week, another update!
Doing it today as its Easter, so have some family time planned over the weekend, plus a week off work next week means decorating will be occurring rather than coding.
Been busy playtesting, balancing and bug squishing this week.
Powerup happenings:
Graviton Beam - Changed the way the mechanic works, so rather than just changing the angle of the ball, it works as a push / pull gravity field from the bat - which means that with a little practice you can steer the ball, but it feels more natural in terms of gameplay.
Triple Ball - Tweaked things so that if you collect it while multiple balls are active, it will check to see how many balls there are first, and if its less than 3 it will spawn the remainder.
Laserball - now adds a score modifier to each block destroyed.
Score Multiplier - tweaked so that it will still rack up when triple ball is active, but reduced the overall score multiplier scaling a bit. Using the new method the scores were racking up a little too high, too quickly.
Non-powerup related happenings:
Level looping now in, so when you get to the last level it loops round to the first and the scoring changes based on number of playthroughs * block base score. Number of hits each block requires go up in the same way though..
Score reset - hit the maximum score and it loops back round to zero.
Drew up the background tiles and replaced the placeholder tiles with the new ones. So we now have randomly selected backgrounds most of which are in glorious technicolour!
Fixed the last (hopefully) collision related bug. It was a rare one that on occasion allowed the bat to push the ball through the edge of the play area (i.e. when the ball bounced rapidly between the bat and the wall edge). Fixed it by checking to see if the ball was in that location, and moving the bat out of the way instead of the ball. Been wracking my brains for ages on that one thinking it was really difficult (and hence putting it off), and in the end it was pretty simple.
Other stuff:
Been doing a bit or research into what the aliens did in Arkanoid - basically the answer was "not a lot". They're not a threat per se, more of an annoyance. They dont affect the bat in any way, merely wander around the screen providing random deflections and generally annoying the player, until they're destroyed a few hits later. So, should be reasonably easy to put in.
Contemplating putting some boss levels in.
I'm also thinking the play area is a little too wide, so may reduce it by 2 bricks width. Not sure yet if I'll reduce the number of blocks overall (removing 2 whole columns) or just resize the blocks and leave the same amount.
And that's it for this week. Probably wont be an update next week due to the aforementioned family time / building work / decorating. Definitely wont be an update if Kerbal Space Program 1.1 hits Steam.....
Doing it today as its Easter, so have some family time planned over the weekend, plus a week off work next week means decorating will be occurring rather than coding.
Been busy playtesting, balancing and bug squishing this week.
Powerup happenings:
Graviton Beam - Changed the way the mechanic works, so rather than just changing the angle of the ball, it works as a push / pull gravity field from the bat - which means that with a little practice you can steer the ball, but it feels more natural in terms of gameplay.
Triple Ball - Tweaked things so that if you collect it while multiple balls are active, it will check to see how many balls there are first, and if its less than 3 it will spawn the remainder.
Laserball - now adds a score modifier to each block destroyed.
Score Multiplier - tweaked so that it will still rack up when triple ball is active, but reduced the overall score multiplier scaling a bit. Using the new method the scores were racking up a little too high, too quickly.
Non-powerup related happenings:
Level looping now in, so when you get to the last level it loops round to the first and the scoring changes based on number of playthroughs * block base score. Number of hits each block requires go up in the same way though..
Score reset - hit the maximum score and it loops back round to zero.
Drew up the background tiles and replaced the placeholder tiles with the new ones. So we now have randomly selected backgrounds most of which are in glorious technicolour!
Fixed the last (hopefully) collision related bug. It was a rare one that on occasion allowed the bat to push the ball through the edge of the play area (i.e. when the ball bounced rapidly between the bat and the wall edge). Fixed it by checking to see if the ball was in that location, and moving the bat out of the way instead of the ball. Been wracking my brains for ages on that one thinking it was really difficult (and hence putting it off), and in the end it was pretty simple.
Other stuff:
Been doing a bit or research into what the aliens did in Arkanoid - basically the answer was "not a lot". They're not a threat per se, more of an annoyance. They dont affect the bat in any way, merely wander around the screen providing random deflections and generally annoying the player, until they're destroyed a few hits later. So, should be reasonably easy to put in.
Contemplating putting some boss levels in.
I'm also thinking the play area is a little too wide, so may reduce it by 2 bricks width. Not sure yet if I'll reduce the number of blocks overall (removing 2 whole columns) or just resize the blocks and leave the same amount.
And that's it for this week. Probably wont be an update next week due to the aforementioned family time / building work / decorating. Definitely wont be an update if Kerbal Space Program 1.1 hits Steam.....
Saturday, 19 March 2016
Retronoid Update XV
Hi again.
I know, I'm a slow coder. But its a hobby that has to fit in around the rest of my life, and often times life takes priority. Like the missus being ill, for example. That said..
Been an interesting little week here on Retronoid - I'm finding I'm doing more playtesting than coding :-) But stuff is getting done.
So, what's happened this week then? In no particular order
Added a death effect when you lose a life.
Tweaked scoring on the powerups, as follows:
Squashed some bugs that were annoying me.
So - fairly productive all round, considering.
I know, I'm a slow coder. But its a hobby that has to fit in around the rest of my life, and often times life takes priority. Like the missus being ill, for example. That said..
Been an interesting little week here on Retronoid - I'm finding I'm doing more playtesting than coding :-) But stuff is getting done.
So, what's happened this week then? In no particular order
Added a death effect when you lose a life.
Tweaked scoring on the powerups, as follows:
- If you grab a powerup that you already have it will result in a random bonus point award, as well as refreshing the powerup in most cases.
- If you grab the "growth" powerup which makes the bat bigger it will give a small bonus as well ( as you're making life easier).
- If you grab the "shrink" powerup that makes the bat smaller you'll get a much bigger bonus - and a pretty hefty one for using the smallest bat.
- Likewise, big bonus for speeding up the ball, small one for slowing it down.
- Removed the score bonus completely
- Removed score multiplier as a drop
- Changed score multiplier so its automatic - as long as you keep the ball in play, it goes up based on a threshold of no of blocks in the level.
- Changed the forcefield from a timer to limited number of hits.
Squashed some bugs that were annoying me.
So - fairly productive all round, considering.
Saturday, 12 March 2016
Quick Retronoid / File Hosting Update
Hi again!
Very quick update this week as I'm pushed for time. Both the missus and my dad are down with flu, so I'm pretty busy with domestic stuff, with work on top of that - very little time this week.
That said - some updates:
Retronoid
I alluded to a little ball spawning animation last week - well, its in, done and works every time the ball spawns on the bat, with some little particle effects. Serves as a short pause in the gameplay as well.
Also done a little back end code tidying. I'm not the tidiest coder, and I was getting fed up going through stuff thinking "what does this do again..?". Things like variable names that make sense, commenting here and there, and indents. Makes things a bit more readable.
Lastly - updated and crossed a few things off the to do list, added some stuff I want to change based on playthroughs & notes on balancing the powerups a bit more.
File Hosting
As I've already got it and can link to it - I've decided to switch my files into Google Drive. Adds an additional step to the process, which is a little annoying, but blame Virgin Media.
I've already updated all the links already, but for anyone not familiar with it, the file will open in a new window. Click on the "Download" icon at the top of the screen and the file will download.
It looks like this:
And that's it - better go see how the plague carriers are doing....
Very quick update this week as I'm pushed for time. Both the missus and my dad are down with flu, so I'm pretty busy with domestic stuff, with work on top of that - very little time this week.
That said - some updates:
Retronoid
I alluded to a little ball spawning animation last week - well, its in, done and works every time the ball spawns on the bat, with some little particle effects. Serves as a short pause in the gameplay as well.
Also done a little back end code tidying. I'm not the tidiest coder, and I was getting fed up going through stuff thinking "what does this do again..?". Things like variable names that make sense, commenting here and there, and indents. Makes things a bit more readable.
Lastly - updated and crossed a few things off the to do list, added some stuff I want to change based on playthroughs & notes on balancing the powerups a bit more.
File Hosting
As I've already got it and can link to it - I've decided to switch my files into Google Drive. Adds an additional step to the process, which is a little annoying, but blame Virgin Media.
I've already updated all the links already, but for anyone not familiar with it, the file will open in a new window. Click on the "Download" icon at the top of the screen and the file will download.
It looks like this:
And that's it - better go see how the plague carriers are doing....
Sunday, 6 March 2016
Retronoid Update XIV
Ooh, time for another update methinks!
Despite a pretty busy week at work, decorating & a little Kerbal Space Program time to get back into shape for the 1.1 release - got some coding done.
Doesn't seem like much, but this week I've been focusing on adding ball spin to the game. Not having done such a thing before, I decided to go the "simple as I can" route and only aim to change the deflection angle on the ball when it hits the bat.
This presented a number of challenges:
So, how did I do all this?
First off, getting the bat speed.
The bat itself actually moves at a constant speed - which makes it a little tricky. However, the bat doesn't necessarily move position in each game loop / cycle.
So what I did was to record difference in bat position between the previous & current cycles in a very small array covering 10 cycles (approx 0.17 of a second at 60 fps).
This gets reset if the player changes direction. At bat / ball collision using only the upper surface of the bat, I check what position in the array we are at, and work out an average speed based off the array values & position in it.
This also gives me bat direction (moving left gives a negative value, right a positive).
Working out deflection direction.
OK, now we have a bat speed to actually give us some spin momentum, how do we work out what way its going to deflect the ball?
If the bat is moving left it will apply clockwise spin on the ball, increasing the deflection angle.
If the bat is moving right it will apply anticlockwise spin on the ball, decreasing the deflection angle.
This applies regardless of whether the ball itself is moving left or right.
Example
The ball is coming in at a heading of 135 degrees on screen (down / left at 45 degrees)
If the bat is stationary it will deflect at heading of 225 degrees (up / left at 45 degrees)
If the bat is moving however it will apply spin,changing the deflection heading by X amount (from 225 degrees to 265 degrees for example) - based on how much momentum we transfer from the bat to the ball & in what direction (clockwise or anticlockwise)
Working out how much to deflect the ball
Right, so we know have some momentum and we know what direction to apply it - next up is what limits do we apply on the change in angle, how much momentum do we convert to spin, and how does that change the angle.
First off, I needed to decide what my maximum allowed deflection range would be. This was pretty easy, and I settled on 35 degrees maximum change on either side of a 45 degree incoming ball angle. This means that if the ball comes in at 135 degrees (down / left), the bat is moving right (inducing anticlockwise spin) and spin is applied changing the angle downwards, the exit angle shouldn't go through the bat.
Next, how much momentum to use - I did a bit or reading but the physics sort of went over my head - so I winged it.
I started out by applying a 30% limit - so if the average speed of the bat at point of impact is less than 30% of its maximum speed - don't apply any change to deflection angle.
Then for every % over that initial value, apply a portion of a degree as a change in angle.
So, 30% of max speed equals no change, 100% of max speed would equal 35 degrees of change.
Given our maximum limit either way is 35 degrees, this works out at 35 (degrees) divided by 70 (%) - or 0.5 degrees for every 1% over the 30% limit.
Now its just a case of amending the deflection angle of the ball by that value, in the direction we worked out earlier.
Example
The ball is coming in at a heading of 135 degrees on screen (down / left at 45 degrees)
If the bat is stationary it will deflect at heading of 225 degrees (up / left at 45 degrees)
The bat is moving left as well, applying upwards spin, increasing the angle of deflection
The bat is moving at 50% of its maximum speed - which gives a deflection angle change of 20 * 0.5, which equals 10 degrees. (50% - 30% limit = 20%, multiplied by 0.5 degrees per 1%)
This is applied as an increase in angle, so the new deflection angle would be 235 degrees.
Hang on though...
We still have a problem - if the ball comes in at a shallow angle it could still deflect through the bat. As we don't want this I applied minimum allowed deflection angles of 190 degrees if the ball is moving left, and 350 degrees if its moving right - amended after the angle change is made, but before the change itself is passed back to the ball object.
Example
The ball is coming in at a heading of 160 degrees on screen (down / left at 45 degrees)
If the bat is stationary it will deflect at heading of 200 degrees (up / left at 45 degrees)
The bat is moving right, applying anticlockwise spin, at maximum speed
This gives a deflection angle change of 35 degrees (70*0.5), as a decrease in angle.
If this is applied it gives a deflection angle of 165 degrees - which would pass right through the bat - so we limit the change to 10 degrees, giving a new exit of 190 degrees (our limit).
This is just for gameplay purposes so it doesn't give us yet another issue to deal with.
In conclusion..
So as you can see, for something which looks simple on the face of it - actually pretty complicated. In testing these values actually seemed to work out about right for what I wanted to achieve though, which was nice.
Now, I could also use this and make a change to ball speed as well (actually considering it) using the 30% limit as my portion of spin momentum that affects speed, but that's for later on.
What Else Happened?
Finally, I also worked out on paper how I want the ball to appear at the start of the game / on reset when you lose a ball. Its a little 2 stage animation across 18 frames, with some particle effects. Fairly simple, but should look good enough.
I think that's enough for one week, time to launch a rocket or two..
Despite a pretty busy week at work, decorating & a little Kerbal Space Program time to get back into shape for the 1.1 release - got some coding done.
Doesn't seem like much, but this week I've been focusing on adding ball spin to the game. Not having done such a thing before, I decided to go the "simple as I can" route and only aim to change the deflection angle on the ball when it hits the bat.
This presented a number of challenges:
- getting the speed of the bat at the point of ball / bat collision
- working out what direction to deflect the ball
- working out how much to deflect the ball by based on min / max bat speeds
- applying the deflection change & amending based on certain limits
So, how did I do all this?
First off, getting the bat speed.
The bat itself actually moves at a constant speed - which makes it a little tricky. However, the bat doesn't necessarily move position in each game loop / cycle.
So what I did was to record difference in bat position between the previous & current cycles in a very small array covering 10 cycles (approx 0.17 of a second at 60 fps).
This gets reset if the player changes direction. At bat / ball collision using only the upper surface of the bat, I check what position in the array we are at, and work out an average speed based off the array values & position in it.
This also gives me bat direction (moving left gives a negative value, right a positive).
Working out deflection direction.
OK, now we have a bat speed to actually give us some spin momentum, how do we work out what way its going to deflect the ball?
If the bat is moving left it will apply clockwise spin on the ball, increasing the deflection angle.
If the bat is moving right it will apply anticlockwise spin on the ball, decreasing the deflection angle.
This applies regardless of whether the ball itself is moving left or right.
Example
The ball is coming in at a heading of 135 degrees on screen (down / left at 45 degrees)
If the bat is stationary it will deflect at heading of 225 degrees (up / left at 45 degrees)
If the bat is moving however it will apply spin,changing the deflection heading by X amount (from 225 degrees to 265 degrees for example) - based on how much momentum we transfer from the bat to the ball & in what direction (clockwise or anticlockwise)
Working out how much to deflect the ball
Right, so we know have some momentum and we know what direction to apply it - next up is what limits do we apply on the change in angle, how much momentum do we convert to spin, and how does that change the angle.
First off, I needed to decide what my maximum allowed deflection range would be. This was pretty easy, and I settled on 35 degrees maximum change on either side of a 45 degree incoming ball angle. This means that if the ball comes in at 135 degrees (down / left), the bat is moving right (inducing anticlockwise spin) and spin is applied changing the angle downwards, the exit angle shouldn't go through the bat.
Next, how much momentum to use - I did a bit or reading but the physics sort of went over my head - so I winged it.
I started out by applying a 30% limit - so if the average speed of the bat at point of impact is less than 30% of its maximum speed - don't apply any change to deflection angle.
Then for every % over that initial value, apply a portion of a degree as a change in angle.
So, 30% of max speed equals no change, 100% of max speed would equal 35 degrees of change.
Given our maximum limit either way is 35 degrees, this works out at 35 (degrees) divided by 70 (%) - or 0.5 degrees for every 1% over the 30% limit.
Now its just a case of amending the deflection angle of the ball by that value, in the direction we worked out earlier.
Example
The ball is coming in at a heading of 135 degrees on screen (down / left at 45 degrees)
If the bat is stationary it will deflect at heading of 225 degrees (up / left at 45 degrees)
The bat is moving left as well, applying upwards spin, increasing the angle of deflection
The bat is moving at 50% of its maximum speed - which gives a deflection angle change of 20 * 0.5, which equals 10 degrees. (50% - 30% limit = 20%, multiplied by 0.5 degrees per 1%)
This is applied as an increase in angle, so the new deflection angle would be 235 degrees.
Hang on though...
We still have a problem - if the ball comes in at a shallow angle it could still deflect through the bat. As we don't want this I applied minimum allowed deflection angles of 190 degrees if the ball is moving left, and 350 degrees if its moving right - amended after the angle change is made, but before the change itself is passed back to the ball object.
Example
The ball is coming in at a heading of 160 degrees on screen (down / left at 45 degrees)
If the bat is stationary it will deflect at heading of 200 degrees (up / left at 45 degrees)
The bat is moving right, applying anticlockwise spin, at maximum speed
This gives a deflection angle change of 35 degrees (70*0.5), as a decrease in angle.
If this is applied it gives a deflection angle of 165 degrees - which would pass right through the bat - so we limit the change to 10 degrees, giving a new exit of 190 degrees (our limit).
This is just for gameplay purposes so it doesn't give us yet another issue to deal with.
In conclusion..
So as you can see, for something which looks simple on the face of it - actually pretty complicated. In testing these values actually seemed to work out about right for what I wanted to achieve though, which was nice.
Now, I could also use this and make a change to ball speed as well (actually considering it) using the 30% limit as my portion of spin momentum that affects speed, but that's for later on.
What Else Happened?
Finally, I also worked out on paper how I want the ball to appear at the start of the game / on reset when you lose a ball. Its a little 2 stage animation across 18 frames, with some particle effects. Fairly simple, but should look good enough.
I think that's enough for one week, time to launch a rocket or two..
Sunday, 28 February 2016
Retronoid Update XIII
Another quick update for you fine folks.
Managed to code in the remaining original levels (or slight variants of, actually). This brings the total number of levels from 15 to 35.
Started in on working out how to do ball spin / deflection off the players bat. The first main thing needed is a way to work out the speed the bat is moving over a timeframe. Started out by recording the movement differentials for the last 10 frames into a small array, then averaging out.
This works, but needs some modifications - it needs to average out at the point of impact rather than continually (easy enough), and the array needs to be reset when the direction of the bat changes / the bat remains stationary for a few frames. Should be easy enough to do.
Once that's done it should just be a case of working out how much of the bats velocity I actually convert to speed / direction change on the ball & tweaking it to suit.
Well, thats it from me for another week or so - another update soon.
Managed to code in the remaining original levels (or slight variants of, actually). This brings the total number of levels from 15 to 35.
Started in on working out how to do ball spin / deflection off the players bat. The first main thing needed is a way to work out the speed the bat is moving over a timeframe. Started out by recording the movement differentials for the last 10 frames into a small array, then averaging out.
This works, but needs some modifications - it needs to average out at the point of impact rather than continually (easy enough), and the array needs to be reset when the direction of the bat changes / the bat remains stationary for a few frames. Should be easy enough to do.
Once that's done it should just be a case of working out how much of the bats velocity I actually convert to speed / direction change on the ball & tweaking it to suit.
Well, thats it from me for another week or so - another update soon.
Friday, 19 February 2016
Quick Update
Well, I'm back - sort of.
Family stuff is ongoing - unfortunately I lost my mum to cancer just after Christmas, so been pretty busy helping dad with things. Still the case but things are starting to straighten up a little so I'm getting a little more time to myself. So started coding again, and also started remodelling the spare bedroom. Nothing like a bit of demolition to work out your frustrations.
Work wise, the really big project is up and running, so things are a little more normal there too.
Coding wise, just started to pick up Retronoid again. Eliminated a couple of bugs that crept in with the first cut of the menu system and getting familiar with the code again. Really must get a bit more organised and comment stuff more freely. Other than that not much to report.
Hopefully have another update in a week or two.
Family stuff is ongoing - unfortunately I lost my mum to cancer just after Christmas, so been pretty busy helping dad with things. Still the case but things are starting to straighten up a little so I'm getting a little more time to myself. So started coding again, and also started remodelling the spare bedroom. Nothing like a bit of demolition to work out your frustrations.
Work wise, the really big project is up and running, so things are a little more normal there too.
Coding wise, just started to pick up Retronoid again. Eliminated a couple of bugs that crept in with the first cut of the menu system and getting familiar with the code again. Really must get a bit more organised and comment stuff more freely. Other than that not much to report.
Hopefully have another update in a week or two.
Sunday, 22 November 2015
Retronoid - Update XII
Unfortunately I've been landed with a pretty big, unplanned project at work, so time to work on this is going to be a little limited until at least Christmas. I also had the prospect of Jury Service hanging over my head, but have managed to get that moved back to next year. Done it before, utter waste of time, not looking forward to it again.
I'm also trying to get a little relaxation / gaming time in as the latest Kerbal Space Program content patch has been released. Explosions galore :-)
That said, what's been happening over the last week or so?
Firstly, I've started in on the menu system - it's only going to be a simple thing so its coming together pretty quickly. I've got the main menu being displayed, a demo level with the ball bouncing around running in the background and you can start / quit the game.
Secondly, I've added a launch angle target to the bat. So, when the ball is on the bat at the start, or captured by the Sticky Bat powerup, holding the right mouse button down will change the launch angle of the ball (within certain parameters). It's only a simple line at the moment, and needs jazzing up a bit with some effects, but the mechanism is in and working correctly.
I know what I want to do at level start / transition etc (on paper at least), so the next thing is probably starting to integrate that.
Short and sweet this week!
I'm also trying to get a little relaxation / gaming time in as the latest Kerbal Space Program content patch has been released. Explosions galore :-)
That said, what's been happening over the last week or so?
Firstly, I've started in on the menu system - it's only going to be a simple thing so its coming together pretty quickly. I've got the main menu being displayed, a demo level with the ball bouncing around running in the background and you can start / quit the game.
Secondly, I've added a launch angle target to the bat. So, when the ball is on the bat at the start, or captured by the Sticky Bat powerup, holding the right mouse button down will change the launch angle of the ball (within certain parameters). It's only a simple line at the moment, and needs jazzing up a bit with some effects, but the mechanism is in and working correctly.
I know what I want to do at level start / transition etc (on paper at least), so the next thing is probably starting to integrate that.
Short and sweet this week!
Friday, 13 November 2015
Retronoid - Update XI
Progress has been a little slower this week due to work.
That said, quite pleased with what I achieved overall. Still working on powerups & visual effects.
Bat Powerups
Completed 4 / 5 (yes, that's increased)
New powerup completed! - Graviton Beam. This allows the player to steer the ball for a short period of time. Left / Right mouse buttons change direction clockwise / anticlockwise respectively.
Still got the level skip to do, but added visual effects as follows:
Sticky - generates a green, drippy effect on the bat
Enlarge - generates a couple of particle arcs away from the ends of the bat
Shrink - generates a couple of particle arcs towards the ends of the bat
Graviton Beam - Two small particle fountains are generated on the bat, and a beam is fired from each to converge on the ball, which drains the charge and changes the colour of the particles and the beam
Ball Powerups
Completed 6 / 6 (yes, that's increased too)
New Powerup! - Laserball. Similar to the Block Destroyer, this one fires a beam at nearby blocks that are in range, destroying them.
Triple Ball completed - pretty self explanatory this one.
Forcefield complete - puts a particle field at the bottom of the screen which reflects the ball. Particles change colour as the timer runs out.
Visual effects as follows:
Speed Up - green shockwave after the ball
Slow Down - red shockwave in front of the ball
Block Destroyer - Ball goes gold, which fades as the timer runs out. Particle spray when powerup starts / ends
Triple Ball - doesn't need one!
Forcefield - particle field at the bottom of the screen changes colour from green / orange / red as the timer runs down.
Laserball - using the effects from Block Destroyer, but the ball / effects are blue. Fires a beam at a nearby block & destroys it.
Other Stuff
I've also been sketching out how I want to handle some of the other stuff, like death, start / end level / game over effects. All worked out on paper and probably next on implementation once I'm done with the powerups. Starting to get to the point where I'm needing to add some more sound effects too, just to liven it all up.
Squashed a few bugs, tidied up some code, tweaked some things, found a few more bugs and added them to the list to be squashed later.
And that's about it for this time. Here's a screenshot of the Graviton Beam in action.
That said, quite pleased with what I achieved overall. Still working on powerups & visual effects.
Bat Powerups
Completed 4 / 5 (yes, that's increased)
New powerup completed! - Graviton Beam. This allows the player to steer the ball for a short period of time. Left / Right mouse buttons change direction clockwise / anticlockwise respectively.
Still got the level skip to do, but added visual effects as follows:
Sticky - generates a green, drippy effect on the bat
Enlarge - generates a couple of particle arcs away from the ends of the bat
Shrink - generates a couple of particle arcs towards the ends of the bat
Graviton Beam - Two small particle fountains are generated on the bat, and a beam is fired from each to converge on the ball, which drains the charge and changes the colour of the particles and the beam
Ball Powerups
Completed 6 / 6 (yes, that's increased too)
New Powerup! - Laserball. Similar to the Block Destroyer, this one fires a beam at nearby blocks that are in range, destroying them.
Triple Ball completed - pretty self explanatory this one.
Forcefield complete - puts a particle field at the bottom of the screen which reflects the ball. Particles change colour as the timer runs out.
Visual effects as follows:
Speed Up - green shockwave after the ball
Slow Down - red shockwave in front of the ball
Block Destroyer - Ball goes gold, which fades as the timer runs out. Particle spray when powerup starts / ends
Triple Ball - doesn't need one!
Forcefield - particle field at the bottom of the screen changes colour from green / orange / red as the timer runs down.
Laserball - using the effects from Block Destroyer, but the ball / effects are blue. Fires a beam at a nearby block & destroys it.
Other Stuff
I've also been sketching out how I want to handle some of the other stuff, like death, start / end level / game over effects. All worked out on paper and probably next on implementation once I'm done with the powerups. Starting to get to the point where I'm needing to add some more sound effects too, just to liven it all up.
Squashed a few bugs, tidied up some code, tweaked some things, found a few more bugs and added them to the list to be squashed later.
And that's about it for this time. Here's a screenshot of the Graviton Beam in action.
Sunday, 8 November 2015
Retronoid - Powerups Preview
As promised, here's a quick video of some of the powerups so far.
Enjoy!
Enjoy!
Thursday, 29 October 2015
Retronoid - Update X
Been having some real fun with this over the last week.
Work on powerups continues - although when I say a powerup is "completed" here, it means the core code is in and the effect on the player / ball etc works pretty much as it should - but it still needs to be prettied up with vfx / sfx.
Bat Powerups
Completed 3 / 4 (Enlarge, Shrink and Sticky)
Collecting a powerup in this class when one is already active will negate the current effect.
(i.e.) If Sticky is active and Shrink is collected, the ball is released on its original course and the bat shrunk.
Also, if the bat is at its minimum / maximum size and a Shrink / Enlarge powerup is collected, you will get a score bonus instead.
Ball Powerups
Completed 3 / 5
Ball speed up and ball slowdown - each will change the speed by 25% every time they are collected, until maximum or minimum speed are attained. If a speed up or slowdown is collected when at maximum / minimum speed, then you get a score bonus.
Block Destroyer powerup - changes the ball to a gold one, and destroys all 1 hit blocks - passes through 2 hit blocks (destroys them on 2nd pass) and bounces off side walls & indestructible blocks (considering making it pass through indestructible blocks as well, still testing). This effect triggers a timer.
Score Powerups
Completed - 2 / 2
Bonus Score & Score Multiplier powerups.
These work in that the effect is cumulative,, but miss one its back to square one. Collecting other types of powerup (Bat or Ball) doesn't negate the effect
(i.e) Collecting the first multiplier will give you a 2x bonus on a timer - collect the next one that drops and it goes to 3x & timer is reset - up to 10X (2x,3x,4x,5x,10x) - miss one and the next you can collect will be 2x.
Same goes for score bonuses, but the multiplier doesn't affect bonus score drops.
Particle Effects
Also been doing some work on the particle effects, both generally and in relation to the powerups.
Collecting a powerup generates a message that scrolls up the screen indicating what it does, and when it collides with the bat a coloured effect of the same class of powerup is produced - so a bat powerup (which is blue) will generate a blue effect.
I've also tweaked it so that the particles for brick impacts are the same colour as the bricks themselves, and impacts with the arena walls generate random coloured effects.
Originally, I generated a circle of particles on each impact - now I generate an arc depending on whether a flat surface or an exposed corner is hit.
As soon as I've got the powerups finished and the relevant particle effects in, I might do another video.
Work on powerups continues - although when I say a powerup is "completed" here, it means the core code is in and the effect on the player / ball etc works pretty much as it should - but it still needs to be prettied up with vfx / sfx.
Bat Powerups
Completed 3 / 4 (Enlarge, Shrink and Sticky)
Collecting a powerup in this class when one is already active will negate the current effect.
(i.e.) If Sticky is active and Shrink is collected, the ball is released on its original course and the bat shrunk.
Also, if the bat is at its minimum / maximum size and a Shrink / Enlarge powerup is collected, you will get a score bonus instead.
Ball Powerups
Completed 3 / 5
Ball speed up and ball slowdown - each will change the speed by 25% every time they are collected, until maximum or minimum speed are attained. If a speed up or slowdown is collected when at maximum / minimum speed, then you get a score bonus.
Block Destroyer powerup - changes the ball to a gold one, and destroys all 1 hit blocks - passes through 2 hit blocks (destroys them on 2nd pass) and bounces off side walls & indestructible blocks (considering making it pass through indestructible blocks as well, still testing). This effect triggers a timer.
Score Powerups
Completed - 2 / 2
Bonus Score & Score Multiplier powerups.
These work in that the effect is cumulative,, but miss one its back to square one. Collecting other types of powerup (Bat or Ball) doesn't negate the effect
(i.e) Collecting the first multiplier will give you a 2x bonus on a timer - collect the next one that drops and it goes to 3x & timer is reset - up to 10X (2x,3x,4x,5x,10x) - miss one and the next you can collect will be 2x.
Same goes for score bonuses, but the multiplier doesn't affect bonus score drops.
Particle Effects
Also been doing some work on the particle effects, both generally and in relation to the powerups.
Collecting a powerup generates a message that scrolls up the screen indicating what it does, and when it collides with the bat a coloured effect of the same class of powerup is produced - so a bat powerup (which is blue) will generate a blue effect.
I've also tweaked it so that the particles for brick impacts are the same colour as the bricks themselves, and impacts with the arena walls generate random coloured effects.
Originally, I generated a circle of particles on each impact - now I generate an arc depending on whether a flat surface or an exposed corner is hit.
As soon as I've got the powerups finished and the relevant particle effects in, I might do another video.
Saturday, 24 October 2015
Retronoid - Update IX
Just a quick update this week I'm afraid - between a weekend away with the missus, followed by a mad week at work I've not had much time or inclination to do any coding.
That said, I managed to squeeze a little time in today, so..
Work on powerups continues.
Collision detection is in place and working between the powerups and the bat, and a collision generates a coloured effect based on the type of powerup it is - so blue for those affecting the bat, green for those affecting the ball, and purple for others.
I've also got the update framework in place for each type of powerup, just need to decide on a duration for those effects that aren't one offs (i.e. a bonus score) - but that'll become clearer with playtesting.
With a bit of luck I should start coding in the actual powerup effects this week.
That said, I managed to squeeze a little time in today, so..
Work on powerups continues.
Collision detection is in place and working between the powerups and the bat, and a collision generates a coloured effect based on the type of powerup it is - so blue for those affecting the bat, green for those affecting the ball, and purple for others.
I've also got the update framework in place for each type of powerup, just need to decide on a duration for those effects that aren't one offs (i.e. a bonus score) - but that'll become clearer with playtesting.
With a bit of luck I should start coding in the actual powerup effects this week.
Thursday, 15 October 2015
Retronoid - Update VIII
Hello There! Hope you enjoyed the preview video in the last post.
Last week we left things like this :
1) Get the basic powerups in & working properly.
2) Start playing with ball spin.
3) Add a switchable method for bat control so I can swap between mouse / keyboard / gamepad easily.
4) Start working on the to do list.
I'm no longer going to list stuff like this in the updates, as what I end up working on usually ends up drastically different to the intended list, for a variety of reasons.
Now I have a "to do" list, I will just update on what I've actually done, crossing stuff off as I go and giving some extra info in these updates.
So this may get a bit lengthy.. Sorry!
The "To Do" List.
looks something like this, in no particular order :
That's just a high level overview, each section has some more detailed notes relating to it, and I've also got a "known bugs" section as well.
So, what's happened in the last week?
Powerups
...is what's happened. Mostly.
I started out creating a list of what I wanted, categorised by what it affected - and it looks like this.
Bat (blue)
Grow - increase image scale, increase size of collision object
Shrink - decrease as above
Sticky - allows bat to capture
Level Skip - destroy ball, teleport to next level
Ball (green)
Triple - create 2 extra balls, 10 degrees either side of original
Destroyer - turns off ball reflection, ball plows through blocks
Speed Up - increase speed by 25% until max speed
Slow Down - decrease speed by 25% until min speed
Forcefield - add a bouncable forcefield to block the bottom of the screen
Score (purple)
Random Score Multipler - (2x,3x,4x,5x)
Random Score Bonus - (100,500,1000,5000)
Then I finished off the graphics I was working on for the powerups, which look like this at the moment :
:
Coding wise, I added everything needed to create, delete and update the movement of the powerup drops.
When a destroyable block is hit, it has a base chance to "drop" a powerup. If one doesn't drop, that chance increases with every destroyable block hit until 100% chance is reached, or a powerup drops.
Then it generates a random powerup from the list above, adds the relevant image and rolls it down the screen. I'm still not 100% certain if I want to go with totally random drops though, I'm considering tweaking it so the drop chance is based on the category of the drop, with some being weighted more heavily than others.
Anyway, with that done I had to revisit the collisions code. When I rewrote it (a few updates back), I built in the functionality to have multiple categories of object (i.e. block, bat, powerup, aliens etc) - but didn't activate it as both the bat and blocks used the same code as the collisions at that point were all run from the ball updates (as that's the primary moving object). So on this pass I activated that functionality and tweaked things so that each object type has its own category
This now gives me the ability to add additional routines which test between specific categories of object - ie bat & powerup, or exclude categories altogether. Then I added a couple of lines of code which create / update / remove the collision objects for the powerups themselves.
I also added a toggle-able overlay for the collision objects which are colour coded by category. Now I can see what happens to the collision objects in real-time as I playtest.
Which led to an idea - with a minor tweak I should be able to create levels with moveable blocks in them, which could add another interesting layer to the gameplay. Added to the list anyway!
And while I was playing about with the collision code, I juggled some of it around & optimised it - which now allows me to do multiple collision checks at any point, and looks like it's cleared the outstanding "ball stuck in bat" bug as well.
So all that's left on that front is to write the little routine to test between the bat and powerup collision objects - which is a simple AABB (Axis Aligned Bounding Box) check. Then onto adding the actual effects of collecting a powerup...
That wasn't all though - I realised in testing I hadn't tied by level transition effects into my delta timing routine, so I tweaked that as well.
And that's pretty much it for this week.
Last week we left things like this :
1) Get the basic powerups in & working properly.
2) Start playing with ball spin.
3) Add a switchable method for bat control so I can swap between mouse / keyboard / gamepad easily.
4) Start working on the to do list.
I'm no longer going to list stuff like this in the updates, as what I end up working on usually ends up drastically different to the intended list, for a variety of reasons.
Now I have a "to do" list, I will just update on what I've actually done, crossing stuff off as I go and giving some extra info in these updates.
So this may get a bit lengthy.. Sorry!
The "To Do" List.
looks something like this, in no particular order :
- sfx for powerups, extra life, killing aliens, death explosion, transitions etc
- music
- death animation
- powerups
- alternate controls (keyboard / joypad) & revise controls
- menu system (keyboard / joystick / mouse / music on-off / credits)
- hiscores
- game over / reset mode when all lives lost
- level loop when last level reached
- ball spin which affects speed / direction & can be imparted by the bat
- player selected ball launch angle
That's just a high level overview, each section has some more detailed notes relating to it, and I've also got a "known bugs" section as well.
So, what's happened in the last week?
Powerups
...is what's happened. Mostly.
I started out creating a list of what I wanted, categorised by what it affected - and it looks like this.
Bat (blue)
Grow - increase image scale, increase size of collision object
Shrink - decrease as above
Sticky - allows bat to capture
Level Skip - destroy ball, teleport to next level
Ball (green)
Triple - create 2 extra balls, 10 degrees either side of original
Destroyer - turns off ball reflection, ball plows through blocks
Speed Up - increase speed by 25% until max speed
Slow Down - decrease speed by 25% until min speed
Forcefield - add a bouncable forcefield to block the bottom of the screen
Score (purple)
Random Score Multipler - (2x,3x,4x,5x)
Random Score Bonus - (100,500,1000,5000)
Then I finished off the graphics I was working on for the powerups, which look like this at the moment :
:
Still not entirely happy, but they'll do for now.
Coding wise, I added everything needed to create, delete and update the movement of the powerup drops.
When a destroyable block is hit, it has a base chance to "drop" a powerup. If one doesn't drop, that chance increases with every destroyable block hit until 100% chance is reached, or a powerup drops.
Then it generates a random powerup from the list above, adds the relevant image and rolls it down the screen. I'm still not 100% certain if I want to go with totally random drops though, I'm considering tweaking it so the drop chance is based on the category of the drop, with some being weighted more heavily than others.
Anyway, with that done I had to revisit the collisions code. When I rewrote it (a few updates back), I built in the functionality to have multiple categories of object (i.e. block, bat, powerup, aliens etc) - but didn't activate it as both the bat and blocks used the same code as the collisions at that point were all run from the ball updates (as that's the primary moving object). So on this pass I activated that functionality and tweaked things so that each object type has its own category
This now gives me the ability to add additional routines which test between specific categories of object - ie bat & powerup, or exclude categories altogether. Then I added a couple of lines of code which create / update / remove the collision objects for the powerups themselves.
I also added a toggle-able overlay for the collision objects which are colour coded by category. Now I can see what happens to the collision objects in real-time as I playtest.
Which led to an idea - with a minor tweak I should be able to create levels with moveable blocks in them, which could add another interesting layer to the gameplay. Added to the list anyway!
And while I was playing about with the collision code, I juggled some of it around & optimised it - which now allows me to do multiple collision checks at any point, and looks like it's cleared the outstanding "ball stuck in bat" bug as well.
So all that's left on that front is to write the little routine to test between the bat and powerup collision objects - which is a simple AABB (Axis Aligned Bounding Box) check. Then onto adding the actual effects of collecting a powerup...
That wasn't all though - I realised in testing I hadn't tied by level transition effects into my delta timing routine, so I tweaked that as well.
And that's pretty much it for this week.
Saturday, 10 October 2015
Retronoid - Preview Video
Here's a quick video of the current build going on level 6.
Never done a video before, so quite pleased how this came out - Enjoy!
Never done a video before, so quite pleased how this came out - Enjoy!
Subscribe to:
Posts (Atom)







