Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1352503 Posts in 62396 Topics- by 54116 Members - Latest Member: JiggerJerusalem

December 10, 2018, 08:28:12 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsTower defence game (with pixel art because why not)
Pages: 1 [2] 3
Print
Author Topic: Tower defence game (with pixel art because why not)  (Read 2319 times)
Kerndog73
Level 0
**



View Profile
« Reply #20 on: May 09, 2018, 04:04:04 AM »

School has been hectic for the past few days. I haven't had much time to work on the game so I kind of feel guilty for not posting often enough (even though there are only a handful of people following this thread  Grin). I've refactored the level loading system a little bit. I've also made a few miscellaneous improvements here and there. The next thing I'll do is animating the beam of beam towers. Thinking about it now, it actually sounds super easy. After that, I'll just draw the animation for the flamethrower and that will be that. All of the other code to support the flamethrower is already written. I can't do it now because I have to do homework and sleep but I promise you this:

The next post will be a flamethrower GIF!
Logged
Kerndog73
Level 0
**



View Profile
« Reply #21 on: May 10, 2018, 04:02:17 AM »

So here is the flamethrower GIF, as promised:



Drawing fire is hard OK, DON'T JUDGE ME!

You may notice that the fire is being stretched and squished as enemies away and towards the tower. This is because the fire is being rendered by the same code that renders the laser. The laser is actually a single sprite that is being stretched to meet its target. I plan on changing the weird stretchy fire of course. I'm not sure if the beam renderer should render both the laser and the flamethrower or I should create two separate renderers for each. Hmm...

The GIF contains all of the towers that I have created so far. I've made 9 towers and I plan on making another 3. I'll make another snow tower and 2 more fire towers. I had to seriously beef up the enemies to give a few of the towers a shot. When I was doing that I realized that balancing this game is actually going to be pretty difficult. I have to make sure all of the towers have the right stats and all of the units have the right stats and the game isn't too easy and the game isn't too hard and the game is actually fun. I think I'll dedicate a whole weekend to stat tweaking when I finish all of the towers and units.

I hope y'all are looking forward to the release!
Logged
Kerndog73
Level 0
**



View Profile
« Reply #22 on: May 14, 2018, 04:36:01 PM »

I cleaned up a few of the animations, most notably the flame of the flamethrower. I also created a third robot animation, this one looks like a tank.



I was going to implement aura towers but then I saw a video about A* search and I was very entertained by this video. So I rewatched it a couple times and then implemented it myself. I don't need A* but it was fun to implement! The algorithm I'm using now assumes that there is only one way of getting from start to end which makes it much faster than A* in this situation.

Even when I'm procrastinating writing code I still write code!

I might be able to implement aura towers this afternoon and reimplement the animation system. The animation system does what it needs to but I hate the code so I'm rewriting it.
Logged
Kerndog73
Level 0
**



View Profile
« Reply #23 on: May 15, 2018, 03:26:11 AM »

I rewrote the towers animation systems and I'm glad I did. I deleted 4 systems and 1 component then I modified what remained. The resulting code is simpler and fixes at least two bugs in the old code. It's fantastic! Lets walk through the changes.

In the old code, there were two systems and one component that indicated whether the tower was able to fire based on the ROF. There were four animation systems that would read this component and run the animation accordingly. Then there were two damage systems that read the animation components and dealt damage when appropriate. I don't like this. The game logic (damage) should not know anything about game view (animation). This is a difficult problem to solve because the damage has to be dealt after the animation has finished playing.

In the new code, there is one system and one component that maintains a timeline of the firing of the tower. From this timeline, we can calculate when the animation should start and when damage should be dealt. The single animation system reads the timeline and runs the animation accordingly. The two damage systems read the time and deal damage accordingly. This fresh new code is so much simpler, smaller and decoupled.

That's what happens when you spend an afternoon sitting at a desk and thinking about a problem, you end up with a great solution.
Logged
ProgramGamer
Administrator
Level 10
******


The programmer of games


View Profile
« Reply #24 on: May 15, 2018, 03:57:58 AM »

Good! Decoupling gameplay code from graphics code makes you feel like you're starting over fresh with a clean slate, doesn't it? It's like "Hey, I can change more things without breaking other parts of the game now". It feels like a weight off your back when you're done and start implementing features, because there's all this stuff you don't have to worry about anymore.
Logged

Kerndog73
Level 0
**



View Profile
« Reply #25 on: May 16, 2018, 09:09:38 PM »

I'm sitting in class. I should be doing a physics assignment but I decided to implement aura towers instead!



Aura towers deal damage and apply an effect to units within a range. I've implemented an ice aura tower (its next to the flamethrower) which deals a small amount of damage and a stun effect. I've implemented 10 towers so I only have 2 to go: a fireball shooter and a fire aura. After that, I might draw some more robots and start the stat tweaking phase. Tweaking stats is going to take quite a while!
Logged
Kerndog73
Level 0
**



View Profile
« Reply #26 on: May 18, 2018, 02:37:27 AM »

I've created all of the towers I planned on creating!



For the past few days, I've kind of been getting bored of this game. I'm not really feeling it, you know? There's just so much animation involved. I have to draw lots of stuff, I have to make sure the stuff I draw looks right in the game, I have to make sure that animations play correctly, it's all just animation. I'm not really focusing on the game itself. The game logic. The code that really matters. Every time I think of an idea for the game logic, I have to think "How will I animation this?". I've never made a game this graphically intensive before.

My previous game was a tile-based puzzler. You can play it here. I think the simple animations worked really well in that game. I didn't focus all of my time and energy on animating. Most of the animation was done in a weekend. My time was spent thinking "What are some fun game mechanics?" and "How do I use these mechanics to create fun levels?". I was thinking about the game, not what it looked like.

I still have a lot of graphical elements to create. I'm losing the will to work on this game. I'll try and finish this game because I don't like leaving things unfinished. I'll let you guys know if I end up abandoning this project and starting another tile-based puzzler. I can't be good at making every type of game.



Look at me, getting all emotional in a devlog! This is the devlog with a difference. You ain't just getting progress updates, no, you're getting heart and soul! Grin
Logged
Tusky
Level 1
*



View Profile WWW
« Reply #27 on: May 18, 2018, 03:28:59 AM »

Sounds like you'd have a better time if you found an artist to team up with?
Logged
Kerndog73
Level 0
**



View Profile
« Reply #28 on: May 18, 2018, 03:09:08 PM »

Sounds like you'd have a better time if you found an artist to team up with?

I've already finished most of the art. The art isn't as great as it could be but it's good enough. I've drawn a static UI. All I have to do is chop it up and make it dynamic. If you are offering yourself as an artist, then I really do appreciate it but I have to decline. Maybe the next game? I'm just not feeling it with this game. Maybe it's because I've been working on the same game for a month? I just want to get this done and start something else.

I really like making tile based games. I like thinking of ways in which tiles can interact with their neighbors. I love that the simple mechanics can be composed into a complex machine. It's like cellular automata.
Logged
Kerndog73
Level 0
**



View Profile
« Reply #29 on: May 19, 2018, 01:00:22 AM »

I've made a start on the UI.



That GIF is 19MB!

I'm basically just rendering a big texture and then putting text on top. The cursor changes when you hover over areas which will later become buttons. I couldn't scale down the because then you wouldn't be able to see the cursor.

You'll notice that the GOLD that the player has increased as units are killed and the NUMber of units remaining decreases as units are spawned. The squares with drawings in them will be the towers that the player can buy. The player upgrades these four towers to obtain all twelve towers of the game.

The UI still has a long way to go but it's getting there.
Logged
Kerndog73
Level 0
**



View Profile
« Reply #30 on: May 20, 2018, 12:48:29 AM »

I made some more progress on the UI



I added behavior to the NEXT WAVE button. Clicking this button will start the next wave when the current wave has finished spawning. If the current wave is the last wave, then clicking the button will load the next level. I haven't handled the case when the player finishes the last wave on the last level. Maybe I'll put a message on the screen saying "Congratulations on finishing the game!". IDK.

The animated unit in the top right corner is a preview of what's going to spawn on the next wave. When the player clicks on the preview, the unit stats will appear in the area in the bottom left corner. I haven't implemented this part yet. That will be done tomorrow. Maybe.

The preview unit in the top right corner is a bit of a hack, but a good hack mind you! The UI code actually creates a dummy unit and only gives it the components that it needs to be rendered and animated. The UI code doesn't give the unit enough components to be targeted by towers or move around. The game code is rendering part of the UI and it doesn't even know it! Cheesy Cheesy Cheesy What did people do before ECS?

I also made resizing the window smoother. Resizing the window hangs the event loop while the user is resizing the window. This means that the window is black while being resized. For a long time, I thought it was impossible to do any rendering while the window is being resized so all of my previous games have a black window while resizing. I FOUND A SOLUTION! It's simple really, all I had to do was create an event watch with SDL_AddEventWatch and then render the game when I get a resize event. This solution works on the operating system I developing this on (macOS) but I haven't gotten around to setting up emscripten for this project so I'm not sure if it will work inside a web browser too.

Maybe I should setup emscripten tomorrow instead of working on the UI. I'll probably forget so who knows what I'll do!



I actually haven't mentioned target platforms until this post (I don't think) so I'll clarify.

I'm developing on macOS. I'm releasing a native macOS app bundle and a WebAssembly+WebGL2 powered web page.
« Last Edit: May 20, 2018, 01:10:44 AM by Kerndog73 » Logged
Kerndog73
Level 0
**



View Profile
« Reply #31 on: May 21, 2018, 05:22:18 PM »

After a series of unfortunate events, I will not be able to work on the game this week. Cry I will be back on Monday the 28th of May.
Logged
Kerndog73
Level 0
**



View Profile
« Reply #32 on: May 27, 2018, 08:13:54 PM »

I did a few things on last Monday and this morning. I just realised now that Upgrade and Sell buttons should only appear when clicking on a live tower. They should appear when buying a tower.



I caught a cold on Sunday. Not fun. My nose drips every couple of seconds. I feel disgusting. Anyway...

The whole UI is currently implemented in one single God Class™. I've never made a UI this complicated before so I'm not really sure how to go about it. If I pick the wrong abstraction now, making changes in the future might become really difficult. I know that with a God Class™, adding new features slowly becomes more difficult over time but with the wrong abstraction, adding features might quickly become difficult or impossible. I'm gonna try and implement MVC somehow. It seems to be the holy grail of UI systems from what I've read. Having a cold has really put me in an unproductive mood. I just don't feel like doing anything. I just want to sit and bathe in my mucus. Sad

I really don't like disappointing you guys. I once read a great devlog and then, all of the sudden, the writer just stopped posting. Out of nowhere. I don't want to be that guy.
Logged
Kerndog73
Level 0
**



View Profile
« Reply #33 on: May 31, 2018, 06:32:39 PM »

I didn't have much free time this week. I had assignments to do and new topics to study and I also had driving lessons. Not a lot of room for working on this game. I also spent a free afternoon creating a rational number (fraction) class. That probably wasn't the most effective use of my time! I have been refactoring the UI system using the Model View Controller architecture. Models abstract away the game state so only Models access the components of entities. Views render the abstract state from Models. Controllers handle mouse button clicks and make the appropriate calls into the View and Model. Views and Models communicate via the Controller.

BTW, that cold turned out to be a CSF leak. I think I have it under control now. I just stopped blowing my nose and kept my head tilted back.



Jeez, this post just got really personal. Well, I am a person, so like, what do you expect? Durr...?
Logged
Kerndog73
Level 0
**



View Profile
« Reply #34 on: June 03, 2018, 03:37:25 PM »

The player can now buy, sell and upgrade towers



This means that the UI is pretty much done. The UI code is a horrible mess but it works! I'm going to try to refactor it a bit and try to understand how UIs should be implemented. The work I do now is work done on the next game. I could take some inspiration from existing UI systems. Making web-based UIs is really easy. You just declare it in HTML and CSS then you attach some event listeners in JavaScript that modify some global state. Maybe I could try to do something like that.

While I'm doing that I should probably start the stat tweaking phase. I might be able to release next week but I'm not making any promises.
Logged
Tusky
Level 1
*



View Profile WWW
« Reply #35 on: June 03, 2018, 11:20:39 PM »

I might be able to release next week but I'm not making any promises.

That was quick!
Logged
Kerndog73
Level 0
**



View Profile
« Reply #36 on: June 05, 2018, 03:03:05 AM »

I got the Emscripten build working



For my last game, The Machine, I created the Emscipten build using the CLion IDE. CLion uses CMake as its build system. CMake makes it easy to set the compiler to Emscripten. I'd rather not have to use CLion because it's not free. I found out that Xcode has Aggregate targets. These types of targets are basically just scripts. So I created an aggregate target that runs CMake which runs Emscripten which compiles the web version. So that's my second platform.

A few months ago, I played around with MinGW which is essentially a cross-compiler for windows. It compiles Windows executables on MacOS. I think I managed to get a Hello Window application running (an app that just opens a window with SDL2) under Wine. Wine is sort of like a Windows emulator for MacOS. It's not quite a full-blown virtual machine but it lets me run windows app on my mac. So if I play around with CMake, I might be able to get a Windows build working too.

So this game is gonna be really cross-platform (MacOS, Web, Windows) and I didn't even have to use Unity! I dream about my engine being on-par with Unity. If I work hard enough, maybe it won't be a dream.

After I get both the Web and Windows builds working, I'll do my best to refine the build system. I read a bunch of articles on CMake to make a really generic and smart CMake file. I'll also make an Xcode project template that already has the targets initialized. Oh and the UI! I want to spend a lot of time writing a really good UI system for this project. Time spent working on the UI for this project is time not wasted on my next project.



This is all a bit premature as the game isn't actually finished yet! Also, "next week" was probably an ambitious estimation. I honestly don't know when I'll release this but it will be later than next week.
Logged
Kerndog73
Level 0
**



View Profile
« Reply #37 on: June 06, 2018, 12:26:40 AM »

I am soooooooooooo close to getting the windows build to work. I'm just trying to fix some runtime linker errors. I really hope I can get this to work.
Logged
Kerndog73
Level 0
**



View Profile
« Reply #38 on: June 06, 2018, 03:42:38 AM »

I GOT THE WINDOWS BUILD WORKING!





I managed to compile my game to a Windows executable and then run that executable with Wine. The game isn't actually finished though. I just got so excited about Emscripten and MinGW that I had to make it happen! I've been putting off the stat tweaking for a while now. I also have to make a title screen.

Oh, and what happens when the player loses. Uuuuuuuuuuuuuuuuuuum, I have no idea. I completely overlooked that detail. Goodness me, this game hasn't gone very well. Maybe I shouldn't be working on games when I have this much freaking homework. Perhaps this project was just too ambitious. I don't know.

I like making games but I don't like making games. It's a complicated relationship.
Logged
Kerndog73
Level 0
**



View Profile
« Reply #39 on: June 13, 2018, 10:30:49 PM »

I haven't posted in a while because I was procrastinating and working on other stuff. I've been putting off the stat tweaking throughout the whole project. I started yesterday and it's gonna take me a while to get it done.

Defining levels is basically just writing Jsonnet files. I first define a few waves. Then I launch the game, place down some towers and play through the wave. Then I adjust the tower stats and the unit stats and reload the level. It's just a lot of playing around with numbers in files. This is so much different from my last game (which was a puzzler). In a puzzle game, you try to anticipate the player's actions and try to trick them into making the wrong decision. You limit the player's decisions while giving them the illusion of freedom. I think I should stick with puzzle games in future!



I kind of want to create my own programming language. I might find a way to use it in a game or even creating a programming but I'll mainly just create it for the sake of creating it. I might make something similar to Swift but simplified. I've never used Swift but it seems like a cool language! It's kind of like C++ but with the auto keyword everywhere!

Maybe I could create a game where the player is running a farm. Running a farm involves a lot of repetitive work. I want the player to get bored of this repetitive work. Then, just as they are about to stop playing the game, thinking "this is way too boring", I will introduce robots! The player can program the robots to do all of the repetitive work. Robots are more efficient than the player so the player can afford to buy more robots and make their farm more efficient. Maybe I could limit the language features that the player uses to program the robots and the player must upgrade their robot to get the new language features. This slow unlocking of language features good help teach the language. I could introduce things like networking, the robots could interact with each other through a robot WiFi network. All of this could be taking place on a pixel art, isometric graphics system.

Holy shit, now I have to make it!

I mean, go big or go home right?
Logged
Pages: 1 [2] 3
Print
Jump to:  

Theme orange-lt created by panic