Next Broadcast

Space Colony: RTS Survival game - Unity3d

CmdrCookie GameDev DK30 Spring 2019 4 12

Description

Begin planning and creating a new Space Colony survival game. By the end of the project I plan to get through planning and creating the initial camera control and character interactions.

Recent Updates

CmdrCookie 6 years ago

Day [30] here we are! I’ve reworked my physics animation to respect spherical planets rather than assuming up is always up. This was one of those situations where you put in a ton of effort to effectively get the same result, albeit with all the nuances handled now.

So that’s it for the dk30 for me! I definitely don’t plan on stopping with this project though and want to see it through to the end. I’m at the point now where it’s time to build on the game-y parts rather than the structural controls and what not. All that said, super proud of what I was able to do.

Here’s my best shot at a gif capturing everything created over the DK 30. Ignore the “cartoon character entranced by pie smell” floating feet, that’s the last bit of the physics rework to be fixed XD

chweet

CmdrCookie 6 years ago

So it’s been a bit! I’ve been chipping away at redoing the outline selection shader and realized it was a bigger undertaking and that crushed a lot of my motivation lately while slogging through it. While it wasn’t wasted time, I don’t have much progress to show, just some extra knowledge for when I get back to it.

What I pivoted to was reworking my worlds to actually be planets instead of flat planes. So first up was to rework my camera to allow for pivoting, rotating, and translating across a planets surface.

Next step after this, which I feel like is going to be a huge undertaking, is to replace the generic downward gravity that Unity has and create gravity per planet that pulls to the core. I have no idea how this is going to affect the current physics animation. I don’t really see why it would break much, but that stuff is so delicate that I’m mentally prepping for the worst.

tweet

CmdrCookie 6 years ago

The Colonists are smart enough now to autonomously go to new buildings and start building them!

As of right now, buildings don’t take any resources, just the time for colonists to build them. Ideally buildings will require a certain amount of resources first that need to be dropped off, then someone can build the structure, but that whole bundle of logic is an utter mess right now. I was hoping to at least do a first pass and then refactor all of the AI logic together, but things are quickly becoming a struggle as is, that I might put a hold on the resource management stuff for now.

Tweet it

CmdrCookie 6 years ago

Worked on a shader for building construction. Once I get my colonists actually building structures, the phase-in will match the building progress.

Not much beyond that though. The AI logic for picking workers and getting them to build structures has been a real slog and taking way longer than I’d hoped. My short term goal for now though is to push through and get it wrapped up by the end of the week.

CmdrCookie 6 years ago

My updates are getting a bit less frequent. Partly due to the fact that Easter has happened and work has been busy lately, but mostly just that the stuff I’m diving into is a bit more involved and complex for me. The weather’s also getting real nice out so that doesn’t help motivate me.

But onto the progress, the little duders have minds of their own now! Or at least the first workings of the AI logic is there. At the moment, when they’re instructed to harvest a mineral, they’ll grab as much as they can hold, find a spot to store it, then go back for more and repeat.

With that, it looks like that’s effectively everything I had planned for this DK30 originally! Even though that’s it for my DK30 plan, there’s still the whole rest of the game to go, so for what’s up next: There’s a huge amount of work to clean up and improve the AI logic but first I think I’m going to move onto building construction. That means 1. adding a few more buildings to place, and 2. building out the logic to find the required materials from storage, and then place them at a build site. After that, then I think i’ll circle back on the AI logic again and re do some things, as I’m sure I’ll learn a bit through that process.

Tweet link

CmdrCookie 6 years ago

Today I reworked my entire resource system under the hood. The end result so far is just that their little backpacks expand now to show how many resources they’re holding. What’s not shown is that now the type of material and how much of each is all being tracked behind the scenes, transfering from the resource node, into the colonist’s backpack. The next step is to complete the loop by having the colonist go deposit the resources into a new building or into storage and have the resource leave their inventory and transfer into the building/storage.

Outside of this, the past two days have been spent planning the whole data model for tracking resources which set the ground work for all the code today (Lots of scribbly drawings have been made). Today was probably the most efficient day I’ve had so far in terms of pure lines of code, despite the output not currently resulting in much just yet.

tweeter

CmdrCookie 6 years ago

Today’s a smaller update. I worked on importing a cursor and tooltip from an older strategy game that I started on. Same one that the building from earlier came from. I like the idea of having a cursor for input. One, it’s a nice visual that I can use to snap on and highlight things easily. And two, it makes supporting a controller super simple, as all the interactions can be feed through that cursor object. The only downside is the cursor might not be quite as snappy/simple for a mouse and keyboard use.

The tooltip icon that’s floating above that grey iron/rock object came from from the little third person adventure thing that I originally created the wobbly duder for. I plan on reworking that to a proper panel with information that I can use when selecting buildings, people, resources, etc. For now though, its a simple pop up that billboards to the camera, and has some animations for popping up and shrinking away.

CmdrCookie 6 years ago

I’m back from an impromtu hiatus over Sunday and part of Monday. No reason really other than not being quite as motivated and the break was needed after working each day. I did manage to cover a lot of rudimentary planning yesterday that was pretty helpful for structing my code and what features I want to be implementing in the near term.

But enough about my days off, I made more progress on resource gathering! A lot of work today was on the first steps towards building out the AI logic for the little colonists.They’re now able to take an instruction, like harvest a selected resource, then continue to harvest, deposit, harvest, deposit, until instructed otherwise. I even snuck it a tiny animation for newly placed structures. Still no idea if they’ll just pop up, or if a worker will need to spend time building it, but for now it looks a lot sleeker.

I was originally getting to a point where I’d like to refactor some of my code, but I’m covering a lot of ground work and realizing the structure isn’t quite what I planned as I keep adding things. So I think I’m going to continue pushing forward with newer features for now, and take bigger step at refactoring later once I get an even better sense of the final structure. Next up I want to work on actually having the resources be used when building, and added when depositing. That’ll give me a good foundation to work on some additional buildings as well and hopefully things start looking more like a real colony rather than a little test scene.

Chirp chirp, here’s the tweet

CmdrCookie 6 years ago

Lazers! The focus today was lazers. Well, really it was resource harvesting, but the lazers were a vital part of it, obviously.

I’ve realized after getting things hooked up, I’m going to need to spend time refactoring the whole data model behind these colonists as it’s getting pretty messy. I think my plan of attack is going to be wrapping up the resource gathering piece first. The resources still nees to go into their inventories, and then they need a place and some brains that direct them to drop the resources off for the resources to finally to get added to the user’s overall stockpile.

After that I’ll spend a bit decoupling the current controller around moving these wobbly duders. The way it’s split now is the following controllers: RTS_PlayerController -> RTS_HumanController -> PhysicsAnimation_Controller

Ideally, I want the code to respectively be, (handle the user input) -> (colonist logic and commands) -> (pure physics animation)

As i’ve started building things out, the separation is bluring and its getting tough to keep all the states running in sync as they should be.

That said, taking a moment to look at my initial estimates, I’m way ahead of schedule which is awesome! But now I also want to revisit that and update some future week goals.

tweeeeeeet

CmdrCookie 6 years ago

So my next goal is to get resource gathering in and first step on that is to get my little colonist duders to actually do something once they get directed to some resources. For now, I’m thinking they’ll just have little harvesting-gun-multi-tool thingys for all the actions they’ll be doing in a colony.

Step 1 of the first step though, is to get the animation for aiming built into my physics setup. It’s a little sloppy right now but thats part of the charm. Still want to clean it up a bit though. For now though, they can have standoffs and stick ups all day long till their hearts’ content.

I was really close to getting the actual particle effects and harvesting of resources working but I wasted a bit too much time fiddling with particle systems today when I finally opted to just find a free asset that does what I’m looking for. Probably another 30 minutes or so till its working but I’ll leave that for tomorrows goal/update.

Annnnddd tweet

CmdrCookie 6 years ago

I have a proper building preview when placing buildings! This one was pretty rough as I’m pretty shakey with Unity’s renderers and materials. With what’s currently implemened, i’m sure there’s 5+ other ways that are more efficient or cleaner but for now it works so i’ll take it! Honestly I’m surprised I was able to get the green/red preview working with the fancier building as there’s a lot of children objects and materials that make it up, so the code needs to be going in and modifying all of them on the flying, but still keep the originals to swap back. Once I got it working for the little cube “building” though, everything just clicked pretty well.

All in all, happy with what I managed today. Next up is going to be encouraging the little colonists to go gather resources, so we’ll see how well my current animations work with that…and can’t leave without the tweet

CmdrCookie 6 years ago

So I realized i’ve been consistent enough to have an update of some sort every day, and I enjoy the process of keeping my notes here so i’m going to make a concerted effort to keep the streak going through the 30 days.

On that note, I almost missed working on my game today so this update is a bit of a hasty one…but I started working on Building placement today! I took the quick approach to hooking things up but I’m definitely at the tipping point where my code is going to start getting a lot more complicated if I don’t make a focused effort to structure and plan things out.

A lot more work to be done obviously, like getting proper silhoutte outline of the building preview, making nice effects, all that good stuff. But the skeleton is there for now. I’m not sure yet if building will be a magical thing that automatically functions, or if workers will be required to bring resources in and put time in to constructing things.

For now though, here’s a gif!

And as per my new practice, here’s a mah tweet

CmdrCookie 6 years ago

So the next big thing I want to tackle is selecting buildings from a blueprint menu, being able to mouse around with a building preview in the world, then click to place it. Rather than jump right to clicking and placing buildings, I figured I’d get the UI partly in place first to get the end-to-end experience. Visually I want to work on this a ton, but for now i’m just focusing on functionality.

This resulted in me just working on the main HUD interface. This included getting a pause menu working and getting the little building blueprint panel opening up and down on a hotkey.

This UI was pulled from some initial work I did when I was trying to make an “Advance Wars” type of strategy game (that I ditched once I was determined to figure out physics animation. Still want to go back to that one day). Ended up cleaning things up and polishing quite a bit though.

I don’t have a gif on hand but here’s a link to an old tweet with one.

CmdrCookie 6 years ago

Not much visible progress today. I spent some time planning out future work farther down the line. Otherwise most of my work time today was spent fiddling with the selection outline shader that I ended up just rolling back.

I did manage to get a goofy gif out of me messing around with some of the physics animation properties.

CmdrCookie 6 years ago

Today was mostly stubbing out UI ideas and then I spent more time on the camera controls. Previously scrolling was up/down height of the camera but now it’s an in/out zoom since the user can also just pivot and pitch the camera around. I’ve always liked when games let you zoom in close and see little details, despite it really mattering for gameplay reasons.

As far as the UI, i’m not sure how much I like it. I want something minimal but still gives all the info (which I’m not even sure what that all is at this point, but that’s a task for another day). With this being a sci-fi space colony, I would love to work the UI to be more diegetic and in the world as little pop-ups and things.

Since I post most of these updates on twitter as well, I guess I’ll just start linking things around?

CmdrCookie 6 years ago

Was able to implement move commands when you Right click after selecting a unit. All of the movement and animation was from some previous work I did trying to get physics-based animation working in a third-person controller. I’m surprised I was able to hook in to what I built as easily as I did to get the characters moving.

That said, there’s a ton of knobs I want to tweak to improve the animation now that I’m not controlling these duders 1:1. Next up though is going to be implementing building placement and a UI to go with it. You can already see my extremely high-fidelity building model there on the left of the gif.

CmdrCookie 6 years ago

I’ve been having more time than expected and just getting through things quicker/easier than I had plan. I know have some initial highlighting/selecting working. The effect is a shader made after taking a first crack at Unity’s ShaderGraph.

I’d like to build out a traditional UI and work in the ability to select groups but I think i’m going to focus vertically and work towards commanding the unit around.

CmdrCookie 6 years ago

Took a first pass on the RTS camera and pretty happy with it! I found an existing camera on the Unity Asset Store to use as a base but modified it quite a bit to tailor it for what I need. Specifically, reworking it to work around a parent pivot point (That yellow sphere in the gif) and some different workings of the inputs to get the feel I wanted.

CmdrCookie 6 years ago

Here’s the baseline wobbly physics guys i’m starting with. One of the main reasons for going with an RTS game is I’d really like to use this physics based animation in a game, but I’m not sure if it currently works well with something that requires precise actions/movement like a directly-controller third person game.

I’ve already done a good chunk of planning out for this 30 day project and out using coda.io so next step is to get the RTS Camera working. The asset store for Unity has some good free packages that I’ll use as a start but I really want to customize it out into my own thing.

Estimated Timeframe

Apr 5th - May 5th

Week 1 Goal

  • Write up and plan out a design doc and tasks for what to do in the next 3 weeks and beyond.
  • Create the initial RTS Camera controls.

Week 2 Goal

  • Work on importing existing wobbly physics characters and implement unit selecting.
  • Build out some initial Interface elements.
  • Implement unit commands for moving.

Week 3 Goal

  • Implement a GUI for selecting buildings and placing them.
  • Implement character interactions to bring resources to a planned building and construct it.

Week 4 Goal

  • Implement Resource Nodes.
  • Implement harvesting/mining actions.

Tags

  • GameDev
  • Physics
  • Unity
  • Coding