• entries
    27
  • comments
    62
  • views
    24985

stats.UpdateUI, Pixel Imperfect, UI Stuff, Gore

Sign in to follow this  

971 views

Things are coming nicely, and it's finally starting to look like a game, instead of just a bunch of pieces.

Since my last update, I've done quite a bit, including some major refactoring, UI Design, setting up a pixel perfect camera, modifying graphics and experimenting with exploding enemies and blood effects.

Stats.UpdateUI()

First off: when I'm coding, I'm very much in a trance, and I have a bad habit of thinking that I'll, "Just make it work first, then make the code pretty later". All too often, I'll get carried away and don't take the time to do the second part. As a result, I actually had lines in my code like stats.UpdateUI(). I think that one method call speaks volumes.

I set up probably half a dozen new classes (including UI, Audio and Shop Managers), and the project is, once again, pretty maintainable.

While I was refactoring, I was curious how other programmers work. Do you guys actually spend a lot of time on design before actually beginning implementation? This was pounded into my head in college, and I definitely see value in it, but I often find myself thinking that it's just too hard to plan for everything up front.

It seems to me that, for a smaller game like this, just having a small design doc roughly outlining things and kind of winging it during development is okay. But for a bigger project, much more time should be spent considering code structure, etc. What are your thoughts on this?

Pixel Imperfect

After I refactored, I played the game for a bit, microanalyzing every detail, and it occurred to me that the pixel art in-game looked like shit. Some pixels looked okay, while others were more like rectangles than squares. I think this was a lot more noticeable because I put a 1 px black outline around all of my enemies.

I did a lot of googling, researched some pixel perfect camera assets, and scared myself shitless that I didn't plan for this and wouldn't be able to make it work. After fiddling with settings and third-party stuff for a couple of hours, the art that I had spent so much time making look crisp and clean still looked like garbage. Considering the fact that I'm hoping for sponsorship for this game, I almost felt like throwing it out.

But I persevered, and managed to get everything looking sharp.

For any who are interested, here are the settings I had to tweak to make sure everything rendered properly.

In my sprite's import settings, I set the Pixels Per Unit (PPU) to 100 (this becomes important later), set the Filter Mode to Point, and the compression to True Color.

These definitely play an important part, but they're pretty easy to figure out. The next part took some tinkering.

The key to sharp, squarely rendered pixel art in Unity, is to ensure that the vertical resolution of the game, the camera's orthographic size and the sprite's PPU and scale are compatible.

Basically, you have to make this equation true: R/P = O (where R is vertical Resolution, P is PPU, and O is orthographic size).

In my case, I have a vertical resolution of 600, my sprites have a PPU of 100, and so, I set my Orthographic size to 6 (600/100 = 6).

This got things looking better, but, I had one more thing to sort out (and this was my most important lesson).

Stupidly, when I was creating my art, I didn't scale each piece relative to each other, I figured I would just scale the gameobjects as needed. Nope. Big mistake. My zombies had a scale of 1.73..., my bike had a scale of 3, my player 1.5... Needless to say, this resulted in crap graphics.

I've found that, generally, any power of 2 scale will work fine, but in some strange (and by fluke) cases, scales like 1.5 also work. So, I had to rescale all of my sprites and tweak my physics and variables to account for the new scale. A lot of work because I didn't have the best foresight.

Here are some before and after shots of the motorbike:

eKBvgoO.png

1FvWlWu.png

Huge difference, right?

So, the moral of the story is: Create your art to scale if you're using pixel art.

Gore

Also, the other day, because some of you said it would be cool, I started experimenting with enemies whose limbs could be shot off.

I'm on a different machine right now, so I can't share examples of the experiments, but I think they'll turn out nicely.

Each limb of certain enemies can be shot off, and, if killing enemies with shotguns, they'll explode (into all separate limbs) upon death.

Each limb will have a particle system attached which spews red pixels from it in a very excessive anime/kill bill style. The particles will also collide with other game objects, which gives a nice effect. There will be lots of blood.

As an aside, I was lucky that 2d particle collision was JUST added to Unity in the 5.3.5 release in May (though the physics around the collisions still seem a little buggy).

UI Stuff

Lastly, tonight, I've been doing some more UI design, and if anyone would be so kind as to share some constructive criticism, I would appreciate it.

Tonight I mocked up the weapon purchase/upgrade screen. Here is the progression:

Player presses a key to open the menu:

98S1ffQ.jpg

Player clicks the AA-12 weapon:
gAz7xeN.jpg

Player clicks 'BUY':
T0e5nRz.jpg

Player clicks on the Damage upgrade:
PLOQCvg.jpg

What do you guys think?

Sign in to follow this  


5 Comments


Recommended Comments

Haha, whoo, I look forward to seeing some limbs go flying!!  If you want to go really, really crazy, you can have zombies whose legs get shot off, and then crawl towards you on their hands =)  (and zombies who have lost an arm and get their legs shot off just die instead)

Share this comment


Link to comment

And programming wise, it's a mix, some stuff, I just dig right in, other stuff, I think about for a while before starting.  Sometimes, I have some idea rattling around in my brain for a week and need to hammer it out.  But don't sweat it too much, code that ships is more important than clean code that never leaves your computer.  For an example of crazy code, you can find the Lugaru source code online.  That stuff is awful.  But that guy went on to release multiple games, and went off to start Humble Bundle the website.

Share this comment


Link to comment

The game is coming along well. It looks more and more developed by each entry ;).
 

 

While I was refactoring, I was curious how other programmers work. Do you guys actually spend a lot of time on design before actually beginning implementation? This was pounded into my head in college, and I definitely see value in it, but I often find myself thinking that it's just too hard to plan for everything up front.

I think design is the lion's share of the work regarding programming usually. At least in my work-flow it is and by working a lot with other programmers too, I can safely say this is common.
While developing a given feature, usually it takes much more or just as much time, designing a correct and pleasant interface, selecting and designing the efficient algorithms and data structures and preparing test cases (low level e.g.: unit tests and high level alike, e.g.: written steps or pre-recordings with an automation system), as writing the actual code to complete the implementation of it. Of course doing these task can be done parallel while coding, but ultimately you end up with a result which require more immediate modification while coding or require later fixes and heavy refactoring, so I believe this route is not faster.

But in the end you have to find a work-flow, that fits you and you feel productive while practicing it!

Regarding your assets and graphical enhancements, the game indeed looks "crispy" now, and that is a compliment for pixel art games :).

Cheers!

Share this comment


Link to comment

Haha, whoo, I look forward to seeing some limbs go flying!!  If you want to go really, really crazy, you can have zombies whose legs get shot off, and then crawl towards you on their hands =)  (and zombies who have lost an arm and get their legs shot off just die instead)

The whole crawling zombie thing would definitely be cool. Alas, I've sworn off making more graphics for the game (aside from color variants for tougher enemies). I don't even think I'll bother making graphics to show which weapon the player is holding. It might look funny to have a pistol graphic firing spread out shotgun rounds, but I really don't think people will complain (at least I hope not).  

 

Thanks for all of your feedback throughout this project by the way! It's definitely helped to keep me motivated.

Share this comment


Link to comment

The game is coming along well. It looks more and more developed by each entry ;).

 

...

Regarding your assets and graphical enhancements, the game indeed looks "crispy" now, and that is a compliment for pixel art games :).

Cheers!

 

Thanks for the compliments (and feedback)! Good to know I'm not the only one who thinks it's progressing.

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