bbergen / sdl_graphics Goto Github PK
View Code? Open in Web Editor NEWA Repository for a collection of projects/programs while I learn the SDL graphics library
A Repository for a collection of projects/programs while I learn the SDL graphics library
When shot, large asteroids need to spawn two or three smaller asteroids in their place.
Occasionally the game will exit out after selecting the Continue option in the game menu while the game is paused.
To duplicate, repeatedly pause the game and select continue. After a couple or repeats the game will exit.
Breaking a brick should have a random chance of releasing a power up, which will float down towards the bottom of the screen. If the player 'catches' it with the paddle, it should provide a random effect on the player for a short time.
This will just be a stub for now.
Some Ideas for Power Ups:
Some Ideas for Power Downs:
There are some utility functions that are duplicated across the breaker and pong sub projects. They should be refactored into a separate unit that can be used by future projects.
Candidates for refactoring into common utilities include:
We need some asteroids that slowly rotate around the screen.
Stick with simply large asteroids for now.
Collision, small asteroids, and explosions will be handled in a separate issue, but should be kept in mind during the design and implementation of this issue.
Ensure there is a function for generating random asteroids.
Random asteroids should:
When the space bar is pressed down, the ship should emit a burst of bullets from its nose, along the vector that it is pointing.
A cool sci-fi shooting sound should accompany the action.
Collisions with the bullets will be handled in a separate issue, but should be kept in mind during the design.
When asteroids are shot, currently they just disappear.
An explosion needs to be displayed. What I'm envisioning is something like a random range of pixels shooting out at random vectors for a random range of distance.
Asteroids now has most of the main mechanics functional and now it needs to be turned into an actual game.
Implement a lives and score system.
This is just a stub for now. I'll edit it later to include a mock up of how I'd like the score/lives overlay to look.
When the time comes to write the render engine for Asteroids, let's try to make it as a separate and discreet module that can be reused among multiple future projects.
The initial API can be small and simple, but ensure that it is robust and well encapsulated so that future tweaks will leave existing projects that use the engine unaffected.
Core Features:
Adding unbreakable bricks in #6 has revealed some bugs with the collision detection on bricks.
Occasionally the ball will get caught inside a brick for a second or two.
This may also be related to the update frequency normalization that was done earlier.
The Brick collision boxes likely just need to be expanded by a small amount to account for the less frequent collision checks.
Currently the bullet TTL is a hard coded value. This means that on smaller resolutions, bullets can travel further making the game easier.
Similar to how the asteroid radius was converted to a coefficient for the resolution, convert the bullet ttl to a coefficient so that bullets will travel an equal distance, regardless of the screen resolution.
The project overall could benefit from a custom made unit test frame work.
Revise project_test.c such that it can do the following:
Currently, when a new game begins, or a life is lost, the paddle and ball are re centered and the game continues instantaneously.
Change this system to start the game (and continue after a life lost) with the ball touching the center of the paddle and motionless.
In this quasi-paused state allow the player to 'aim' the ball in a 180 degree arc above the paddle (perhaps not letting the ball go exactly horizontal, there should be at least some y axis motion).
Display the aim vector with a short line coming out of the ball in the current aiming direction.
In this state, instead of moving the paddle when left and right are pressed, move the aiming vector and visual display of it.
When the space button is pressed, the ball begins to move along the chosen vector, and right/left buttons revert to moving the paddle.
What use is a scoreboard if there is no score to keep track of.
Implement a system of scoring when breaking bricks.
Also, when all bricks are cleared off the screen, the player needs to advance to another level.
Implement a level system with the following requirements:
Builds are generating a good number of compiler warnings. Most of these are from discarding const qualifiers, primarily in the Menu subsystem.
Refactor functions where parameters are being implicitly cast to either take a more appropriate data type (const SDL_Color for example) or explicitly cast the parameter.
From here on most of these SDL projects will likely have some sort of persistent preferences, for example sound settings, high scores, or preferred resolutions.
It doesn't make sense to have to write a system to read and write these preferences to the file system for each individual project.
Add a new tool to the common directory with a header and implementation that manages reading and writing of persistent preferences to the file system.
The system should:
When the pause or esc key is pressed while playing Asteroids, a pause menu should be brought up that is similar to the new game menu.
The player should have the option to continue their game, start a new game, access the options menu, or quit the game.
The Classic Asteroids game had an alien ship that would randomly spawn and try to shoot the player.
Let's add one as well.
It should spawn and move about somewhat randomly, shooting at the player with a different color bullet. It should suffer collisions from asteroids similar to the player's ship
It should play a sci-fi sound when it spawns.
The list implementation created earlier uses a linked list implementation, which is great for situations where there are lots of insertions, removals.
It would be nice to have an alternate implementation using dynamically sizing arrays for constant time retrieval though.
Implement a vector backed with a dynamically sized array. Provide an api similar to the linked list implementation but with the added ability to specify a default allocation size, and maybe a load factor (defaulting to powers of 2).
Be sure to include unit tests for the new data structure.
Add the ability to disable/enable sound and music from the Breaker pause and new game menus.
Here is a quick crude mock up of how it should look:
Currently bricks just disappear when they are 'broken'.
A little flash could be added with a simple animation.
Perhaps some pixels exploding out, and the brick 'chunking up' for a second.
The current implementation of the asteroid object container holds both large and small asteroids in the same vector.
As asteroids are destroyed, new small asteroids are added, and the size of the vector is continually monitored and compared against a threshold. When the vector size dips below the threshold the vector is topped up with large asteroids to keep the game going.
This very quickly causes the vector to be saturated with small asteroids.
Large and Small Asteroids need to be manages separately
Add a new linked list to the game struct to store small asteroids.
When a large asteroid is destroyed, randomly add 2-3 small asteroids at the destruction site to the new list. Allow this list to grow infinity (as a game balancing feature). Prune this list similar to how bullets and explosions are pruned (although it will be a bit different as asteroids don't follow a FIFO policy).
Only check the Large asteroid vector against the threshold (which should then be lowered to maybe 60-80%) for top ups. Use the existing check and copy logic in place for asteroid respawning.
Breaker and later projects could probably benefit from a generic HashMap implementation.
Currently the background of the playing field is just solid black.
It would look slick if it was a randomly generated star map!
Currently the asteroid size is based on a fixed range and when the asteroid is of type 'large' or 'small'.
Due to this fixed range, the game area is more crowded, and thus would be more difficult, on smaller resolutions.
Change the fixed ranges of asteroid sizes to be based on the screen irresolution. Similar to how the ship's size is.
Just a stub for now, but asteroid-ship collisions need to be implemented.
This should probably come after implementing the lives/score system
When the ship is accelerating, a small triangle should flicker behind the ship.
A thrusting sound should also play while the ship accelerates.
Here is a mock up of how it should look:
Simple eh?
Implement the following features:
Menu items will have the following effect:
Currently the paddle only has crude collision detection.
Occasionally the ball will get stuck inside the paddle for a few seconds.
Currently the scoreboard implemented in this issue only has a placeholder value.
Once Issue #21 is completed, random asteroid generation will be in the game.
The next step is to start colliding our objects.
Implement checks to determine if bullets collide with asteroids on screen.
When a collision occurs, remove the asteroid from the screen, and free its resources. An algorithm similar to bullet pruning might be effective, although with bullets pruning is always done at the head of the list (basically a queue) asteroids may need pruning through out the list.
Also add a new sound resource for the collision and play it when one occurs.
Do not worry about explosion animations in this issue, that will be handled later.
The map API is using non-unique function names such as put() and get(). This is probably a bad idea and cause name clashes in the future.
Refactor the map API to have map_ pre-fixed on all function calls to prevent any issues moving forward.
Currently bullets come out at a consistent 4 bullets/s.
Change the implementation to be bursts of 4-5 bullets at a more rapid frequency, with a longer pause between bursts.
This should make it a bit easier to destroy smaller asteroids, and also had some challenge to the game instead of simply spamming the shoot button.
Currently destroying asteroids doesn't quit free up the resources associated with them. It just sets them invisible.
Also, there is no re-generation of asteroids. The idea of the game is that it sort of continues infinitely.
Implement a system that checks to see if the number of visible asteroids in the asteroid vector is below a certain threshold.
If it is, generate a new vector of asteroids to replace it, copying the remaining visible asteroids to it to avoid losing them.
Ensure that the threshold is an easy to adjust threshold for gameplay tweaking purposes.
Currently the ball just bounces off the bottom of the screen.
This is certainly not good! We need to start turning this into an actual game.
Implement the following:
To make breaker levels interesting, there should be a couple different brick types.
This issue should be done before Levels & Scoring
Add the following types of bricks:
On going projects could benefit from a common logging utility.
The Logging utility should have the following features:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.