One thing which i have been meaning to incorporate into ScummC for quite a while now is better palette manipulation tools.
It seems that sometime after the turn of the century, the art of making an image editor with good palette manipulation seems to have been lost. This is very unfortunate, as it makes it VERY hard to make graphics for scummc.
So i improved scummc in two ways…
The palcat tool is now more useful
Have tons of non-indexed graphics? Well now you can tell palcat to combine and quantise all the colours in your images, so you have a single common palette.
palcat -o out -col 32 costume1_*.bmp costume2_*.bmp
Quite commonly in scumm games, you’ll notice the room palettes will follow the same general schema:
OFFS
SIZE
DESC
0
16
System Colors
16
X
Room Colors
16+X
Y
Costume Colors
To reproduce with palcat, simply do:
palcat -o out sys.bmp room.bmp costumes.bmp
(where costumes.bmp contains your combined costume palette(s))
The costume compiler helps you
In scumm, costumes have a palette which indexes into the current room palette. Before you had to specify this manually, like so:
palette([0-32]);
Now you can pass in your combined room palette instead, like so:
palette("out_blank_room.bmp");
Which will match up colors in out_blank_room.bmp with your costume bitmap.
If you have costumes which will be re-used across rooms, i suggest you make a blank room bitmap so it won’t accidentally match colors in your room when you don’t want it to.
palcat -o out sys.bmp blank_room.bmp actors.bmp
I’ve incorporated the costume palette trick in the examples on my scummc fork. Feel free to check it out on github!
Now that Teambox has a real API, i thought i’d make something simple to demonstrate its use. What i came up with was this..
A statistics generator!
For those who have used IRC in the past, you may recall the multitude of scripts available that analyse your logs and generate interesting,
albeit pointless statistics about them.
Borrowing from the general format of these generators, i wrote a simple ruby script which analyses recent activities in a teambox project. It will tell you such things as:
Hours with the most activities in the project
The most active user
Who wrote the Longest and shortest lines, as well as the most words
The most popular words in the project
Most referenced users
Most referenced URL’s
Most popular conversation
Person who created the most tasks / conversations
Really, everything you never wanted to know about your project!
It will also resolve conversation and task names, if you were ever wondering how to properly do that.
To use it run the script, supplying your username, password, and the project you want to examine. e.g.:
ruby teamboxstats.rb -u fred -p password teambox
Will login and dump the teambox project if you have access to it.
With the recent remakes of certain Lucasarts adventure games, i thought to myself “i wonder how the scummc compiler project is getting on?”
To my shock however, it seems the scummc website suddenly died sometime last year, so nobody was able to check out and learn from the only functioning third party SCUMM compiler.
Thankfully i was able to obtain a fairly recent copy of the files in the SVN repository, and coupled with the SVN commit logs on the mailing list i have been able to re-create the repository using GIT as far back as revision 359.
So what are you waiting for? Check it out on github!
That is the conclusion after spending most of my time on my last project writing a framework, in order to make the project “easier” to write.
The trouble is every minute you divert to the framework, half of your project dies. And since there is an inherent division between project and framework, by the time you have everything working you have lost your original train of thought.
Then you realize: the project is way behind schedule; there goes a cool feature that could gave landed you a multitude of sales. Or even worse, everyone has lost interest.
Instead, I suggest the following mode of thought:
Find an existing framework that does most of what you require.
If the framework falls short, rethink your approach.
If you find your code has become a mess, re-factor it into a small library.
Don’t be tempted to spend time writing a monolith of a framework. And beware the trap of thinking you can turn it into a product in itself; after all, there is a reason why a large proportion of frameworks are free.
It’s been a while since my last rails post, so i decided to try out something different.
Specifically, i’ve always wanted to track my time, but i never seem to find a solution that works. The solution is either too simple and doesn’t give me any feedback, or it’s extremely complicated and hard to use.
So i set about to make a time tracking solution that was both ridiculously simple to use, and could give me some useful reports back. Thus, Twackr was born!
I modelled the entry system after Twitter: at its simplest, all you need to do is type in what you are doing, and Twackr will start tracking your time instantly. When you are done, simply click on “Finish” and it will be done!
Already spent some time doing something but couldn’t get to Twackr? Then you can backdate entries by adding “-1H“. Still working on something? Then try “-1H+“. Blocking out some time? Then use “+1H“. Want to see if you’ll make the deadline? try typing “1H“.
Time can also be categorised into “Services” (#service) and “Projects” (@project).
A few days ago i popped across Anthony Calzadillas “Pure CSS3 AT-AT Walker“, which is a great application of using CSS3 Transforms and Animations to create a scene of an AT-AT Walker walking along in a simulated iPad.
Anthony explains in great detail how he built the AT-AT, but i couldn’t help but think “I’ve got a better way of doing this!”.
Last year i made a CSS Transform Exporter for Blender, which can take any scene and generate a corresponding version in a nice and simple HTML page.
So it can take this:
And turn it into this:
Admittedly simple, but it does show off the potential power in adopting CSS3 and HTML5. After all, who needs to use Flash when you can make everything work in actual web browser instead?
As any mobile app developer knows, there comes a time when you need to release your creations out to the general public. On the iPhone, one has the App Store. On Android, the Android Market. On Nokia devices, the Ovi Store.
Whenever i hear someone talk about the Ovi Store, they never have anything goodto sayabout it. Having not experienced the store myself, i remained skeptical.
Recently the Ovi Store on the Nokia N900 opened, so naturally i decided to check it out and see if it really was as bad as people suggested. What follows are my experiences, illustrated with accompanying screenshots.
To Start
First i tap on the “Ovi Store” icon on my device. After a short while, a web browser opens in fullscreen mode. So far, not bad.
Not sure what i want to do, i tap around the tabs (each loading a new page). Now i realise: i just saw something interesting on the last page, and want to see it again. But how do i go back? Well first i need to exit fullscreen mode. Next, i need to tap the back button. Then from the history list which appears:
I must then select the previous slide. *THEN* if i am really unlucky, i get to see the page load again.
Now i decide i want to download a game, so i tap on the “Games” tab. The “Games” page loads, showing:
So now i think “I’ll try and download Angry Birds.” Herein lies a puzzling problem. Nothing happens. A few more taps, and the browser zooms in. Finally after a bit more tapping, i manage to get it to recognise i selected the app. The “Angry Birds” page loads.
Ok, so “Download”. But first i need to sign up for an Ovi Account!
After filling out all the forms, i get a “Thanks for signing up” page. By this time, i’ve all but forgotten what app i was going to purchase.
What would come in handy here would be… i don’t know, some sort of “Click here to continue your purchase” button perhaps? Instead, i have to use… the back button.
Finally, i tap the download button again. This time it loads the “Application Manager”, which after a while asks me if i want to continue installing “Angry Birds.”
At last, the app is installed. Eager to run it, i looked in my applications list, but couldn’t find it. Until i looked closer…
Yes, Angry Birds is represented by… a blue box.
Thankfully though, the app ran fine.
All in all, i found the experience of downloading my free app to be unnecessarily frustrating. I can’t help but feel that nobody was really thinking when they designed the Ovi Store. From the constant page reloading, to the confusing appearance of the app on the device itself. I’d dread to think what would happen if i tried to buy an app.
I can safely say that currently the criticisms i have heard of the Ovi Store are well founded.
Following on from Creating CSS Animations, i have decided to release the exporter script used to create the animated orange test guy.
As the title implies, the exporter script runs in Blender. Simply construct a 2D scene using planes, add in an animation track, run the script and click Export. It’s as simple as that!
Each plane is exported as a HTML DIV. If present, any Ipos will be exported as CSS keyframes.
The exporter even supports parenting, so you can build up complex hierarchies of elements which can easily be transformed in an animation, or even javascript.
Note that currently the exporter only supports Webkit-based browsers (i.e. Chrome, Safari, MobileSafari). It also has limited support for Firefox (sans animations).
Recently i incorporated support for creating thumbnails in glgif, the backend gif animation library used in Anim8gif.
Rather than taking the easy route out and attempting to load the gif using UIImage, i decided to take advantage of glgif’s decode routines to create an accurate representation of the current state of the gif playback.
Put simply, i took the palette texture which is generated for display, and decoded it into a new UIImage.
The actual process is triggered by assigning a delegate (thumbDelegate), which will be invoked when the next frame in the gif is decoded. The delegate is then cleared.
Simple, right?
More Technical Details
The format of a palette texture in GLES is as follows:
Palette (16 or 256 entries)
Indexed Pixels (4bit or 8bit)
The palette can either be 16 or 256 entries long, depending on the format you use. Likewise the pixel data will either use 4 bits or 8 bits. To keep things simple, glgif uses an 8bit palette with 3 8bit entries for the color (GL_PALETTE8_RGB8_OES).
(Note that an 8bit palette can be insufficient as a gif can actually display more than 256 colours across multiple frames, but this is a necessary trade-off for speed)
So in order to decode it:
Read and decode the palette
Decode each pixel as an index into the palette
Using the decoded pixel data, create a new CoreGraphics bitmap context (using CGBitmapContextCreate)
Convert the bitmap context into a UIImage (using CGBitmapContextCreateImage and [UIImage imageWithCGImage:])
The resultant UIImage can then easily be used as a base to generate a sized down thumbnail of the gif, as illustrated below.
As always, the code for glgif is hosted on github, so feel free to check it out!
Moving on from Creating CSS Animations, i thought “How can i make this exporter more useful?”.
The answer is of course to completely remove Webkit from the equation, which leaves us with CoreAnimation. The end result being that the animation can be directly compiled into an iPhone or Mac OS X application.
Not going into much detail, CoreAnimation is essentially the library used by Webkit to display and animate any elements which have been transformed by a CSS Transform.
The actual scene is simply constructed using transformed CALayers. As for the animation, a CAKeyframeAnimation is created and attached to each CALayer. In the case of multiple properties being animated at the same time, a CAAnimationGroup is used to group these animations together.
The end result is a handy animation class which creates both the scene and the related animation tracks. i.e.: