Archive for the ‘ Programming ’ Category

The past months I kept myself busy completing a new book on the subject of eBook formatting, as many of you may know. I am happy to announce that the book is finally available! For only $5.99 you can now benefit from the years of experience I have had as a professional eBook formatter, learning the ins and outs and the tricks of the trade I have applied to many hundreds of eBooks from New York Times bestselling writers and indie authors alike.

zencoverZen of eBook Formatting is in the same vein as my “Take Pride in your eBook Formatting” tutorial series, but it goes way beyond that, as it is vastly expanded and updated. Whether you are a PC or a Mac user, in the book I am taking readers through the entire workflow that I am using every day for the projects I am working on for my clients. In an easy to understand manner—I hope—I am not only listing the steps, but also explain why these steps are necessary and why I do things the way I do them. The result is a tutorial-style self-help book that is chock full of examples, tips, tricks and coding snippets.

Having formatted close to 1,000 eBooks at this time, I am covering the entire process, from the basic manuscript cleanup, to the basics of HTML and simple markup, all the way to advanced techniques that allow you to add an incredible amount of polish to your eBooks without necessarily sacrificing device compatibility.

Just to give you an impression of the breadth of subjects I am covering, here is the Table of Contents for you.

Table of Contents

  • Preface
  • Introduction
  • 1 – The Road to Right
    • Understanding eBook readers
    • Why you should not use a word processor
    • The road to Right
    • Tools of the trade
  • 2 – Data Structure
    • HTML
    • CSS
    • Prepping your style sheet
  • 3 – Cleaning Up the Manuscript
    • The Power of Em
    • Time to clean up your manuscript
    • Fixing up styles
  • 4 – From Word Processor to Programming Editor
    • Nice, clean and predictable in HTML
    • Paragraphs are the meat
    • Fleshing it out
    • Dealing with special characters…the right way
    • A word about fonts
  • 5 – General Techniques
    • Centering content
    • Images
    • Image resolution
    • Chapters
    • Typography and Layout
  • 6 – Advanced Techniques
    • Chapters
    • Initials
    • First-line capitalization
    • Formatting inserts and notes
    • Formatting emails and text messages
    • Image blocks with byline
    • Custom fonts
    • Linking to the outside world
    • Lists
    • Backgrounds and Color
  • 7 – eBook Generation
    • eBook formats
    • Meta-Data
    • The Cover
    • The TOC in the digital world
    • Calibre
    • More control with XPath
    • KindleGen
    • Error-checking
  • 8 – eBooks Outside the Box
    • A Word about Fixed-Layout Books
    • Preparing for Smashwords
  • Parting Thoughts
  • 9 – Appendices
    • Chart of named entities
    • Resources
  • About the Author
  • Also by Guido Henkel

The key to me, when putting together this book, has been to make it possible for anyone to create an eBook that has a professional level of presentation. Too many authors use shortcuts to create eBook version of their manuscripts, flooding the market with broken and sub-par product that leaves a bad taste in readers’ minds, when in fact, applying a little bit of discipline could elevate them from that riffraff and make their books like a million bucks.

Zen of eBook Formatting is targeted at all those of us, who care about their books, not only the words we wrote, but also that they are presented to the reader in a clean and professional manner that works on as many eReaders as possible. Hopefully, with Zen of eBook Formatting at hand, this goal will be within reach for many more authors.

Grab your copy of the book an Amazon now!


If you want to keep up with my eBook formatting work, don’t forget to subscribe to my Newsletter. That way I can keep you updated about the latest developments, updates to my books, code snippets, techniques and formatting tips.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

I know that I have been remiss on this, cialis and I apologize, but we opened the official website for my current game project “Deathfire: Ruins of Nethermore” a little while ago and have transferred all the Development Diary entries over there. Instead of updating both blogs constantly, I think I will stop posting these updates here and will do them on the official site instead.

In case you missed the past update, we released a series of screenshots recently, showing some of the interiors of one of the game’s dungeons. You can find the post here, complete with a bit more background information.

Today, I have also posted a new Development Diary update, talking briefly about a number of new members who have joined the “Deathfire” team recently. Make sure to stop by and check it out, because the post also sports two new screenshots showing off some of the improvements we have been working on in the past weeks, to increase the visual impact and atmosphere of our scenery in Unity.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Before I get into the next Development Diary entry for Deathfire, I wanted to point you all to a new interview with me on The Nerd Cave. It is an interesting – I think – look at the different aspects of my career, not only the games most people are familiar with. But now back to our regularly scheduled programming… more Deathfire stuff. 🙂

It is a common occurrence in game development that you have to make design decisions based on incomplete information. Why? Well, because at the time you design many aspects of a game, the game itself does not really exist yet. You are merely projecting what you want it to be. Therefore you have to make a great many decisions based on whatever information you have at the time, and what you expect the gameplay to be like in the final product. It is probably hard to imagine for many people, but game design is a very iterative process. Especially as the complexity of the game and underlying systems grow, the requirements will most likely change as well. Somewhere down the line, play testing may show flaws and weaknesses that will have to be addressed, or entire parts of the system show themselves to be flawed, tedious or outright un-fun. No one has ever designed the perfect role playing game in a single attempt, ever. You make decision, rethink them, revise them, reiterate them, adapt them and then repeat the entire process until one day you ship a product.

While working on Deathfire, the other day we stumbled into such a scenario, which I think illustrates this very nicely in an easy to understand manner. The item in question were the character status boxes.

UI sketch These small user interface elements serve to give the player a quick overview over the characters in his party, their health, their mana, their condition, etc. They also allow the player to access more information and to make various character-specific selections, such as attacks and spells, among other things.

I made a list of components I felt needed to be part of this character box, mocked it up very quickly in Photoshop, and forwarded it to Marian so that he could think of a proper graphical representation for them. Instantly the question for him became, “Should we do it this way, or maybe make tall slim boxes, or rather wider ones?”

He worked out some ideas and showed them to the rest of the team. You can see the initial designs below. As you can see, they follow the same kind of general design pattern, but each version is created with a specific focus in mind. One focuses on the portrait, while another one favors the attack and spell slots, and so forth.

Once we saw these, it became clear that with our original premise, these boxes would use up a significant amount of screen real estate. Deathfire will have a party that consists of four heroes. In addition to that, the player can recruit two additional NPCs at any given time, resulting in six character boxes on the screen. With all the information displayed, this a not insignificant amount of screen real estate to deal with and the last thing you want is for these boxes to cover up vital areas of gameplay.

Different versions of the character status box
First versions of the character status box that we evaluated

While these were great first attempts, they felt a bit too design heavy and not what you would really need in the actual game. In addition, the important elements seemed to be drowned out a bit by the bulky borders and decorative elements. In a word, we felt we weren’t quite there yet. We decided that we needed to optimize this somehow and for that we needed to envision more clearly how the player is going to play the game. While we have the game engine up and running with our 3D environments and some basic core functionality, we have yet to reach the point in our prototype where it is possible to really get a feel for the way the game will play in the end. Therefore, we had to extrapolate and sort of play the game in our minds, and as we did so, a few things became obvious.

Another version of the character status box
An iteration of the character status box, but we felt it ran too wide.
Note, however, the lines are all much slimmer than before.
This is not final art and the portrait is merely a mock-up

There was a lot of stuff in those original character boxes that we didn’t really need. At least not all the time. So we thought that maybe we could create boxes the display the minimum of information and when the player moves the mouse over them, each respective box will expand to its full size, allowing access to the full set of features. The next step was for us to decide what that minimum of information actually is that we need to relay to the player at all times.

Small status boxDo you really need the character’s name, for example, all the time? One could argue that the portrait is enough, particularly if we allow players to customize them the way we have in mind, but since we are creating a game in which interaction with NPCs and among the party members themselves will be very frequent, we felt that it is, in fact, very important that the player always has an indication as to who is who, when they are being referenced by name.

But what about those attack and spell slots? Because we have a turn-based combat system in Deathfire, it is not essential for us to give the player instant access to his weapons and spells. In real time combat, yes, the player needs access to his weapons, which represent the attacks, within a fraction of a second, but in real-time combat, the combatants take turns, which means there is proper time for the player to make his selections without rushing things. If we automatically expand the box for the character whose turn it is, this should turn out to be pretty slick and efficient, actually, also serving as a visual guide as to whose turn it is.

The expanded character status box
The expanded character status box with weapons equipped.
Note: This is not final art and the portrait is merely a mock-up

Usually the on-hand weapon slots also serve the purpose to Use items in role playing games, such as potions or tools. However, we reckoned that while that is true, it is not an all too common occurrence, particularly not one that is typically time critical, so the brief delay that expanding the full box would incur during a mouse-over should be acceptable. There is also still enough meat for the player to grab the box and drag it to a different place so that the order of the party can be easily arranged in the game, while mouse-over texts will relay additional information, such as the actual points of health, etc.

In my original layout specs, we also had a small toggle that allows the player to switch between a panel displaying the equipped weapons and one displaying the hero’s quick-spells. (Quick spells are memorized spells that can be fired at a moment’s notice without further preparation. They are complemented by non-memorized spells that require significantly more time to cast.). Upon playing the game in our minds, we realized that this toggle, too, is really needed very infrequently. For the most part spell casters would want to have their quick spells accessible while melee and ranged fighters would want their weapons accessible. The player would then occasionally switch these panels, but for the most part we expect them to remain fairly static settings.

Therefore we decided the toggle does not need to be available at all times and could be safely removed from the mini box. Incidentally, as Marian was working out his designs, it turned out that we do not need the toggle at all, because we can fit the weapon slots and the quick spell slots all on the enlarged pop-under box.

UI sketchWith all that in mind, we decided that we really just wanted to display the portrait, and the health and mana bars at all times, along with the hero’s name and a small digit that represents the character’s level. Character states, such as poison, paralyzation, etc can be easily color-coded into the portrait, or displayed as mini-icons alongside, and damage markers can be painted right over the portrait. All in all a pretty neat affair, I would say. For now… because who knows? Once will begin actually playing the game in earnest, we may find that our assumptions were wrong and that have to re-design the boxes once more, but such is the life of a game developer. It is the nature of the beast. Game development is an evolution, even after doing it for the umpteenth time.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

For the past few days I’ve been working on some exciting things in Deathfire, find that have propelled the game forward quite a bit in my mind. Items. Sounds trivial, health I know, online but items are the salt and pepper of any role-playing game.

It started when I decided to make a weapons list for the game. We have been working on parts of the user interface for the past two weeks or so, and it got to the point that I wanted to see some weapon icons in the respective slots. In order for Marian to begin drawing some icons, we began making a weapons list. It started out quite innocuously, but once I got into it, the list grew very rapidly, and at the end of the day we had a list of over 150 weapons for the game. And that is just the first go at it, not including any quest items and not including any unique, named weapons, which we plan to feature prominently in the game.

Adding all those will easily double the number of weapons in Deathfire, and I have no doubt that on top of that I probably forgot a good number of cool weapons that we will want to include in the game as we go along. All things said, in the end, I would estimate that we will have somewhere between 300 and 400 weapons. Just to give you a comparison, Shadows over Riva, the third of the Realms of Arkania games had less that 100 weapons. In fact, looking over the game’s source code showed me that the entire game contained a mere 480 items. So, in essence, it looks as if we will have nearly as many weapons as Shadows over Riva had items. Nice!


Here are few examples of the weapons from Deathfire
(Temporary artwork)

But a weapons list like this is useless, of course, if the items don’t actually make it into the game. I mean, anyone with a spread sheet can make a list easy enough. Especially, when Marian sent me a number of weapon icons a few days later, I really wanted to see these items in the game. It is quite interesting to note at this point that even in this day and age, there are no really qualified tools in the market for game design. (I am aware of articy:draft, of course, but since it is a Windows-only application, and horribly overpriced at that, it is of no use to me – or many other game developers for that matter, aside from the fact that it uses a very specific approach to game design from what I’ve seen, that seems to shoehorn you into specific patterns.)

The reality of game design is, that it really is a jungle out there and that to this day, most designers still use a lot of tools that are not really meant for the job, such as regular word processors or spread sheets. These inadequate tools typically create their own set of problems, especially because the data have to be somehow transferred from these document or spread sheet formats into data the game can actually use. It is a process that is tedious and error prone and often results in a lot of extra work, not to mention that designing item lists with item properties inside a spread sheet is anything but a satisfying process in and of itself. So I set out to write an Item Editor to make our lives easier.

Among the endless list of cool things about Unity3D, the middleware engine we’re using for the game, is that you can fully program it, including the development environment itself. So I began writing our Item Database Manager as an Editor Extension which works right inside the Unity environment. Not having to switch to external tools is an incredible boon that can not be overstated.

I wrote an item class, specializations for it to handle things such as weapons, armors, keys, consumables, etc and then began to write the editor that would allow us to enter the items in an internal database where the game can directly access them. Here’s a little screenshot for you to see what it looks like.

As you may notice there’s a bunch of drop-down menus that allow us to make key selections and depending on these selections the editor window will actually change, as weapons have a different set of parameters than armor, for example.

Just by means of comparison, take a look at what one of the external editors looked like that we used for the Realms of Arkania games. Bit of a different world, isn’t it?

When you take a look look at this Deathfire Item Editor I wrote for Unity, the window also gives you a good idea for the level of complexity we are building into his game, I think. This is a first go at the weapons, of course, but already you can see that there is tremendous flexibility built in to customize these weapons in many ways.

Nonetheless, I am certain that I’ve forgotten certain fields that we will need to add to the items as development progresses and requirement change or grow. Magic items, for example have not yet been properly tackled in the editor, as I will need to provide a hook to the magic spells/abilities the item may have. However, one of the truly great side effects of having this item editor and database right inside Unity is that it can grow with the game. Unlike static data formats imported from external tools, where you always have to be very aware of changes and additions to the data fields, here we are working with much more organic data that will adjust easily – and mostly automatically – to new requirements as we work on it. The amount time that procedure saves is invaluable while it also minimizes effort and hopefully errors – though that is always a double-edged sword. In development terms, convenient does not always equate safe.

To round out this post, I thought I’d give you a quick glimpse what the player might see in the actual game in the end, when calling up the stats for the weapon. This image is entirely temporary art, of course, but I think it illustrates the point nicely.


Temporary art for illustrative purposes only. Not an actual game item

Items may not be the most glamorous of things to talk or read about, but as you will agree, they are an integral part of any role-playing game, and how many of you have ever thought about the actual process of getting these items into a game? Well, now you know…

I hope you found this peek behind the scenes interesting. Feel free to let me know what topics you are most interested in and what subjects you’d like me to cover most in future blog posts.

Please make sure to also read this follow-up article with more details on the bound and attuned items in the game.


Catch Me If You Can book coverAt this point I would like to congratulate Kevin N. as the winner of the last give-away. Kevin won himself a copy of “Sons of Anarchy,” which he should find in his mailbox soon. But do not despair, you can be a winner, too. I have prepared another give-away for everyone out there, willing to help us spread the word about Deathfire. This time around you can win a copy of the ”Catch Me If You Can: The Film and the Filmmakers” Pictorial Moviebook. This full-color book includes not only the entire script of the Steven Spielberg movie starring Tom Hanks and Leonardo DiCaprio, but also various photographs and behind the scenes tidbits about the making of the movie, as well as an introduction by Frank W. Abagnale, whose unique life story the film is based on. You’re interested? Well, just make sure you collect entries for the give-away below, and don’t forget, you can obtain more entries every day for the duration of the give-away, simply by tweeting about Deathfire.

a Rafflecopter giveaway

Facebooktwittergoogle_plusredditpinterestlinkedinmail

As I promised, I want to talk a little more about the technology behind Deathfire today. I mentioned on numerous occasions that we are using Unity3D to build the game, but of course that is only a small part of the equation. In the end, the look and feel of the game comes down to the decisions that are being made along the way, and how an engine like Unity is being put to use.

There was a time not too long ago when using Unity would have raised eyebrows, but we’re fortunately past that stage in the industry and—with the exception of some hardliners perhaps—most everyone will agree these days that it is indeed possible to produce high end games with it.

For those of you unfamiliar with Unity3D, let just say that it is a software package that contains the core technologies required to make a game that is up to par with today’s end user expectations. Everything from input, rendering, physics, audio, data storage, networking and multi-platform support are part of this package, therefore making it possible for people like us to focus on making the game instead of developing all these technologies from scratch. Because Unity is a jack of all trades it may not be as good in certain areas as a specialized engine, but at the same time, it does not force us into templates the way such specialized engines do.

In addition, the combination of Unity’s extensibility and the community behind it, is simply unparalleled. Let me give you an example.

The character generation part of a role-playing game is by its very nature a user interface-heavy affair. While Unity has solid support for the most common user interface (UI) tasks, that particular area is still probably one of its weakest features. When I started working on Deathfire, I used Unity’s native UI implementation, but very quickly I hit the limits of its capabilities, as it did not support different blend modes for UI sprites and buttons, or the creation of a texture atlas, among other things. I needed something different. My friend Ralph Barbagallo pointed me towards NGUI, a plugin for Unity that is specialized in the creation and handling of complex user interfaces. And his recommendation turned out to be pure gold, because ever since installing NGUI and working with it, it has become an incredibly powerful tool in my scripting arsenal for Deathfire, allowing me to create complex and dynamic interactive elements throughout the game, without having to spend days or weeks laying the groundwork for them.

While you can’t see it in this static screenshot, our character generation is filled with little bits and animation, ranging from the buttons flying into the screen in the beginning, to their respective locations. When you however over the buttons, tooltips appear and the buttons themselves are slight enlarged, highlighted by a cool corona effect and when you select them, the button icon itself is inverted and highlighted, while a flaming fireball circles the button. While none of these things is revolutionary by itself, of course, it was NGUI’s rich feature set that allowed us to put it all together without major problems, saving us a lot of time, as we were able to rely on the tested NGUI framework to do the majority of the heavy lifting for us.

Interestingly, it turned out that some of NGUI’s features far exceed immediate UI applications and I find myself falling back onto NGUI functions throughout the game, in places where I had least expected it. It now serves me as a rich collection of all-purpose helper scripts.

When we began working on Deathfire’s character generation, one key question we had to answer for ourselves was whether we should make that part of the game 2D or 3D? With a user interface I instantly gravitate towards a 2D approach. For the most part they are only panels and buttons with text on them, right? Well, Marian asked me if we could, perhaps, use 3D elements instead. After a series of tests and comparisons we ultimately decided to go with a 3D approach for the character generation, as it would allow us to give the image more depth, especially as shadows travel across the uneven surface of the background, and offer us possibilities with lighting that a 2D approach would not give us. Once again, I was surprised by NGUI’s versatility, as it turned out that it works every bit as impressive with 3D objects as it did with the preliminary 2D bitmap sprites I had used for mock ups, without the need to rewrite even a single line of code.

Another advantage that this 3D approach offers is the opportunity for special effects. While we haven’t fleshed out all of these effects in full detail yet, the ability to use custom shaders on any of these interface elements gives us the chance to create great-looking visual effects. These will hopefully help give the game a high-end look, as things such as blooming, blurs, particles and other effects come into play.

These effects, as well as many other things, including finely tuned animations, can now be created in a 3D application, such as Maya and 3ds Max, so that the workload for it can be leveraged across team members. It no longer falls upon the programmer to make the magic happen, the way it is inevitable in a 2D application. Instead, the artist can prepare and tweak these elements, which are then imported straight into Unity for use. It may not seem like a lot of work for a programmer to take a series of sprites and draw them in the screen in certain sequences, it still accumulates very quickly. In a small team environment like ours, distribution of work can make quite a difference, especially when you work with artists who are technically inclined and can do a lot of the setup work and tweaking in Unity themselves. We felt this first hand when Marian and André began tweaking the UI after I had implemented all the code, while I was working on a something entirely different.

This kind of collaboration requires some additional help, though, to make sure changes do not interfere with each other. To help us in that department a GIT revision control system was put in place, and it is supplemented by SceneSync, another cool Unity plugin I discovered. SceneSync allows people to work on the same scene while the software keeps track of who made which changes, so that they can be easily consolidated back into a single build.

Together, these tools make it safe for us work as a team, even though we are half a world apart. Keep in mind that Marian and André are located in Germany, while Lieu and I are working out of California. That’s some 8000 miles separating us.

While it may seem intimidating an prone to problems at first, this kind of spatial separation actually has a bunch of cool side benefits, too. Because we are in different time zones, nine hours apart, usually the last thing I do at night is putting a new build of the game in our GIT repository so that Marian and André can take a look at it. At that point in time, their work day is just beginning. They can mess with it to their hearts’ desire almost all day long, without getting in my way. When necessary, I also send out an email outlining problems and issues that may require their attention just before I call it a day. The good thing is that because of the significant time difference, they usually have the problems ironed out or objects reworked by the time I get back to work, so that the entire process feels nicely streamlined. So far we’ve never had a case where I felt like I had to wait for stuff, and it makes for incredibly smooth sailing.

But enough with the geek talk. I’ll sign off now and let you enjoy the info and images so that hopefully you get a better sense of where we’re headed. Next time we’ll take another dive into the actual game to see what’s happening there.


On a slightly different note, I wanted to congratulate Tobias A. at this point. He is the winner of the “Silent Hill” Blu-Ray/DVD give-away I ran with my last Deathfire update. But don’t despair. I have another give-away for you right here… right now.
Sons of Anrachy coverJust as last time, help us promote Deathfire and you will have the chance to win. This time, I am giving away a copy of Sons of Anarchy: Season One on Blu-Ray Disc. In order to be eligible for the drawing, simply answer the question below. But you can increase your odds manifold by liking my Facebook page, the Deathfire Facebook page, or by simply following me on Twitter. It is that easy. In addition, tweeting about the project will give you additional entries, allowing you to add one additional entry every day. Good luck, and thank you for spreading the word!

a Rafflecopter giveaway

Facebooktwittergoogle_plusredditpinterestlinkedinmail

The other day I was putting some polish to Deathfire‘s character generation and we wanted to fade character portraits from one to another when the player makes his selections. Unlike hard cuts, cross fades simply add a bit of elegance to the program that we did not want to miss.

I went through Unity’s documentation and very quickly came across its Material.Lerp function. Just what I needed, I thought, but after a quick implementation it turned out it didn’t do what I had had in mind. I had not read the function description properly, because what it does, is blend between the parameters of two materials and not the actual image the material creates. Since I am working with a texture atlas, this gave me a cool scrolling effect as my material lerped from one end of the atlas to the other but not the kind of cross fade I had had in mind.

It turns out that Unity doesn’t really have the functionality, so I dug a bit deeper and found Ellen’s approach to blending textures. A quick check of her sources showed me that it still did not do what I wanted, but it gave me a good basis to start from as I began writing my own implement of a simple cross fader.

It all starts with the shader itself, which takes two textures without a normal map and renders them on top of another. A variable tells the shader how transparent the top texture should be so we can adjust it on the fly and gradually blend from the first texture to the second. The key feature for my approach was that the shader uses UV coordinates for each of the textures to allow me to use the shader with a texture atlas.

Shader "CrossFade"
{
  Properties
  {
    _Blend ( "Blend", Range ( 0, 1 ) ) = 0.5
    _Color ( "Main Color", Color ) = ( 1, 1, 1, 1 )
    _MainTex ( "Texture 1", 2D ) = "white" {}
    _Texture2 ( "Texture 2", 2D ) = ""
  }

  SubShader
  {
    Tags { "RenderType"="Opaque" }
    LOD 300
    Pass
    {
      SetTexture[_MainTex]
      SetTexture[_Texture2]
      {
        ConstantColor ( 0, 0, 0, [_Blend] )
        Combine texture Lerp( constant ) previous
      }    
    }
  
    CGPROGRAM
    #pragma surface surf Lambert
    
    sampler2D _MainTex;
    sampler2D _Texture2;
    fixed4 _Color;
    float _Blend;
    
    struct Input
    {
      float2 uv_MainTex;
      float2 uv_Texture2;
    };
    
    void surf ( Input IN, inout SurfaceOutput o )
    {
      fixed4 t1  = tex2D( _MainTex, IN.uv_MainTex ) * _Color;
      fixed4 t2  = tex2D ( _Texture2, IN.uv_Texture2 ) * _Color;
      o.Albedo  = lerp( t1, t2, _Blend );
    }
    ENDCG
  }
  FallBack "Diffuse"
}

The second part of the implementation is the C# script that will drive the actual cross fade. It is pretty straight-forward and consists of an initialization function Start(), an Update() function that is called periodically and adjusts the blend factor for the second texture until the fade is complete. And then, of course, there is a function CrossFadeTo() that you call to set up the respective cross fade.

using UnityEngine;
using System.Collections;

public class CrossFade : MonoBehaviour
{
  private Texture    newTexture;
  private Vector2    newOffset;
  private Vector2    newTiling;
  
  public  float    BlendSpeed = 3.0f;
  
  private bool    trigger = false;
  private float    fader = 0f;
  
  void Start ()
  {
    renderer.material.SetFloat( "_Blend", 0f );
  }
  
  void Update ()
  {
    if ( true == trigger )
    {
      fader += Time.deltaTime * BlendSpeed;
      
      renderer.material.SetFloat( "_Blend", fader );
      
      if ( fader >= 1.0f )
      {
        trigger = false;
        fader = 0f;
        
        renderer.material.SetTexture ("_MainTex", newTexture );
        renderer.material.SetTextureOffset ( "_MainTex", newOffset );
        renderer.material.SetTextureScale ( "_MainTex", newTiling );
        renderer.material.SetFloat( "_Blend", 0f );
      }
    }
  }
  
  public void CrossFadeTo( Texture curTexture, Vector2 offset, Vector2 tiling )
  {
    newOffset = offset;
    newTiling = tiling;
    newTexture = curTexture;
    renderer.material.SetTexture( "_Texture2", curTexture );
    renderer.material.SetTextureOffset ( "_Texture2", newOffset );
    renderer.material.SetTextureScale ( "_Texture2", newTiling );
    trigger = true;
  }
}

The script also contains a public variable called BlendSpeed, which is used to determine how quickly the fade will occur. Smaller numbers will result in slower fades, while larger numbers create more rapid cross fades.

In order to use these scripts, all you have to do is add the shader and the script to your Unity project. Attach the C# script to the object you want to perform the cross fade and then from your application simply call CrossFadeTo() with proper texture parameters to make it happen. That is all there really is to it.


  CrossFade bt = gameObject.GetComponent();
  bt.CrossFadeTo( myTexture, myUVOffset, myScale );

I hope some of you may find this little script useful.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Usually when starting a new role-playing game, tadalafil one of the first things you begin to work on is the underlying game system. Deathfire was no different. After a few programming tests to prove general feasibility of certain key features, salve the first thing we turned to was the game’s character generation. Because the player’s stats, search attributes and traits are at the heart of any role-playing game, it was only natural to begin zoning in on that aspect of the game and lay down some underpinning ground rules from which to build the overall game system.

And with that we were off to the races. It was decision time. How should character creation work? Should the player roll attributes which then decide which kind of character he can play, or should the player be able to pick archetypes himself and we fit the attributes around that?

Forcing the player to re-roll a character in its entirety over and over again just didn’t feel user friendly enough any longer

The first approach is the one we used for the Realms of Arkania games and upon replaying Shadows over Riva, I felt that forcing the player to re-roll a character in its entirety over and over again in order to make it fit the necessary class requirements just didn’t feel user friendly enough any longer. Therefore, I opted for a different approach that seemed a little more accessible to me. After all, the key to this entire project is “fun.” We don’t want to typecast the game in any way. We’re not making a hardcore game or an old-school game, or a mainstream RPG or whatever other monikers are floating around. We want to make a role-playing game with depth that is fun to play. It is really as simple as that. Anything that smells of tedium will go out the door, which includes things such as click-fest combats. But that’s a subject for some other time.

So, when getting into the character generation, the first thing the player will do is pick a race he wants to play.

Naturally, we allow players to decide whether they want to create male or female heroes to add to their party. Therefore we have male and female counterparts for all six races, the Humans, Wood Elves, Dwarves, Halflings, Snow Elves and Tarks.

Most of them are pretty self-explanatory, except for Tarks, perhaps, which we created as another kind of half-breed class. Think of them as half-orcs. Not quite as ugly and single-minded – meaning stupid – as orcs, Tarks are incredibly strong humanoids with tremendous instincts and roots in nature. At the same time, however, they are not the most social, charismatic or intelligent of sort. But if brute strength and endurance is what you need, a Tark may just be the answer.

The next step in the creation of a hero is the selection of a class. Players can pick from eight available classes in Deathfire.

It is here that you can decide which role your hero should play in the overall scheme of things. Again, most of the classes are pretty standard fare to make sure anyone with a bit of role-playing experience will quickly be able to pick their favorite.

Both, the race and the class, affect a character’s attributes and they will be internally adjusted as you make your selections.

Once this step is completed, you will finally get to see the character’s core stats. At the base, each character has a Strength, Dexterity, Constitution, Intelligence, Wisdom and Charisma attribute. These are the very core and will be used to calculate a number of additional attributes, such as the attack and defense values, among others. They will also affect the damage the character can do, the amount of magic points he has, and the armor rating. Also included here are the Weapon Skills, controlling how well the character can handle and use various types of weapons.

With 34 character traits, there is plenty of room to create dynamic gameplay

To create a role-playing experience that has real depth and gives the player breadth in shaping their in-game characters over time, the core attributes are not nearly enough, however. Therefore we added a number of traits to Deathfire. Thirty-four of them, to be exact, at the time of this writing, packed together into various groups to easier keep track of them.

The first group contains Resistances, controlling how well the character can withstand various types of damage. The Body Skills determine how well the character can handle himself physically and is therefore home to things such as Balance and Speed among others. The list continues with groups such as Nature Skills, Craftsmanship, and Mental Skills, as you can see from the screenshot below, each with a number of attributes that determine the character’s innate abilities.

And then there are the Negative Attributes. Everyone of us has lost his cool before, so why should our game characters be any different? In my opinion, negative attributes bring zest to the game. They give heroes personality and, from a design standpoint, open up an endless array of opportunities for great character interaction and mishaps.

What we are looking at here runs the gamut from ordinary Temper tantrums, to a person’s Fear of Height, or Arachnophobia. But it also includes values such as Greed, Superstition and Pessimism. As you can undoubtedly tell, there is a lot to allow us to color characters and create interesting gameplay moments. I’ve been doing these kinds of things since 1987, so of course, I am fully aware of the fact that all of these attributes will only be of any value if they are actually used within the game. We already have an ever-growing list of situations, moments, quests, events and encounters that will help us put these attributes into play, and there will be many more as we actually move along to flesh out the various areas of the game. You might even be interested to hear that we cut a number of traits for that very reason. We realized that within the confines of the game we are making, the traits would have no real value or would be severely underused.

I am sure you will agree that we have a lot to work with here, and our intentions are to make use of the attributes to the best of our ability.

Another large area that defines characters are the Magic Abilities, but I will leave a discourse on that subject for a future post. In my next update I will take you a little behind the scenes of the actual character generation section of the game and talk a little about the technology we are using.


Sitlen Hill coverIn addition, we would very much like you to help us spread the word, tell others about Deathfire to help make this game a success. Therefore, we are hosting a give-away, offering up a Blu-Ray/DVD copy of the video game based movie Silent Hill: Revelation. In order to be eligible for the drawing, simply answer the question below. But you can increase your odds manifold by liking my Facebook page, the Deathfire Facebook page, or following me on Twitter. Also, tweeting about the project will give you additional entries, allowing you to add one additional entry every day. Good luck, and thank you for spreading the word!

a Rafflecopter giveaway

Facebooktwittergoogle_plusredditpinterestlinkedinmail

I am certain it has not escaped your notice over the past few months that I’ve been working on some game-related things lately. I am sure my posts and tweets about Unity were a dead give-away.

Well, I have decided that it may be time for me to share with you some of the things I’m doing, because with every new day that I am working on my current project, I get more excited about it. As you may have guessed, I am working on a new role-playing game. I have to point out, however, that it has nothing to do with Thorvalla, the project I tried to Kickstart a few months ago. Thorvalla is dead and off the table. There was not nearly enough interest and support for the concept to make it happen, so that continuing on would have been a fruitless endeavor. Instead, I decided to learn from the experience as a whole and move forward.

Deathfire logo

The new game I am working on is called Deathfire… for now. It is kind of a project title currently, but the longer we’ve been using it, the more it grew on us and there is actually a chance we may use it for the final game. We’ll have to wait and see. There’s going to be a lot of water going under there until we cross that bridge.

There are currently three people working on Deathfire. Marian Arnold is the lead artist on the project. Marian used to work for my old company Attic, just after we released Shadows over Riva, and he has a pretty long gaming history himself, working on games, such as the Divine Divinity series. What’s even more important, however, is that he is a complete role-playing buff and immediately jumped at the occasion when I approached him with this idea. Being such an avid role player, he often serves as a sounding board for me, too, while I design the game and bounce ideas off him. Oftentimes he comes back to me with comments, such as “We could do this and then do that on top of it, making it work even better.” So, all in all, I feel that Marian is a great complement for myself, forcing me to think, re-think and try harder all the time. The many code rewrites I had to do to try out and/or accommodate some of our cumulative ideas are certainly testament to that.

Then, there is Thu-Lieu Pham, who is also lending her artistic abilities to the project. Lieu is a classically trained illustrator and graphic designer, and her strengths lie squarely in the domain that oftentimes makes fantasy games so mesmerizing — the tantalizing look of characters and scenes. Many of you may recall the paintings she did for Thorvalla, such as the iconic dragon ship at sea scene that we used as the game’s main visual hook, as well as the female Viking character.

Currently, Lieu is busy drawing character portraits for Deathfire’s Character Generation. Instead of creating them in 3D, we decided early on to try and capture the look of Golden Era role-playing games. The covers by Larry Elmore, Clyde Caldwell, Brom, and Jeff Easley come to mind, right away. Call me old-school, but to me this kind of vivid imagery and paintbrush work is much more inspirational and engaging than a rendered 3D character.

And then, there is me. I am currently serving double-duty, designing and programming Deathfire. It is marvelously invigorating, I can tell you that, and it reminds me of the good old days when Hans-Jürgen Brändle, Jochen Hamma and I were making games such as Drachen von Laas, Spirit of Adventure or Blade of Destiny, the first of the Realms of Arkania games, which were, to a large degree, just the three of us working triple-duties, designing, programming and often also illustrating these games. Working with such a small team on Deathfire appeals to me very much and I am enjoying myself, perhaps just a little too much.

I’ve decided from the outset that I will be using Unity3D for the game. As you can tell from previous posts and some of my tweets, I have become a big Unity fan, as it puts all the right development tools at my disposal at a price point and level of quality that is unbeatable. The package has not let me down once so far – though I would like to say that 3D object import could be improved quite a bit.

Deathfire is using a first-person 3D role-playing environment, and I am glad that we can rely on the muscle of Unity to make sure that we do not have to limit ourselves because the technology can’t keep up. Unity may not be a bleeding edge engine, but it can sure play ball with the best of them, and the fact that it is so incredibly well thought-through, makes developing with Unity a lot of fun. More importantly, we can focus on creating the game, instead of the technology to run it on.

I know, you may have a lot of questions now, about the game. What, when, where, how… I’ll get to all that some time later down the line. For now, however, I simply want you to let the info sink in, and hopefully you’ll be as excited as we are. Visit this blog regularly. I plan on sharing more of Deathfire with you as time goes on. In fact, after some deliberation, I’ve decided that I will cover the development process like a production diary of sorts, right here on my blog. And also, don’t forget to follow me on Twitter (@GuidoHenkel) for a constant vibe-meter as to what I am up to.

Talk to you again soon…

Facebooktwittergoogle_plusredditpinterestlinkedinmail

In recent weeks I have spent a bit of time with Unity3D, physician the middleware package that gets a lot of acclaim — and deservedly so, I must say. Those of you who have followed me for some time, or know me, are aware that I am always very outspoken about issues I see in the things I do or work with. Whether it’s been my criticism of Qualcomm’s operations during the BREW era, whether it’s been Hollywood studios’ approach to DVD and Blu-Ray, or things such as the Kindle. When I see problems, I address them and offer up constructive criticism, because oftentimes I do have workable solutions to offer. The fact that on various occasions my comments have lead to actual change, shows me that my attempts not to be unreasonable have been successful. I usually just point out things where I have the distinct feeling that someone simply didn’t think things through.

The truly curious thing about my working with Unity3D so far is that I have not a single complaint. This is by far the most complete, reliable and comprehensive middleware package I have ever seen and I have yet to find an area where the package is weak or has true shortcomings. Sure, it is inevitable that the package won’t do exactly what I want all the time, but that is the nature of the beast. On the whole, however, you can tell that Unity3D has been put together who understand the subject matter, knew what they were doing and what developers need. There don’t seem to be a whole lot of useless because-we-can features and all the areas I have touched upon so far in my tests have all been thoroughly thought out with interfaces that are precise and complete. As a software developer one really can’t ask for more. And to think that the basic version of Unity3D is actually free… it truly boggles the mind.

When I started playing around with Unity3D one of the first things I had to decide was whether I wanted to program in JavaScript or C#. I’ve been working with JavaScript over the years, porting countless J2ME games to BREW, but somehow it never really clicked with me. I had never worked in C#, though I had heard some good things about it. Looking over it briefly it seemed very similar to C++, the language I’ve been using most for the past 20 years or so. It was that similarity that made me decided to use C# in the end.

Ironic, I know. Me, using a programming language developed by Microsoft… ah well, the world is full of surprises. But in all honesty, so far C# has been pretty good to work with. There are few things that I do not particularly like, instances like the lack of static array initialization, where the language has taken a few steps backwards as opposed to forward, but on the whole, it’s been cool and fun to work in C#. The main problem I have with it – and that’s really just a minor gripe – is that I think it is too user friendly. The language makes it possible to implement certain things in a very quick and easy manner, making it seem super-cool, but if you look under the hood, you realize that a tremendous code overhead has to be generated to make that functionality possible. Therefore a single two-line code snippet may result in brutal code bloat and a serious performance sink without the programmer ever suspecting it at first.

This is not C# problem, though. It is a trend that most modern programming languages have been following – including Java and JavaSCript – and while it seems great at first, to me as a down-to-the-wire programmer who used to count CPU cycles for a living in assembly coding, it is really the wrong way to approach programming. Most of today’s software is clearly evidence of that. Just look at the resource hogs that simple applications like word processors have become. It is not because they have so many more really cool features, but because their implementation is just totally shoddy.

But I digress…

So, I’ve been doing some work in Unity using C#. I’ve never been big on 3D programming. It’s never been something I was particularly interested in, but imagine my surprise when it took my no more than a few minutes to actually script a simple 3D application in Unity. A few hours later I was able to actually have a scene with some user control. This is hard core. There was virtually no learning curve to that point and what really took me the longest was looking up the C# syntax for what I wanted to do, because as it turned out, in the details, C# is quite a bit different than C++.

There is a learning curve, of course. No middleware could be without. It is the nature of the beast, but the fact hat it took me virtually no time to jump in and do things in Unity showed me that this was very well thought-through, because the API made sense from the get-go, and Unity’s naming convention is clear and to the point. No guesswork involved.

As I expanded my tests and began to do a little more specific programming, I had to spend some more time reading the documentation, but it was always a very clear process and I never had the sense of being overwhelmed – despite the fact that Unity3D has such a wealth of functionality that it could make your head explode.

Over the past week or so I ran into a small problem. I was doing some GUI programming and had planned to do some fancy visual effects with texture blending, only to ind out that Unity’s GUI class is somewhat limited — a lot actually. Some of the functionality I was looking for is simply not there. I tried to dig deeper but everywhere I looked the tenor was that Unity couldn’t do it, so I decided to look at NGUI, one of the third-party packages that is available. But just as I was playing around with it, a work-around for my problem came to my mind. so I switched back to my original project and tried it out, and indeed, I had found a working fix to draw GUI elements, using different shaders. This was a relief because I would not have to rewrite what I had done so far and could simply continue down the path I was going.

Even though this immediate problem has been solved, I now run into the problem that I would like to render a 3D object in front of the GUI, and Unity does not immediately allow me to do that. So, it’s time to figure out another work-around for this.

As you can see, there are still a few things I need to figure out and get to work, but I am hopeful. Perhaps, I will decide to use NGUI, after all, when everything is said and done, if only because it might allow me to get certain tasks done in an easier fashion. I haven’t decided yet, and that is what makes Unity so great and so much fun to play around with.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Today, patient I am actually opting for a change in pace. While I’ve been blogging about my books, advice my writing and the technology of eBooks for some time now, more recently I have turned my attention towards other matters once again. Nothing like a little change of pace to keep life interesting. 🙂

A few years ago I wrote an iPhone application called Power Tuner. This was during the early days when the iPhone was first released. As a guitarist, there were many occasions where I wished I had a tuner handy. Whether it’s at the guitar store where the ambient noise can be so much that it is hard to tune by ear, even using natural harmonics, or just at a friends place where a long-forgotten guitar makes a sudden re-appearance, a tuner is something that every guitar player should have in their pocket, just like a plectrum belongs in any guitarist’s wallet.

Being an electronic gadget, having a guitar tuners handy at all occasions was just not feasible up to that point, and as a result there were way too many jam sessions the world over, with flat tunings, perhaps permanently damaging listeners’ attitude towards you. I am just kidding, of course, but truth be told, I realized at that time that the iPhone would make a phenomenal guitar tuner that could be handy any time you’d need it. My idea was to replace a $100 musician’s tool with a $5 app.

Shortly after, I launched Power Tuner and it has been a slow but steady seller ever since. Over the years I had various plans for the tuner, and I tried to brand it with certain artists, but sadly that never materialized despite weeks and weeks of follow-ups and countless phone calls to artist managers. A few weeks ago I had a different idea, which was almost as good as the idea of branding the tuner, and I went to work to fully update the app.


The result is Power Tuner HD, a high definition version of the app that is enhanced for retina-display iPhones and the iPad. That was more of a side-feature, however. The real meat of the update was the inclusion of skins, the way I had intended for the branded version. Instead of using artists, however, I decided to use guitar paint jobs instead.

Brilliant, isn’t it?

Which guitar player hasn’t fallen in love the the gorgeous cherry sunburst of Ace Frehley’s Les Paul? Who hasn’t secretly admired the genius behind Eddie Van Halen’s wildly striped Frankenstein guitar? Fans of the Fender Stratocaster definitely get a kick of the deep sunburst paint job that has become so iconic in the hands of players such as Ritchie Blackmore, Robin Trower, or Yngwie Malmsteen. The array is endless and as guitar players, we all have a passion for great paint jobs.


Therefore, I have prepared and included a set of the paint jobs that I found most iconic into Power Tuner HD, allowing guitarists to not only get in tune, but to do so in style.

As you can see from the screen shots in this post, I have recreated all of the aforementioned guitar looks as selectable skins, along with other ones. Check out the George Lynch-inspired Kamikaze skin, or the skin imitating John Petrucci’s Picasso guitars he played during the 80s. A beautiful Tobacco Sunburst is also included, reminiscent of Gibson’s Les Paul guitars. Apart from the original Power Tuner Tuna Skin, I have also included a brushed aluminum skin that resembles a 19” rack unit.

I have plans for a number of other skins that I may release, depending on how popular Power Tuner HD turns out to be. I would love to create a skin that resembles Rory Gallagher’s paint-stripped Stratocaster look, and one that looks like Zakk Wylde’s Bullseye Les Paul. Most of all, however, I would love to add some Steve Vai-inspired skins. And who knows, I might also be looking into iconic skins suggested by Power Tuner users.

Even though Power Tuner HD is now geared towards guitar and bass players, I think it is important to point out that the software is much more versatile than that. With a wide frequency range, the tuner is really suitable for all sorts of instruments, including violins, violas and celli, as well as brass instruments and others. It can even measure the pitch of your voice. If you are a singer, Power Tuner can actually help you to practice holding your pitch, as well as practicing you to gain perfect pitch for your vocals.

And all of that for less than $5. So, without me going on blabbing about how cool Power Tuner HD is, head over to the AppStore and get yourself a copy!

Facebooktwittergoogle_plusredditpinterestlinkedinmail