Jump to content
  • Advertisement
  • entries
  • comments
  • views

Multiple Ships and Various Ship Configurations

Sign in to follow this  


Development Update

I spent this week reorganizing my battle system code. In the early version, I had hard-coded 2 ship participants: (1 human, 1 ai ship), but now it supports fleet versus fleet.

I also cleaned up my configuration code so that it's much easier to build different hull types, and configure them how you like. Currently the only equipment I have are weapons (laser or cannon), but I like the organization of this code and the related unity game objects.

The hull game object contains variously sized cubes that make up the physical model of the ship. Empty game objects are positioned where various ship equipment will attach such as weapon components and have a SlotController script attached to it that specify the supported SlotType and have variables to hold the currently configured ShipComponent. The positioned slots serve as anchor points for any physically visible ship components such as weapon turrets.

Here's a video showing a scout and destroyer configured with lasers. Versus a computer controlled scout and destroyer configured with cannons.

Having multiple ships exposed an issue with my cannon shells. The bullets ignore the ship they're firing from, but everything else is fair game. So if a bullet misses the first ship in it's path, it might keep traveling and hit the ship behind it. That's not too bad and could even be passed off as a feature, but I think my bullets are applying their damage each time they pass through a different cube of the same ship. It definitely warrants more investigation.

Another strange issue I noticed is when I played my game on my wife's computer. The mouse's world position seems to be offset by 1 in the Y direction. You can see it when I'm moving the ships and the ghost ship isn't right on top of the mouse pointer. The gui system seems offset vertically as well. But on my computer it runs just fine both in the editor and if I build a separate executable to run it. I have no idea why it's acting wonky. :/

I think my battle system is enough of a place holder so that I can move to other game elements. Next week, I'm going to work on some "overland" travel. I want to be able to control a ship going from planet to planet. Between travel destinations, I'd like to roll for a random encounter chance and trigger my battle system. I may also put some time into a GUI system. The stuff I have now is hacky, hard-coded nonsense.

Tip from your Uncle Eck:

Be sure to allocate time to refactor your code, especially in the early stages of development. Think about where it's painful to add features or make simple changes. Figure out why, and design something better. If you don't do this, your poorly designed codebase will drag you down like a boat anchor.
Sign in to follow this  


Recommended Comments

Looking good.  I still like how great your ship destruction looks.  You could probably solve the bullet problem by moving them to another layer once it's determined they've missed.  (Some ignore all collision layer, or at least all ships)



The 1 pixel thing is definitely strange.  Is her machine at a different aspect ratio or DPI?


(And your updates always inspire me to update my journal and game link...I'll have to get on it)

Share this comment

Link to comment

The 1 pixel thing is definitely strange.  Is her machine at a different aspect ratio or DPI?

It's definitely more than a few pixels. In the gui it's about half the button height, but in world coordinates, it looks like it's off by 1 Unity unit (about the size of one of the ship cubes). I plan to put some debugging code in and make a game object follow the mouse, printing out the coordinates so I can try and see what's going on.

Yup, different aspect ratios. I'm running at 1280 x 1024, and she's a 1440 x 900. But I'm building an executable, and Unity asks for the resolution before I run it. I also need to test to see if it only happens when I run Fraps. They do some weird window hooking into. Next week, I'll post more details.

(And your updates always inspire me to update my journal and game link...I'll have to get on it)

\o/ Yay! I'm helping! smile.png It's also motivating for me. Each journal entry I try to write what I plan to deliver in the upcoming week. It helps me stay on task so I can deliver on my public claims. I sincerely doubt anyone's following me enough to notice if I ever slip up and don't deliver on last week's features, but I'll know. That's why I worked extra last weekend so I could keep my promise. smile.png

I also do it because I think it will serve as a marketing investment (eventually). And it gives me some practice making videos and writing about my game.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!