This is my thread for CC22.

I toyed with the idea of rewriting my CC20 water entry, which was originally supposed to feature an editor for ships, but decided against it because it would be a lot of work and gameplay wouldn't be that interesting.

Instead, I think I will make a reverse tower defense game, where the towers are already placed and you draw the path that enemies will take. There will be no money system; instead, towers gain experience by killing enemies. You can pick an upgrade for a tower each time it levels up. The shorter your path is, the more experience towers get. You can change the path between every wave, but not during the wave. You can see how big each wave is before starting it.

This encourages the player to, on smaller waves, redirect the path to towers that need leveling up, but at the risk of letting enemies escape. On larger waves, players should make longer paths that pass by many towers so that enemies have no chance of escaping.

I'll add some technical notes about implementation, etc. in a few minutes; I typed this out on my phone for some reason.

EDIT: sorry for the delay, had to do some IRL stuff real quick.
Basically, the path will be made up of line segments (as opposed to points or curves). I will store the path as a array of structs containing the point coordinates and distance from the start. Enemies will only store their distance from the start, which will be incremented by a certain amount each physics cycle. To figure out where to render the enemies, it will do a binary search of the distances to find the previous and next points and their corresponding distances. From there, it's basic algebra to find where the point at that distance will be.

Instead of calculating whether each enemy is within range of a tower each time it needs to fire by comparing 2D distance, all towers will figure out which parts of the path they can reach. Then, during gameplay, the towers only have to do a series of 1D comparisons to see if a particular enemy is within range. The list of enemies will also always remain sorted due to the nature of the game, so it would be very quick to find the enemy within range that is closest to or farthest from the exit. I could also have it find the weakest or strongest enemy with a little more work.

EDIT: Made a GitHub. Not much in it right now. https://github.com/commandblockguy/reverse-tower-defense
Progress update time! I would have done this sooner but I couldn't get APNGs to work. Thanks to Mateo for helping me figure that out.



I have decided to do all the physics before working on the graphics, so as of right now everything is represented by circles and lines and flat buttons and default fonts rather than fancy visuals.

Right now my only visible progress is the path editor and the menus. The menus can be controlled using the cursor or the row of F keys, which is convenient both in CEmu and on a physical calculator. The path editor is about half finished; I still need to change the way that the endpoints are moved and implement the error (e.g. crossed line, too sharp of a bend) detection bits, which I will be writing in assembly as I've determined that it will be slightly easier to do it in assembly than in C, which is rare. This is due to how bitshifting and flags work, which does not translate easily into C. Currently you can press 2nd while over a line to split it into two lines and pick up the shared point. You can then press 2nd again to drop the point. You can press alpha to pick up and move a point, or del to delete a point.

I also did a ton of stuff in the background which you cant see in that screen capture. I have a function for fast calculation of whether a particular point on the path is within reach of a tower, which requires a one-time calculation each time the path changes, and allows the calculations which will run during the actual physics ticks to run much faster.

Anyway, that's all for now. Hopefully I will release another progress update soon once I have more done.
Apologies for any random letters anywhere, I was fighting my cat while typing this. Happy National Pet Day, everyone!
Another progress update!



As usual, I haven't started working on the graphics yet so all of this is temporary, and the circles will be replaced with actual sprites. I'm planning on making the enemies look like aliens, though it has been suggested that I theme the game like Bloons Tower Defense. I'd add a poll for that but I don't want to waste my poll on that, so just let me know in IRC or something.

As you can see, the enemies move at the same rate no matter how complex the path is, because I am actually storing the position of the enemy as a 1D value (distance from the start) and then calculating the 2D position each time the enemies are rendered.

Physics and graphics are also sorta running separately, with physics given priority. That means that the game will always run at the same speed regardless of what the frame rate is. This also means that the physics can run behind if the physics cycles start taking more than 1/60th of a second, my tick time.

Next up on my to-do list is targeting, which should be fairly easy due to how I have implemented things. I'll try to make a neat visualization for this for debug purposes. After that, I think I'll work on tweaking the editor and then adding the tower upgrades menu.
Very cool! The line movement looks quite smooth, how easy is it to grab and move a corner though?
Personally I'd prefer BTD sprites though I don't think it's a huge deal whichever one you end up using. Smile
I've been recently playing BTD 5 and 4, and it's really fun!
I don't know if this should have that much in common, but maybe have something like ice cream cones with different colors and layers being destroyed instead of balloons.
I'd be perfectly okay with bloons Razz
jcgter777 wrote:
I've been recently playing BTD 5 and 4, and it's really fun!
I don't know if this should have that much in common, but maybe have something like ice cream cones with different colors and layers being destroyed instead of balloons.


Maybe for the lead-type stuff it would be a little topping on the ice cream. IDK. Razz
The progress on this is amazing! I am so excited to see the finished project.
I used to play a game called onslaught years ago, another tower defense game, and I like their tower sprites, maybe you can get some ideas for it.
http://onslaught.playr.co.uk/
Good luck!
Progress update time:

I'm not going to say much about this one, so that you guys can let me know if you found it intuitive. All feedback is appreciated. Pressing 2nd will eventually open a dialog box asking if you are sure you want to buy the upgrade, though that's not working right now.

I'm not super happy with the highlight color; I might give the button a gradient in the future. The circle is also a placeholder sprite, eventually the tower sprite, which will be dependent on the type and upgrades, will go there instead.
Another progress update:


As you can see, towers can now shoot at enemies. Animations are still super temporary, so you can see when a tower fires as it turns black for a few frames afterwards.

XP also works, though I had all towers starting from just over Level 3 for debug reasons.

Right now only the "Last" targeting type works, though it will be simple to implement the other three.

Also, Mateo informed me that "reverse tower defense" is already an established phrase, which I did not realize when I made this thread, so I would like to clarify that this not actually a "reverse tower defense" game but a tower defense game with a twist (you place the path rather than the towers).
What stops me from making a path that loops around a single tower a few hundred times?
While not implemented yet, there will eventually be a restriction on the types of path you can lay down. You can't have lines that cross each other, or turn too sharply. The path will also be wider (maybe 12 pixels?) once I start working on drawing stuff, so you couldn't wrap something tightly around a tower. The two endpoints will also snap to the edges of the screen.
How sharp is sharp? And can you make the path look like a road/ actual path?

like so:
| |
| |
.\ \
..| |
./ /
| |

periods for spacing, btw
Yes, the path will be wider. Graphics are on the back burner for now, I'll make everything look pretty later.

How sharp you can make a turn will be dependent on how long the path segments before and after it are. If they are relatively long, you could go up to 90 degrees. For shorter paths (those about the same length as the path's width) the max angle will be about 45 degrees. This is to stop you from doing a switchback by having a few really short paths with wide angles. If these rules make the editor too hard to use, I'll relax them a bit.

LASERS!!!!

(that is all)
commandblockguy wrote:

LASERS!!!!

(that is all)


NICE!! I really cant wait! Love the progress
Looks great so far, a lot of the game mechanics are done and it already looks a blast to play!
Would anyone be interested in making some enemy sprites for my game?
I would prefer that the enemy be aliens, but that can be anything from alien spaceships to alien potato monsters. The paths will be 10 pixels wide, so 8x10 or less would probably be best. I also want to show how damaged an enemy is by either adjusting its size or by changing its color.

If nobody wants to, I will probably just take the sprites from Space Invaders if that complies with the rules.
Yeah I could help you out a little, since I'm done with my submission (I'm not sure how much though, I really need a break from calculator programming).

How about something like this?
"5BBBBB5BB5BBBB5BBB5555BBB5BBBB5BB5B33B5BB5BBBB5BB555555BB555355BB5B5BB5B55B55B55"
And in case you're wondering, that is a funny-looking three legged alien with one eye.

EDIT- Damaged a little-
"3BBBBB5BB5BBBB5BBB5555BBB5BBBB5BB5B33B5BB5BBBB5BB555555BB355355BB3B5BB5BBBB55B55"
A little more-
"3BBBBB5BB5BBBB5BBB5335BBB53BBB3BB5B33B3BB5BBBB5BB555555BB355353BB3B3BB5BBBBBBB55"
And then the last appearance before the alien dies (RIP alien):
"3BBBBBBBB5BBBBBBBB5335BBB53BB3BBB3B333BBB5BBB33BB535555BB355353BB3B3BB5BBBBBBB5B"


I can make these for you in different colors or something if you want.


EDIT 2- Do you want any more enemy sprites? If yes, I can get them to you tomorrow.
Alright, bit of a last-minute progress update here:

Still want to improve the graphics a bit, though I'm not sure if I will have time as I will be really busy tonight. After that I basically just have to finish writing text for the readme and the help menus.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement