Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Dungeon Keeper - How to

Discussion in 'Scripting' started by MornFall, Jan 11, 2013.

  1. MornFall

    MornFall

    Joined:
    Jan 11, 2013
    Posts:
    160
    Hello people,

    If any of you of you remember that game : Dungeon Keeper, i am trying to re-make it in unity ( learning java scripting at the same time ).
    If you do not know that awesome game : http://www.youtube.com/watch?v=LOfZJ-3PrCQ

    I am at the stage where i need to figure out how to make the level basically... And i would need some advices on how to proceed. The stage i am at exactly is : the player click the block, it destroys the block. ( please see the video to understand ).
    I was wonderign the best way to to achive that : A grid system with all the blocks at the beginning, the player simple destroys them ? ( but i am afraid that this method will be real hard on the AI Pathfinding ? ). Or may be the opposite : the player builds " empty space with walls ? ( but in that case i am not sure how to handle it when the player is building rooms instead of straight tunnel....)

    May be one of you could point me out int he right direction as to how to handle that process the right way, how would you do it ?

    Thanks,

    North.
     
  2. jessee03

    jessee03

    Joined:
    Apr 27, 2011
    Posts:
    729
    I think a grid with blocks would work the best. Use raycasting to select each block that you want to be destroyed then move the creatures to the location to destroy the blocks after a set amount of time. You could also using raycasting for the AI pathing as well to make sure they follow the correct path.
     
  3. MornFall

    MornFall

    Joined:
    Jan 11, 2013
    Posts:
    160
    I think you are right, that was my first idea. You would not worry about the fact that a basic level, at game start, would have 50 x 50 Cubes/Block, and aht would not impact dramatically the framerate ? ( i am planning to play that on PC only.)

    Edit : You mentionned raycast to destroy blocks. Would'nt OnMouseEnter be best suited for that ? ( that would require having a script on each block.. so may be not.. )
     
    Last edited: Jan 11, 2013
  4. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Raycasting would be better for the purpose of destroying rocks!

    In regard to pathfinding and creating walls, then an approach could be to generate the pathfinding on a plane before creating the walls.
    Then if you break down the wall you can go through at that spot. However this will require that before calling a path you will check if the spot is occupied by some object, again using a rasycast.
     
  5. Chaosgod_Esper

    Chaosgod_Esper

    Joined:
    Oct 25, 2012
    Posts:
    295
    I´m working on a DK remake, too.
    Best way is raycasting.
    I made a "work_todo" array, wich stores the jobs imps need to do. his array contains a subarray with up to 3 spaces for 3 imp GameObjects, the XY Coordinates of the Block that needs to be digged out, and a bool - wich holds if the block is still alive or not.

    So, selecting a block means i fill up the array (with up to 3 idling imps), create a path (A*) for them to reach the block (a normal block wich can be destroyed, has 600 HP and a Power of 1, wich means a normal imp with 10 strength points can do 10 damage points). If one of those 3 saved imps reaches the block (by checking distance), it starts digging. When the Blocks HP are equal or below 0, the block gets destroyed, the switch sets to FALSE. And the 3 Imps are send to the next block beside the destroyed one - or another one if there´s no block beside the last.

    And as a second thing, i make a surrounding-check for all blocks around the destroyed one, to update their modelfile to fit the hole (autotile system). I made 48 different wall models for each situation :)


    Creating a DK Game is not that easy. Cause the Game Mechanic is really complex. You need to do a lot of raycasting and tracing for each kind of situation. The baddest thing is the path system. There´s a reason why DK doesn´t allow an imp to abort it´s path. Imps are running to their goal - even if it doesn´t exist anymore. That´s cause of the situation, that a player can hold up to 80 Imps + 60 Creatures - And don´t forget the heroes. Everything it this game (except the blocks) need a path. So i think a good path System is the hardest work for this kind Game.


    My progress:
    Finished - map buildup
    Finished - Digging system
    Finished - Dummy Imp System (no model yet - just a basic cube with a pickaxe icon)
    Finished - Fear System (Imps are not running through lava or over crevice (new))
    Current Work - Imps can conquer empty/enemy floor tiles
     
  6. dave_mm0

    dave_mm0

    Joined:
    Feb 8, 2013
    Posts:
    26
    I think chaosgod is on the right track for this. ALthough 48 different models for a wall seems like a lot of work. Since I have a large programming background I would start with a square and dynamically change the shape of the block to fit the hole instead.

    Anyways, I really just wanted to say +1 for making a DK remake, I loved that game :D I will be happy to beta test for one of you if you get it off the ground!