Search Unity

Games [WIP] Cubelins TD

Discussion in 'Works In Progress - Archive' started by _M_S_D_, Jun 13, 2017.

  1. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    Greetings!
    Seeing as Brink of Extinction (https://forum.unity3d.com/threads/wip-beta-brink-of-extinction-td.408749/) is almost finished, I've been prototyping for quite a while. Oddly enough, the project I've ended up progressing the fastest with is another tower defense.
    However, this time I'm moving away from the gloom n' doom and going for a more playful approach.
    I had the idea I would also generate the levels on the go. But as I start I started by generating a level from small image files:
    Screen_20170508b.png
    To the right, red marks enemy path, green is a buildable location, and the cloud is terrain. With these I could start generating maps:
    Screen_20170508a.png

    Now, further into the process of developing the game, I've today managed to completely generate the levels via code. First generating the landscape via a cloud generator, then creating rows and columns that form intersections that I can run through a path solver to create the final path from point A to B:


    After that I generate the proper path (all redundant path tiles are removed). On the tiles that are next to the path I then add buildable tiles. Same logic as before, red for path, green for buildable area. Using smoothing to blend the paths and buildable areas with the terrain I then join them together and start building the actual terrain.
    Screen_20170613a.png
    Screen_20170613b.png

    To vary the look I use a premade palette. So with that I can make something like:
    Screen_20170613c.png

    I will also be adding presets for rock types, trees and other details that will be in the level.
    To present the level in a nice way I let it simply fall in from above :)


    The game will feature a small campaign of preselected random levels with a set ending time, but primarily I will focus on endless mode where players will be battling it out against each other and be prompted when their high scores are beaten.
    Upcoming work:
    Basic enemy movement (boxing)
    Turret upgrade tree
    Turret code
     
    Hikiko66 and QFSW like this.
  2. QFSW

    QFSW

    Joined:
    Mar 24, 2015
    Posts:
    2,906
    This looks awesome! Glad to see you're at it with another high quality game :) What's the next plans? Anything else left for the terrain/level generation?

    Never seen a procedurally generated tower defence game, this could be awesome!
     
  3. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    For terrain mostly small tweaks to ensure it always looks good, so more smoothing out terrain near the paths and so on. Other than that I might go in and try to add second paths, at least trying to add a second start point and see how this works out. And of course, clean up the code, it is quite messy and uncommented at the moment. But that's for later, will try to start working on some basic enemy stuff next, just to get some variation. :D
     
    QFSW likes this.
  4. QFSW

    QFSW

    Joined:
    Mar 24, 2015
    Posts:
    2,906
    Functionality before form :p
    Good stuff, keep up the good work :)
     
  5. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    It's been a while since I updated this thread, since I have other games to work on (Check out Brink of Extinction, Duostack and Project Battlespace here in the forum). :) But there's been some minor progress:
    Level generation code is now cleaned up and optimized.
    I've started working on a modular upgrade system for the turrets. So in terms of code, each aspect of the turret (targeting, firing, different upgrades such as shooting fire etc.) is a separate module that attaches to a base class, allowing for complete flexibility.
    I've started working on the enemy code, which is quite bare bones - they will just move through the levels, and some will have the added ability of targeting and firing at turrets. They will, however, only fire things like slowdown spells and similar.
    I've also set up a Theme-class that holds all info for each theme. So the same level can generate with a multitude of different looks (level 43321):
    Screen_20170722.png
    I have not added terrain height generation into the random seed and I'm not sure whether to do so. The randomness of the terrain could on the one hand make for good variation, similar to the different themes. On the other hand, it makes the individual levels less recognizable. Any thoughts?

    Edit: @QFSW will be handling some code for high score management. Some much welcome help with the project! :)
     
    Last edited: Jul 22, 2017
    QFSW likes this.
  6. QFSW

    QFSW

    Joined:
    Mar 24, 2015
    Posts:
    2,906
    I think it'd be pretty cool if terrain height used the seed, that way you get more distinct and memorable levels aesthetically :)
     
    _M_S_D_ likes this.
  7. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    Greetings!
    I've only put in some minor work on this game recently as I'm still busy with other projects, BUT there has been some progress.
    I decided to expand on the modular system to also incorporate enemies. So there is now a base class that handles all enemies and turrets, on top of this class are the Enemy, AttackTurret and DefenseTurret classes. The base class handles cycling through whatever modules are attached to the object. So for example, enemies have a movement module that allows them to move through the level, turrets have (among other things) a targeting module along with a firing module. Since one module may need info gathered from another, all modules are cycled through in order via a given ID and pass a data struct from one to the other. That way, the firing module can check if there's a target given by the targeting module and so on. For defense turrets, there's a gold generation module that gives the player gold to be able to purchase more turrets.
    This system will allow me to easily make upgrade paths for turrets and enemies, where modules will just be added on top of the base object and automatically add hp, strength, gold generation, crystal generation (more on this at a later stage) or whatever the module may be managing.

    On the graphical side of things, I've finished up three of the sets - Lush forest, Mystical forest and Ice lands. I've also added liquid color into the palette along with a transparency value to allow for different transparency for liquids in the sets. Next up I will be working on the Desert and "Grand Canyonesque" sets with some cacti, pebbles etc.

    I've also finally gotten around to cleaning up the project folders also, which means that I pretty much move this from "prototype" to serious project.

    Lastly, got a magnifying glass working so that enemies and turrets can be inspected closer (as seen to the right). :D
    Screen_20170811.png

    I'm still undecided as to the design of turrets and in particular enemies, so ideas are definitely welcome! :D
     
  8. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    It's been a while, so I figured I'd drop an update.
    Game is progressing well, albeit slowly. I've got a lot of the underlying systems in, so next up will be working on the UI and graphics for UI. I've also figured out some ideas for enemies that I will be trying out in the upcoming week or so.

    I've also added a "deconstruct" sequence for when the player loads another random level:


    Only addition left there is fading the pieces out as they move out, to make things look smoother. :)
     
    QFSW likes this.
  9. QFSW

    QFSW

    Joined:
    Mar 24, 2015
    Posts:
    2,906
    Looks nice! When can we expect to see any turrets or enemies?
     
  10. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    VERY difficult to say. But I have some ugly concepts drawings to go by, so hopefully it shouldn't be too long. :D There should be something somewhat finished in september at least.
     
  11. QFSW

    QFSW

    Joined:
    Mar 24, 2015
    Posts:
    2,906
    Looking forward to it!
     
  12. taistelusopuli

    taistelusopuli

    Joined:
    Nov 6, 2014
    Posts:
    41
    This looks like a great project! I bet this could be something ;) I look forward to seeing the turrets and enemies. Great work on the construct/deconstruct animations!

    If you need, I love to have chat about music for the game! :)
     
    Last edited: Sep 8, 2017
    QFSW likes this.
  13. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    Thanks :) I sent you a pm.
     
  14. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    Last edited: Oct 6, 2017
    QFSW likes this.
  15. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    After doing the write-up on the procedural generation I decided to change up a few things.
    The most obvious change can be seen here:
    Screen_20170918.png
    Variable map sizes! The randomization now also randomizes the size of the map between 6x6 to 25x25.
    Also, I've removed the "rule" where paths could only enter from the sides and exit at the top or bottom of the map and instead allow all manner of combinations (going from side to side or even the path exit being on the same side as the entrance).
    Lastly, the terrain generation was not random enough, so I've added an offset, which has made everything much more variable. This can be seen in the above picture, especially compared to the images earlier on in the thread.
     
  16. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    It's been a while since I posted here. Been very busy with full time job and getting Brink of Extinction and Twinstack (formerly duostack) ready for release. Since they're almost there, BoE up for release on the 30th of November and Twinstack somewhere mid December, this will be my primary project thereafter.

    Since I'm still a bit uncertain as to what turrets and enemies will look like, I've continued tweaking level generation and also started working on ui.
    Here's one of the new themes I've added, "rock forest":
    Screen_20171014.png

    More on the desert theme:
    Screen_20171021.png

    And finally, an early test of the ui for turrets:
    minigif.gif
    The colored boxes are just so I know which button is which until I make the actual design :D The finished menu won't be quite as large either, since branched buttons will be removed once you pick one of the upgrade paths (here blue, green or purple).
     
    QFSW likes this.
  17. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    Back to business! I've started working a bit on this again. First order of business was to redo part of the level generation code to allow for overlapping paths and crossroads. Said and done, here are some resulting levels:

    Desert level:
    Screen_20180214 (9).png

    Lush forest level (very short enemy path :) ):
    Screen_20180214 (15).png

    Mystic forest level (with a short overlap):
    Screen_20180214 (17).png

    New Jungle theme level:
    Screen_20180214 (26).png

    And new cave theme level (where the background tones to black when the level generates):
    Screen_20180214 (18).png
     
  18. QFSW

    QFSW

    Joined:
    Mar 24, 2015
    Posts:
    2,906
    Really liking the cave theme!! I see the game has a name now too?
     
    _M_S_D_ likes this.
  19. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    Yup! Finally has an official name. :)