Jump to content
  • Advertisement
  • entries
    112
  • comments
    236
  • views
    136706

About this blog

Still making games...

Entries in this blog

 

Reducing Unity game file size

Hello,

I've been busy porting Twitchy Thrones to Unity. The game was originally programmed in Objective-C, using XCode and the Cocos2D framework. Cocos2D is a great framework but if you want to publish your game for iPhone, Android and PC you have to use C++ and Cocos2D-X. Setting up Cocos2D-X isn't trivial and using C++, of course, implies losing comforts like automated memory management.

As for Objective-C, it's almost exclusively used by Apple and thus can't be used, as far as I know, to port a game to other platforms. This is actually a Good Thing, since it is a monolithic programming language, full of unnecessarily verbose syntax and lacking modern programming language features such as generics, real encapsulation, string operators, etc.

So I turned to Unity and C# to publish Twitchy Thrones on Android and PC. I'm finding Unity amazing, except for a few quirks. If I knew before what I know now I would have started the project in Unity to begin with.

Everything was going well, except... When the Objective-C/Cocos2D version was originally published to the App Store it occupied 17.3 MB on my iPhone. After most features were implemented in the Unity version I installed it on my iPhone expecting a similar file size. Nope. 156 MB! In these days where most games are free or freemium, a big file size can change someone's mind when it comes to downloading your game.

What follows is information I found scattered across the web to solve the problem of Unity's output file size, which I hope will be more useful gathered in one place.

As mentioned in Unity's own article about reducing file size (http://docs.unity3d.com/Manual/ReducingFilesize.html), the editor log provides a summary of the size of each of your assets after you perform a build of your project. This is what I got for mine:
[quote]
[font=arial]Textures 65.2 mb [/font][font=arial] 79.6% [/font]
[font=arial]Meshes 0.0 kb 0.0% [/font]
[font=arial]Animations 113.1 kb 0.1% [/font]
[font=arial]Sounds 10.2 mb 12.5% [/font]
[font=arial]Shaders 42.9 kb 0.1% [/font]
[font=arial]Other Assets 543.3 kb 0.6% [/font]
[font=arial]Levels 92.8 kb 0.1% [/font]
[font=arial]Scripts 439.5 kb 0.5% [/font]
[font=arial]Included DLLs 5.2 mb 6.4% [/font]
[font=arial]File headers 99.8 kb 0.1% [/font]
[font=arial]Complete size 81.9 mb 100.0% [/font]

[font=arial]Used Assets, sorted by uncompressed size: [/font]
[font=arial]6.1 mb 7.5% Assets/Sound/Songs/ThemeSong.mp3 [/font]
[font=arial]2.7 mb 3.3% Assets/Menus/WorldMap/WorldMapBirdFlockMiddle.png [/font]
[font=arial]2.7 mb 3.3% Assets/Menus/WorldMap/WorldMapBirdFlockBottom.png [/font]
[font=arial]2.7 mb 3.3% Assets/Menus/WorldMap/WorldMapBirdFlockTop.png [/font]
[font=arial]2.1 mb 2.5% Assets/Maps/Map16/HelpPanel6.png [/font]
[font=arial]2.0 mb 2.4% Assets/Fonts/Resources/Fonts.png [/font]
[font=arial]1.3 mb 1.5% Assets/Menus/Main/BannerFinalChallenge.png [/font]
[font=arial]1.3 mb 1.5% Assets/Menus/Main/BannerFinal.png [/font]
[font=arial]1.0 mb 1.3% Assets/Maps/Map16/Map16Background.png [/font]
[font=arial]1.0 mb 1.2% Assets/Menus/WorldMap/WorldMapClouds2.png [/font]
[font=arial]1.0 mb 1.2% Assets/Fonts/Resources/MenuFonts.png [/font]
[font=arial]946.8 kb 1.1% Assets/Menus/Settings/SettingsFinal.png [/font]
[font=arial]946.8 kb 1.1% Assets/Cutscenes/Cutscene2/Cutscene2Banner.png [/font]
[font=arial]946.8 kb 1.1% Assets/Cutscenes/Cutscene1/Cutscene1Banner2.png [/font]
[font=arial]946.8 kb 1.1% Assets/Cutscenes/Cutscene1/Cutscene1Banner1.png [/font]
[font=arial]946.8 kb 1.1% Assets/Cutscenes/Cutscene2/Cutscene2Cup.png [/font]
[font=arial]768.3 kb 0.9% Assets/Menus/WorldMap/WorldMapClouds3.png [/font]
[font=arial]768.3 kb 0.9% Assets/Menus/WorldMap/WorldMapClouds1.png [/font]
[font=arial]710.3 kb 0.8% Assets/Menus/WorldMap/WorldMapBackgroundLand3_2.png [/font]
[font=arial]710.3 kb 0.8% Assets/Menus/WorldMap/WorldMapBackgroundLand3_1.png [/font]
[font=arial]710.3 kb 0.8% Assets/Menus/WorldMap/WorldMapBackgroundLand3_0.png [/font][/quote]

[font=arial]Except for the theme song, all my biggest assets were textures. The problem is, while XCode uses the compressed .png images and even compresses them further with pngcrush (https://developer.apple.com/library/ios/qa/qa1795/_index.html), Unity uses the raw texture data, resulting in enormous file sizes. [/font][font=arial]In Twitchy Thrones' case, a 2D pixel art game, reducing the texture quality wasn't an option since any blurry texture stood out from the rest of the game.[/font]

[font=arial]The first solution I came across was bypassing Unity's content pipeline and loading the textures from the .png files in real time. If you change an asset's extension to .bytes, Unity treats it as binary data (http://docs.unity3d.com/Manual/class-TextAsset.html) and doesn't unpack it, thus the asset won't bloat your file size. Here's Unity's code sample from loading a texture from a .bytes file:[/font]//Load texture from diskTextAsset bindata= Resources.Load("Texture") as TextAsset;Texture2D tex = new Texture2D(1,1);tex.LoadImage(bindata.bytes);
A script component was added to each GameObject containing a SpriteRenderer using the offending giant texture and on the Awake() function the texture was loaded using code very similar to the above. A sprite was then created with the texture and this sprite was set to the GameObject's SpriteRenderer. Problem solved, I thought. But when I booted the game on iPhone, a screen that took less than 1 sec to load before now took more than 10 secs! The performance of Texture.LoadImage is simply terrible.

Luckily, someone with the same problem lead to the solution, the WWW api (http://answers.unity3d.com/questions/511268/texture2dloadimage-too-slow-for-use-ios.html). The game ran perfectly on Unity's editor, but when running on iOS I got an "unsupported URL" error.

Back to Google. Most threads referring the same error warned that the URL is case sensitive and spaces need to be replaced with "%20" as with any URL, but that was not the problem. My problem was, Unity packs the assets in its own format and doesn't keep the original file structure, so the file I was trying to load in the URL didn't exist in iOS. Fortunately Unity provides a way to keep the original assets in their original form in the final build, the "StreamingAssets" folder (http://docs.unity3d.com/ScriptReference/Application-streamingAssetsPath.html).

Note that unlike "Resources" folders, which can be placed anywhere in the hierarchy of the "Assets" folder, the "StreamingAssets" folder must be placed in the root of the "Assets" folder. After placing the textures in the new folder, with their extension changed to .bytes for the reason mentioned above, I changed my GameObjects and respective scripts.

Here's one of the final GameObjects (The Sprite should be set to "None" in the SpriteRenderer):



And a link to the SpriteTextureLoader script (Sorry for not putting it here but the formatting got messed up when I tried):

http://www.onceabird.com/tt/code.txt

A couple of notes:
The main downside of this method is that the sprites won't be visible in the Editor when the game's not running. But then again in most cases this method should only be implemented when the game is nearly done, as premature optimization is the root of all evil.
Although I haven't experimented, this method should work with other asset types, such as textures for models in a 3D game.
I chose to create a script component for each GameObject where needed, but obviously this code can be used to load all textures in a loading screen if needed.

I only changed the biggest textures so far, but right now Twitchy Thrones occupies 87 MB on my iPhone, which is 55% of the original size.

EDIT: Fixed linked SpriteTextureLoader script to work on Android.

Demosthenes

Demosthenes

 

Bennu submitted for playtest!

So last night my brother, who lives in the USA, submitted Bennu for playtest in the Community Games.

I changed the cover because the previous one didn't work that well when resized:


Some screenshots:






And the thumbnail:

Demosthenes

Demosthenes

 

I quit my job...

...To make games full-time.

Yes, this is going to be one of those posts.

My name is Ricardo Moura, Once a Bird is made of myself and my cousin. I do the programming and "art" and he does the music and sound effects.

I quit my job at the end of July but only left it mid-September. It had been making me sick for years and seemed to be going nowhere. The job consisted of programming various pieces of the back-end of a stock-broker / bank, It was well paid but I very rarely did any interesting stuff.

If you have been following this journal, you're probably wondering at this point how can this guy quit his job when all his games so far were commercial failures. If you didn't, now you know all the games we made so far were commercial failures.

The answer is, I've been working as a programmer for 12 years now and for about 5 years I've been doing games in my spare time. I consistently enjoyed making games more than programming "corporate" software. When you reach a certain point in life you realize that it's very easy to spend most of your waking hours working on stuff that you don't like (and doesn't really matter much to you) just so you can make a living (this realization probably comes earlier for most people).

Also, I realized I could survive some time with the money I saved.

So, games. Fold was our latest and best-selling game, it was released in June for iPhone and sold 1016 copies so far. If you want to take a look, the app store link: https://itunes.apple.com/pt/app/fold/id645248522

Although it didn't sell much, Fold had very positive reviews, including a glowing review by tuaw.com: http://www.tuaw.com/2013/07/13/daily-iphone-app-fold-is-the-most-original-ios-puzzler-in-years/...

In September I entered the Ludum Dare 48-hour compo alone and made Twitchy Thrones, a real-time strategy game parodying Game of Thrones. Here's a link to the post-mortem: http://www.ludumdare.com/compo/2013/09/12/twitchy-thrones-post-mortem/.

For our first full-time game, we decided to remake Twitchy Thrones for iPhone. Right now I'm doing pixel art for it:

A map:



A knight's death animation:



Thanks for reading, let us know what you think! Art critiques in particular would be very welcome. :)

Demosthenes

Demosthenes

 

Twitchy Thrones is out now!

Twitchy Thrones is out now for iPhone. It's free until November 5th: https://itunes.apple.com/us/app/twitchy-thrones/id898649182?l=pt&ls=1&mt=8

Here's the release trailer:



And some screenshots:






Demosthenes

Demosthenes

 

Try Bennu out...

The first release candidate of Bennu for PC is here. We're not sure it's finished, so if you want to try it out we're thankful for any bug found, suggestions or comments.

[size="7"][color="#FF0000"]Just don't say it's too hard.[/color]


[size="4"]Download link here.

Demosthenes

Demosthenes

 

Now with rope!

Implemented wall sliding and the ninja rope. ">Video here.

Wall sliding was implemented by detecting the angle of the wall to check if it is "vertical enough" for the ninja to slide in and then applying a force to the ninja, in the direction of the wall. Right now it still has some bugs when colliding with the edges where the blocks connect to each other.

The ninja rope uses a fixed linear spring from the Farseer Physics Engine. The ninja is set to a ragdoll state when attached to the rope.

Demosthenes

Demosthenes

 

Graveyard Shift

Like Matt Damon in the Jimmy Kimmel Show, Super Ninja Kung-Fu Puzzle is the project that keeps getting bumped for another. This time for the...





What's it about this time? Graveyard Shift is a thumbstick shooter / tower defense hybrid set in a zombie-infested graveyard. The player builds his base during the day and at night the zombies attack. The game has been in development for some months now.


The player kills the zombies with guns. Instead of towers the player lays down tiles on the ground . Zombies spawn out of the ground but never on a player tile, although they can walk over them.

Tiles cost money, which the player gets by killing zombies and grabbing the coins they drop. Tiles can also be upgraded to benefit the player or affect the zombies. In the video below the player is setting down tiles and upgrading them to slow down the zombies:

[media] [/media]

The game will also feature a co-op mode with up to 4 players. In the video below there are two players, one of which is reading the tombstones:

[media][/media]

Right now we have a basic prototype but there is much to be done: add all tile upgrades and guns, replace some of the art, add sound effects and music, etc.

Demosthenes

Demosthenes

 

So... Here it is!

Bennu for PC is here and it's free!




From the non-existing box blurb:

"Bennu is an innovative physics-based puzzler. The player controls a ball and chain and progresses through the levels by swinging from place to place, all the while destroying the blocks on each level by swinging into them. Bennu features both single and cooperative gameplay.

Bennu placed in the top 20 of the 2008 DreamBuildPlay contest."

[size="3"]Download it at Once A Bird's website.

Demosthenes

Demosthenes

 

The pixels of Twitchy Thrones

Twitchy Thrones is the first game where I'm trying my hand at pixel art. Fold took advantage of Retina iPhone's resolution of 1136x640 by making all the art vectorial and creating resources for both hi and low resolutions. In Twitchy Thrones the pixel resolution is always 568x320, cropped to 480x320 in devices prior to iPhone 5.

Twitchy Thrones is an ultra-fast strategy game where you control knights, sending them to conquer enemy territories or defend your own. This is the first knight pixel art (2x actual size):



And this is the first knight pixel art in the first map:



I couldn't see it at first, but the knights were too small and hard to tell from the background. Eventually I went back to [s]Photoshop[/s] the drawing board (2x size):



Some time after the second attempt I found myself thinking it could look better. It still looked too small and the contours were not very defined. So came the third and latest attempt (2x size):



And a screenshot of the game at the moment on an iPhone 4s:



The map's landmarks, such as the bridges and the trees were also modified to reflect the knight's size change. Contours were also made more visible with darker colors.

What did I learn from this? Perception changes over time (duh!). A seasoned artist would be able to point the flaws in the first attempt right away, but I could only do it weeks/months later. Obviously even the art I have right now is flawed but for now I reached the point where I don't know how to significantly improve it.

Demosthenes

Demosthenes

 

Haiku update

DreamBuildPlay contest deadline June 12.

Here's a video of when a player grabs a new item:
[media] [/media]


Here's a video of the game intro:
[media][/media]

Demosthenes

Demosthenes

 

One Man Armada...

So I submitted Attack of the 50ft Verbose Dinosaur to the DreamBuildPlay contest. There are some impressive entries (at least graphically) this year, so I'm not that confident, but hope dies last. :)

In the meantime, I started a new game, One Man Armada (OMA), with a different physics engine, Box2D.Xna. My first impression, when compared to the Farseer Physics Engine, is that Box2D.Xna is much, much faster (it is optimized for the Xbox 360), but has less features. Farseer is close to releasing a new version, but right now I'd recommend Farseer for a PC game (or an Xbox game where you really need the more advanced features) and Box2D.Xna for an Xbox game where performance is essential.

All my games start with a basic gameplay idea that evolves according to whatever I think is working best as I playtest the game. :) I guess it's mostly the same for everyone.

OMA's basic idea is what would happen 9 months after Geometry Wars got drunk and had a foursome with Peggle, Breakout and Freespace. It's a dual-thumbstick shooter (with ships, not abstract stuff) where you shoot balls, like in Breakout, that bounce off ships, causing more damage with each bounce. So you must try to hit as many ships as possible with each shot while avoiding enemy fire.

Right now I'm working on a basic prototype and getting to grips with the physics engine. If the game is fun I'll follow up with it; if not I'll think of some other game. I did a logo anyway:


Demosthenes

Demosthenes

 

Sigh...

http://indiegames.com/2012/02/uberzombie_usa_undead_tower_de.html

Demosthenes

Demosthenes

 

Another trailer....

...So DreamBuildPlay as ended and since the deadline was postponed two days I did an extended trailer:


Bennu Trailer 2

So far the contest has 250 entries in the gallery without the last-time entries, so it should reach 300!

EDIT - Click here for a higher resolution AVI.

Demosthenes

Demosthenes

 

Co-op!

Bennu, now with more Bennu. I still have a few bugs to iron out, but it looks like fun. ^^ Video here.

EDIT - The only reason the Bennus don't move at the same time is because I'm playing alone and switching controllers.

Demosthenes

Demosthenes

 

Bennu - First prototype

Welcome to the Bennu journal.

Right now I've finished the first prototype of the game, which has programmer art *shudders* and lacks many of the features I hope to implement.

Bennu is a puzzle game that can be described as puzzle-bobble meets spiderman meets some-cool-stuff-not-done-yet. Basically you control Bennu, an old bird that can't fly for long and so goes around each level using his tail to grab to whatever he can and swing himself around, smashing bricks with his head (the head and the bricks must have the same color), until there are no bricks left. Currently his color changes every five seconds but in the future the player will have to touch bonuses with the Bennu to change color.

Right now the blocks are generated randomly, but in the final game each level will have a hand-made layout. Click here to see a movie of the game.

The game is being developed using XNA and the Farseer 2D Physics Engine, which (so far) I highly recommend. :)

Demosthenes

Demosthenes

 

Fold

So Fold was released on the iOS app store:

https://itunes.apple.com/us/app/fold/id645248522?ls=1&mt=8

EDIT - Here's the release trailer:

Here's a screenshot:



So what is Fold anyway? Fold is a puzzle game where you have blocks that collapse into each other in a chain reaction. The goal is to finish each level with just one block of each color. Right now there are 3 worlds, each world introduces a new concept.

Fold was written in Objective-C. The game is free to play, but you only have access to half the levels on each world. A single in-app purchase unlocks all the levels in the current version and all future updates.

Here's another screenshot:


Demosthenes

Demosthenes

 

Attack of the 50ft Verbose Dinosaur!

It's been a while since the last post.

I've been very busy on our latest game, Attack of the 50ft Verbose Dinosaur (AOT5VD).



AOT5VD is, basically, Scrabble meets Rampage. You play as a dinosaur that throws letters at buildings. When the letters form a word you can explode the word, causing damage to the buildings. The bigger the letter the bigger the damage. I came up with the concept and did all the programming, my middle brother did almost all the art.



You can view a gameplay video here.

Once in a while a helicopter comes by with a word missing the first letter. If you complete the word you get a bonus. More on that later.

But why is the dinosaur doing this?

Any comments/suggestions appreciated (stuff you'd like to see on the game, things that seem wrong to you, etc).

Demosthenes

Demosthenes

 

Blood pools

In order to maximize the "satisfaction per kill ratio" I added blood pools. The pools are made out of a maximum of 3 blood textures that are placed close to each other, rotated randomly and expanded at different rates, giving the sensation of multiple leaking wounds.

Video here:

[media] [/media]

Demosthenes

Demosthenes

 

Frog continued...

After finishing the frog sprites, I used the Farseer Physics Engine to include the frog in the game.
In order to make the frog feel real each body part was added as a separate entity and revolute joints were employed to connect the body parts to each other in the positions shown below:



A revolute joint connects two bodies but doesn't constrain their relative angles, which means that after adding them the frog's legs and tongue rotated like the frog had every bone in his body broken. However Farseer also provides angle limit joints, that constrain the angle between two entities. These limits can be changed after the simulation has started.

Click here for a movie showing the leaping frog. Initially the upper and lower limits of the angle joints are set to zero, so the frog is completely rigid. Each time I press a key these limits are set to something close of a real frog and an upwards force is applied to the frog body, thus making it look like a leap. Another key sets the joint limits to the initial values. It's all Farseer's work, really.

Next step is controlling the frog's leap so he'll jump from platform to platform.

Demosthenes

Demosthenes

 

It's Bennu!

So Bennu finished in the top 20 in the DreamBuildPlayContest!.

I wasn't expecting this after the top 4 were announced yesterday, but Bennu was even played at the Xbox Live Community Games Launch Event... I didn't even get an e-mail about this.

Also, the competition wasn't just hobby game developers: the first-place winners were a government-sponsored team of four. The second-place team were two professional game developers. So, I'm pretty happy about the result all things considered.

Demosthenes

Demosthenes

Outsider

4 years later...

Get In the Ring has been thrown in the pile of projects on hold. We've been developing Outsider, an adventure game where every puzzle is different.

In the past year we've been selected by Eurogamer as one of the 8 best Portuguese games and as one of the 11 best in Playstation Talents, where we also placed in the top 4 best in the Press award and one of the 3 best in the Most Innovative game award.

Here's the most recent trailer: Development wise, I'm now working with an illustrator. We're using Unity with SVG Importer. Basically our workflow is that the illustrator does the graphics in... Illustrator, and the SVG Importer plugin allows us to use exported SVG files directly in the game. We've opted to use vectorial graphics to allow for unlimited zooms and seamless transitions. We're currently working on the final third of the game's story and we hope to have a release date soon.   Cheers, Ric

Demosthenes

Demosthenes

 

Crypt...

To get new weapons and tile upgrades the player will have to enter the cemetery crypts and have a conversation with ghosts. If he chooses the right answers, he gets those items. If he doesn't, the game gets harder on the next round (more zombies spawned, etc.)

This is all experimental and will be cut out if people think it doesn't fit it. Anyway, here's a video:

Demosthenes

Demosthenes

 

Site mock-up

I've been correcting little bugs on Bennu,changing little graphic details and integrating my brother's backgrounds in the game. I've also been working on the website, here's a mock-up:


Demosthenes

Demosthenes

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!