• Register
Post news RSS Feature Update - Customizable Crosshairs

New features added, bugs fixed, and an update on the state of the game!

Posted by on

Lots of work has been done in the past few weeks! Here's a quick list of the bigger features that have been worked on:

  • Targeting ships will now show what players are in it.
  • Instead of just an indicator that shows you're reloading, redid UI to show a bar that refills letting you know how long you have left until the weapon is ready.
  • Mines now track any part of a ship instead of just the center.
  • Improved state transitions so players will have clear notifications of what state the game is in.
  • Overhauled Crosshairs and made them customizable (Featured below!)
  • Made it so ships will no longer sometimes damage themselves with projectiles.
  • Swapped secondary weapons between corvette gunners.

Customizable Crosshairs

The feature I want to highlight here is the redone crosshair system. Up until this point, the crosshairs being used were some I threw together quickly in Paint.net as PNGs and added them in using Unity's built in GUI (this was before I started using NGUI).

They had some downsides to them such as that the color was fixed. Though I think they were a nice shade of blue, not everyone is going to like whatever color I choose. Even worse, they wouldn't scale with the screen resolution. Playing at a lower resolution meant that the crosshairs would take up more of the screen which makes them inconsistent as a guide for aiming.

So the answer was to leverage NGUI which allows me to automatically scale sprites to match the screen resolution as well as change their color at run time. Of course doing so required me to make a new set of sprites (right resolution and white) but I thought they could use an update anyway.

Crosshair Options + In game

The nice part of this is it allows me to add to the options screen a way to allow the player to choose their own crosshair color. I wanted players to be able to choose any color they want but I also didn't want to make the process overly complicated. A color picker like you see in image editors is a great way to accomplish this but is overkill for a game like mine. Using hex codes is a easy way to achieve any color but not everyone should have to understand hexadecimal. My compromise is to have a dropdown menu with some basic colors while still having a hex input for advanced users.

Crosshair Options + In game

I think this is the best of both worlds. Easy to change to something different quickly but if you have a specific desire, it only takes a single code and you're good to go. It also works in-game too so you don't have to leave a game in order to change crosshair colors.

Here's a few more screenshots to get an idea of how it looks:

Crosshair Options + In game

Crosshair Options + In game

Crosshair Options + In game

Let me know what you think!

Guest - - 692,668 comments

Uhm... I don't mean to say it is not a nice feature for esport games, but isn't it a feature that's just a very few lines of coding?

Reply Good karma Bad karma+1 vote
_dhk_ - - 416 comments

ah, damn... posted as guest accidently... sorry :)

Reply Good karma Bad karma+2 votes
Codestar Author
Codestar - - 13 comments

No problem :)

I'm assuming you're talking about the crosshair coloring specifically rather than the implementing the crosshairs as a whole. While it's not a monumental task, it's probably not quite as trivial as you might think.

Yes, actually setting a sprite's color (in NGUI) is a single line but the question is which sprite and which color? So we have to have some selection based on which ship the local player is in and which weapon is currently active and which crosshair sprite is associated with that. Still not terrible as much of this exists for other purposes.

So we still need the color and being able to choose mean GUI elements (NGUI helps a lot here), saving player preferences, and converting between Unity colors, hex codes, and strings. So there's a bunch of GUI control code, run time updating, and utility functions.

This response is probably way longer than it needs to be but anyway I thought it was a cool feature worth showing off!

Reply Good karma+2 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.