- What went well
- What didn't go so well
- What did I learn from it?
- Screenshots and GIFs
- Multi-weapon Player Inventory
- Player Controlled Camera Rig
- One Boss Room per Random Dungeon
- Dynamic Rooms
- Multistory Dungeons
- In Game Map View
- Soundtrack:
- Things I Left Out Due to Time
- Known Bugs
- The Video
- The Demo
After hearing this question a few times in the discord channel, I decided to give the newest version of the asset and Unity 2019.4 LTS a run to make sure I could do the URP "upgrade" and get rid of that giant HDRP warning that comes by default.
Here is the document that steps you through that process.
HOW-TO: Convert PolygonR's Sci Fi Top Down Prototype To URP with Unity 2019.4 LTSNote that I did this with Unity 2019.4.14f1 and Sci Fi Top Down Game Template Version 2.11 (last updated Jul 7, 2020). If you have different versions of either, your mileage may vary.
What went well
As far back as Diablo (and really even before that, with the ORIGINAL Gold Box D&D: Pools of Radiance), I've always wanted to create my own top down combat game. I absolutely loved the player experience of the Dungeon Siege games, and I wanted to implement as much of that camera control and party mechanic as I could in Unity.
So when I saw the Sci-Fi Top Down template in the asset store, I decided to give it spin as a springboard to implement that kind of mechanic, but in a sci-fi setting.
Starting with the basics of this template, it has animated soldier and 4 legged procedural walking robots, along with animated turrets. I went in and immediately changed the weapon selection mechanic to be hotkey based (1 - 4 for the 4 item slots) and I added camera controls that suited my Dungeon Siege inspired plans. I even added the "zoom way out, but still be able to control your avatar for movement and combat" mechanic that most games now-a-days have replaced with an overlayed map. I still prefer the Dungeon Siege method, and went with that, though I did not get to add in the LOD changes, or the worldspace UI overlays I wanted to add due to time constraints.
Once I was confident I had the basics of all of the game mechanics sorted (movement, camera, weapons, and inventory), I decided to give the included dungeon generator a try. The one in build 2.1 of the asset was almost ready to use, though it appears to be broken in the newer 2.11 build, but I have only spent a few minutes in that build, and reverted when I couldn't get the dungeon generator to work.
Now I've generated a half dozen dungeons, I figured out how to randomize the setup of items in the rooms, and I added in a "boss" room at the end of the map. There is still a bug where the boss room gets "locked" from the player getting to it. I'd planned make a game mechanic where you have to clear all the other enemies first and then the boss room gets opened — but right now, I'm just removing that lock and saving the dungeon with the boss room.
I spent a lot of time and finally abandoned building my own boss character. Something about the movement mechanics was making my boss character bounce all over the room at rapid speed and I couldn't track it down. I fought with it and finally lost steam. I even asked for help and people with much more experience than I have at this point, but they were also baffled ... so that was the end of that.
For the boss, I just modified the existing 4legs robot, made him bigger and gave him a different type of gun. He still needs a lot of tuning to be a "boss", but since the room has so much going on, it makes it pretty tough even without him being a good boss.
What didn't go so well
I started with a lot of excitement, since I was starting with a template which seemed to have a lot of the top down game mechanics I wanted to build on top of. WASD movement, mouse aiming, npcs that walk around and have basic player hunting behaviors.
But upon importing the asset, my excitement got quashed quickly. The asset only worked out of the box with the old rendering pipelines previous to Unity 2018. With all the confusion around the various rendering technologies (Read my Unity Render Pipeline Learning doc), getting this asset up to spec with Unity 2018 was not going to be easy.
After I read enough forum posts and figured out how to make everything stop being pink, I moved onto the game demo scenes. Loading the various ones in order, the main menu was clickable, to load the next scene, but then the character selector was not clickable — and it didn't make it obvious which keyboard key to press (E in this case) to select my avatar. Going with the built in menu system wasn't going to be part of my plan.
Moving right along, I loaded the survival demo scene and right off the bat, the enemies weren't respawning after the first wave. I then spent a good hour learning how the spawn system works, fixing the spawn counter for the level, and then finally being able to spawn more waves of enemies.
After I got the enemy respawn system working, I realized that none of the player keys were documented. Neither were the joystick controls. I wrote my own instead. Note that my docs reflect changes I've made to the template as well.
NOTE: I just found this in the "instructions" object in the PlayerCamera_TopDown camera.
```
to switch between Keyboard and Joystick use "K"
to switch AIDebug text use "F1"
Move: WASD | Aim :RMB or RStick | Shoot: LMB or RT | Reload: "R" | Crouch: "Ctrl" or "C"
Interact: "E" | Evade: "Space" | Change Weapon: "1" | Unarmed; "Q" | Grenade: "G"
```
* I updated it to change weapon to T and added shift to run.
KEYBOARD + MOUSE
* Hold Right Mouse Button to Aim your weapon.
* Left Mouse Button to fire (if always aim is not on)
* Mouse Wheel switches weapons
* T switches weapons
* E to interact with triggers and pick up weapons and ammo.
* Note that you replace the current weapon when you pickup a new one
* R to reload current weapon
* V to melee bash with weapon
* Q to unequip weapon
* K to enabel/disable joystick
* CTRL to crouch / sneak
* Space to leap / roll
* Shift to run
* in menu, 1, 2, 3, 4 to join in slots for player 1 - 4
* F1 to see debug on AI
* B turns on and off blood
JOYSTICK
* Left joystick - move
* Right joystick - aim
* Right Trigger - Fire aimed weapon
* press k on keyboard if mouse aim is blocking your ability to aim with joystick
* A button - pickup item, join
* B button - run
* Y Button - Reload
* Right bumper - throw grenades
* Left bumper - leap / roll
Lastly, the overall feel of the engine layout just wasn't what I was hoping for as a basis for any longer term project, so I decided to stop at the point which I have in the videos with one boss room and a multi-story dungeon randomly generated.
What did I learn from it?
A quick bullet point all of the game mechanics in this prototype.
- spawning of a player avatar with 4 weapons + melee + grenades
- weapon switching by numbers 1 - 4
- Player always firing the direction of the mouse (always aim)
- grenade throwing the direction player aims
- procedural walking enemy robot with ranged weapon
- quick pickup animations for the copious amounts of drops
- destroyable enemy spawner object in scene
- all damageable objects have a world space health bar overhead
- destroyable crates that drop loot
- enemies drop loot
- turrets drop loot
- destroyable enemy spawner drops blue key
- laser turrets with "stop and charge" stage
- room with destroyable crates randomly placed
- zoom camera via mousewheel
- Fast "map mode" via tab (zooms way out)
- rotate camera via holding ALT
- second dungeon visible beneath the current main one to imply that there is more to explore
- distance based sounds
Things I was testing with this prototype:
- Can I make a player character controller with multi-weapon and ammo types feel "natural" without an inventory UI
- Getting a feel for top down combat
- Worldspace UI
- Different types of destroyable objects drop different types of ammo via ScriptableObject
- Destroyable spawner
- Making a scifi "shooter" in the style of Dungeon Siege, but with WASD and mouse aim instead of click to move + attack + interact
Screenshots and GIFs
Multi-weapon Player Inventory
Player Controlled Camera Rig
One Boss Room per Random Dungeon
- Spawns boss and multiple minions quickly.
- Aiming range of turrets is enhanced
- Boss is slow but has a heavy weapon and is much harder to kill
Dynamic Rooms
- waypoints that have the bot travel in and out of the room
- turrets in the corners
- crates that can be destroyed
- crates drop loot from unique list of drop items
Multistory Dungeons
In Game Map View
Soundtrack:
Though I swore to myself I wouldn't write any more music for my own games until I had a team of developers making the game awesome while I wrote awesome music ... I slipped up once during the development of this prototype and created this first mix of a track I named Diddle Foo Top Down (for no obvious reason).
Things I Left Out Due to Time
- locked room after boss key
- level portals to load a randomly generated dungeon
- dynamic music based on threat level
- intro scene with story
- multiple room configurations
- unique boss sphere with laser eyes
Known Bugs
Blood decals get overwhelmed and don't despawn well.
Loot drop UI are all called "New Text" and hover disappears after mouse over.
Keys don't have pickup labels
Jump Mechanic is very stiff
Walls block view unless you rotate your camera
Top down view when zoomed in fully is focused on the knees instead of the head
Worldview UI stays active in "map view" instead of my dreamed up "strategic overlay".
The Video
The Demo
- Download the demo zip here.