Dynamic Color Correction, manage your color curves in Unity

When working on a game, sometimes you confront a problem for which there is no easy solution, and you need to do some research and work to build your own one. Because sharing is loving, I thought it would be nice make those solution into Store Assets. Although publishing takes patience and quite some work, I found the experience very rewarding.

Today, I want to share one of those asset that I have published in the store: Dynamic Color Correction.

As you can tell from previous post, I like quite a lot adding camera effects to my scenes. They often bring the deep and professional look that is not easily achieved with just the geometry and normal lighting.

Unity’s Standard Assets comes with a useful effect for that, called Color Correction Curves. It’s quite complete and for the most part, it does the job. But I found that the effect does not allow you to dynamically change its configuration. So, if you set some color curves for your scenes, you cannot switch to other ones, unless you perform some serious hacking of the asset.

Say that you want to switch your curves from orange-ish color in the day to a bluish color in the night, like in this example (you can watch a video of this example here):

El pase de diapositivas requiere JavaScript.


Or that you need to swich from a gray color palete to a saturated one, like this nice user explains in a comment in the store page:

All I wanted to do was simply transition from a black & white world into a world full of color via scripting. I figured standard Unity would let me do this easily. I was wrong. This FREE asset lets me do just that in a VERY straightforward way. Thank you for sharing this, Corta Studios!

Asset Store Comment

Enter our asset: Dynamic Color Correction. The asset manages Unity 5 Color Correction Curves image effect, adding more features. It’s let you define two different set of curves, visually, using the editor. Then you can interpolate between those two curves dynamically using the editor, and on runtime from your own scripts or GUI controls.
Please visit the Store page to download the asset. You can find further instructions on how to use it and more examples there. You can also play with a demo scene here, where you have a scene with two curve sets predefined (A and B) and switch from one to another with an UI.

The asset has a five stars average rate and have downloaded quite well for the past year. And, it’s free! Check it out!

Low poly art style exploration: Excavator

Excavator GIF

During the last few months I’ve been taking some time to learn about low poly modelling and other stuff that can help make things look more interesting in a game, like camera effects and tuning the lighting system in Unity 5.

I’ve made a couple of videos showcasing some experiments, I’ve learned some lessons, and even developed a script to manage color correction dynamically – which I uploaded to the Unity Asset Store.

I figured out that I could summarize my work in a few posts and share the results with the community. I’ve been posting most of those results in Facebook, but the blog gives me the opportunity to explain this work further.

Case of study: Excavator

I’m going to start this series of posts with a simple model of an excavator. I made it with 3DS Max using a technique (rather than a technique I would say “a way of doing things”) called box modelling. Basically, you start with simple 3d objects, and adding edges and extruding operations you can achieve complex models. Also, I like to use Boolean operations. You need to be organized and have a good special thinking, but other than that, the idea is easy to follow.

If you need some resourses, I found the tutorials at the web site Digital Tutors very useful to learn the basic techniques for box modelling with 3DS Max:

The background and the base terrain are simple shapes with some geometry filters that give that wrinkled effect to the mesh. I’ll get back to it in future posts.

Camera Filters

Camera filters are free to use in Unity 5 free Edition, and this is really good news for indie developers. Camera filters can change dramatically how a game looks, and it is worth to take the time to learn to use them and the artistic and technical theory behind them. Bellow you can see an image of the model with the lighting set up in unity before and after applying Color Correction Curves (different for the foreground and background), Screen Space Ambient Oclusion and Obscurance.

Excavator no filter

The first filter alters the mood of the scene, make it feels more live and cinematic. The the last two give more deep to the model and terrain, countering the excessive simplicity of the models while keeping a clean and elegant look.

Excavator with filters

Youtube author PigArt illustrate the importance of the filters in less than three minutes in this video: 3 nodes that can change your render (in Blender). I strongly recommend his channel for anyone interested in getting into low poly modelling.

I will talk more about filters in a future post.

Designing Turing Adventure Part Four: AIML: The technology behind Turing Adventure

This is Part Four of an ongoing series of post describing the design of Turing Adventure. You can try the game here.

Futurama, how a robot works

Technically, Turing Adventure is possible using chatbot technologies. In contrast to other complex artificial intelligence models, chatbots are based on some very simple principles that were first formulated during the ‘60s, and experienced a resurgence the end of the 90’s – beginning of the century.

They are based on pattern matching: for a certain input, the chatbot is programmed to return some predefined output. This is what is called a rule. Patter matching were the underlying mechanism of the conversational adventures that precedes the graphic adventures, where you had to type some input that matches a pattern to advance in the story. Usually the pattern to match is defined with regular expressions, so through the use of wildcards (i.e.: a symbol that matches any word), a given output could serve as a reply for several inputs. In this way, you do not need then to type exactly what the programmer wanted, nor has the programmer to predefine an endless list of possible input for each option.

Reductionism

However, with chatbots you can do something that it was impossible with conversational adventures: chat naturally. With the latter, you had limited vocabulary and grammar options, which led conversations to be similar to typing commands. This later evolved nicely to a command based graphic interface (starting the graphic adventure genre), like Lucas Arts games using scumm.

Mistery house and maniac mansion examples

Command based conversational interfaces (left: Mistery House) eventualy evolved to command based graphic interfaces (right: Maniac Mansión)

The natural chat capabilities of chatbots are achieved with a technique called reductionism. This technique consist in matching the user input, but instead of returning an answer to the user, feed it again to the system, modified. This new input should have an equivalent semantic, but it can contains less social etiquette, some orthographic corrections, or more simple grammar. In other words, the transformed input should mean the same, but be shorter, or, reduced. We are transforming a potentially complex input in a simpler-to-match one. This process is repeated until we reach the simplest sentence possible but with the same meaning of the original input given by the user.

If we have a corpus of rules that manage reductionism in the abstract, reducing inputs before treating them, we need to write answers only for those simpler ones. If the user inputs a line that is complex, or that the developer didn’t think about, it would be simplified to a line for which the developer has written an answer.

With a large enough and properly defined corpus of reduction rules, chatbots can provide answers to questions that the programmer of the chatbot had never considered.

It is impossible for the developer think in advance of anything that the user can write. It is then through reductionism how the user is able to speak naturally with the chatbot with good results.

An example

Let’s say that we are adding knowledge to our chat about what is Star Wars. When we ask it What is Star Wars?, the robot may reply: Star wars is a classical Hero’s Journey movie that stands out because of the robots that appear on it.

We can write a rule that represent this dialog line. But what about others ways of asking about Star Wars? For example, if the user says: Excuse me, can you please tell me what do you know about Star Wars? We shouldn’t need to take care of that, nor of any other way to ask about Star Wars. Reductionism should simplify the user input to what is star wars?

What follows is a series of reductions that could simplify the user input in this example (* will work here as a wildcard, matching one or more words):

Original user input: Excuse me, can you please tell me what do you know about Star Wars?

Matched pattern: Excuse me *

Starting a sentence, excuse me only has a phatic and/or courtesy function. We can discard it and feedback the rest of the sentence.

Feedback input: can you please tell me what do you know about Star Wars?

Matched pattern: Can you please *

Again, please is a particle that add no relevant semantic to this sentence. We can chop it and feedback.

Feedback input: can you tell me what do you know about Star Wars?

Matched pattern: can you tell me *

In a sentence with this structure, can you don’t really add any semantic: all of the relevant semantic is carried by tell me. So again, it can be chopped.

Feedback input: tell me what do you know about Star Wars?

Matched pattern: tell me what *

Tell me can really carry some semantic, but in this case, we can discard that, because of the what that follows, which indicates that a question is starting there. We can discard, then tell me. Again, we would not discard tell me in other inputs where it is not followed by an interrogative pronoun and some more words afterwards.

Feedback input: what do you know about Star Wars?

Matched pattern: what do you know about *

All the words in this pattern has meaning, so we cannot really discard some to simplify the question. However, there is a simpler way, with fewer words, to make the same question. So we change the sentence altogether and feed it back to the system:

Feedback input: What is Star Wars?

At this point, the rule we wrote before would match, and the chatbot would reply to the user with the programmed answer.

This can seem rather complicated, but again, we have to consider that the reduction rules has been written beforehand. We only added one rule, and the corpus of reduction rules has sequentially simplify the input to the most basic one we considered. It would work the same way about questing about other topics. It would even work with bits of information that the user teach the chatbots (some of them are able to learn new knowledge from the user – e.g.: Mitsuku).

You can try asking Alice several questions about star wars or other topics here: http://alice.pandorabots.com/

You can also try with Mitsuku. Try to teach her something, and then ask her about it in different ways: http://www.mitsuku.com/

Other techniques

Chatbots can manage default information like its name, its hobbies and so on, and use them in the conversation. That is very helpful to show off the bot personality. But they can also keep track on the context of the conversation. They can remember information that the user provides, like her name, gender and other, and they can use it in later in the conversation. This gives the user a strong feeling of being understood.

They can also answer differently to a given input depending on the topic of the conversation. If, for example, we ask the chatbot, Do you like it?, the chatbot can decide whether it may refers to, for example, ice cream, flowers, or anything else, based on previous interactions, and give a personalized answer for the first two, and a generic answer for the rest of topics.

They can also provide different answers to the same input depending on a previous answer provided by the chatbot. A nice example of that is how to react to a yes/no user input after the chatbot has make her a question.

AIML and Alice

The majority of those techniques, reductionism, context awareness and others, were proposed by doctor Richard S. Wallace from 1995 to the earlier 2000’s, when he proposed the AIML (Artificial Intelligence Mark-up Language) specification. AIML is a XML dialect aimed to the definition of chatbots (although the recursion of the reductionism can allow some backtracking programming, and can be used as a deductive engine like with Prolog). The creation of AIML and dr. Wallace’s work eventually led to the creation of the Alice Foundation, devoted to the promotion and adoption of AIML and open source based chatbots. The Alice Foundation is also responsible for the maintenance of Alice, an open source set of AIML files, with more than 90.000 rules, that conform an open source chatbot (and give its name to the Alice Foundation). Many of those 90.000 rules are designed to manage reductionism in normal English conversation. Thus, to write a new chatbot, Alice conforms a complete set of rules to start from. A new chatbot can be written starting from Alice: discarding many rules that give Alice its personality; adapting or rewriting others (like greets or conversation openings), to reflect the new chatbot personality, and then; writing new rules –that will be triggered by the user directly or through reductionism- that would make the new chatbot different to others.

When writing a chatbot

There are many technical considerations to make when writing an AIML file. Reductionism must be implemented properly to avoid infinite loops. Rules should be well though to make the best use of reductionism; and the new rules should be flexible enough to be modified in the future without many dramas. Many programming patterns and best practices apply here to write AIML rules that comply with those requirements.

However, we cannot forget that when we write a chatbot, we are kind of impersonating a character. That means that before of the technical considerations, we must design the character and write dialog lines, just as we would do when writing a video game or movie plot. The technical work should come after the art work.

In addition, the efficiency of chatbot writing is highly unpredictable; as much as humans beings are. We are dealing with people here, and not people dealing with a given computer interface, but people talking, and of any topic they choose to. Experience is a plus, but it will be impossible to anticipate all reactions, topics and way to express themselves that users will input in the chatbot. That is why testing is paramount. After you write your chatbot, you have to carefully read all the conversations that people have with it. Take notes whenever the chatbot says something that it character counterpart would not say, and fix it. You will never achieve a successful chat with 100% of the conversations, but you can aim for a 95% success rate to declare your chatbot capable and well written.

Pay when (and if) you want. Looking for a more honest monetization model

Ore vagon

Looking for a new monetization model

Photon Rush is our first game. It is not a large game, but its mechanic, designed to push the player out of it comfort zone, is quite tuned and is very fun. At least this is what we honestly think. We released the game on mobile and desktop platforms.

The game has been free since the beginning. We didn’t want to put ads in the game, since that would impact the experience in a negative way, and we didn’t want to spoil it. Photon Rush wouldn’t have given us much revenue through ads, anyway.

But, after the first year of the game, we decided to use Photon Rush as a test bed to try to figure out a revenue model more honest and cleaner than ads.

The gamer store option

We first retired the desktop version of the game from the web in order to try to put it in a game store. Very few people downloaded it from our web, so even a paid game on a store would have more players than a free game on our web. Being in a well know store also would increase the possibility of appearing in a bundle, and that would definitely push forward the number of players –not to say the revenues- so we decided that it was worth the try.

We were approved to appear at Desura. But then Desura apparently bankrupted, halting the process.

At that point, we had put the game with a price for the Windows Store, because it was incongruent to have to pay for the win32 version of the game and not for the Windows Store version on Windows 8, because they are basically the same. Since Photon Rush is a universal Windows 8 app, we put a price for the Windows Phone version too.

It was painful to see how, as a consequence of making the game not free, downloads halted in Windows platforms. We wanted some revenues from Photon Rush, but, above all, we wanted people to play Photon Rush!

A magical plot twist in the form of a promotion

The reason why we did not come back to the free model was that, during the process of price setting, we were contacted by myAppFree, an Italian company that each day promotes one paid app for free on Windows 8 and Windows Phone 8. MyAppFree is very popular among Windows Store and Windows Phone users.

We agreed with myAppFree to have Photon Rush featured on June 16th. It was great, in just one day, we had the same amount of downloads on the Windows platform than during all the app lifecycle in all platforms (Linux, Windows, Mac, Android, iOS, Windos Store and Windows Phone).

We were just lucky that myAppFree decided to promote our game. Photon Rush was promoted in the Windows Phone Store before, but those promotions were far less successful. After the promotion, we came back to the problem of making revenues out of Photon Rush without hurting the game or losing players. The desktop version issue was still unresolved, but we considered it dishonest to myAppFree to go back to the free model. However, the consequences of sticking with the paid model were clear: virtually zero downloads. We then decided to go something like coffee ware.

Photon Rush screen shot

Pay when (and if) you want

In this modality, the game has a price, but you can enjoy the whole game for free. From time to time, the game ask you nicely and in no intrusive way to buy the game. It states clearly that the game will stay largely the same, and that you are paying as a way of saying thanks to the devs for the game. You even receive an achievement for that!

This model has several advantages:

  • It allows playing and enjoying the game to people who has no payment options (generally people without access to a credit card, which is common in some countries, and to kids worldwide).
  • There are people who, under no circumstances, would pay for a game in a mobile device. Well, they are not going to pay, anyway, but at least they can enjoy the game, and maybe show it to other people.
  • There is no possibility whatsoever that a player feels disappointed with her purchase. She knows what she is buying.
  • As we stated before, we wouldn’t make so much money with ads with this game. But I can’t help the feeling that ads is not a nice way to earn money with ads. You are giving something nice to users (the game), while at the same time you annoy them with the ads. You are selling your user attention to ads resellers. That does not feels like a conversation between the game designer and the players.
  • Free to play model make the experience weird. Collecting and building is fun, but the cost balance in free to play games –if you don’t pay- is just not optimized for fun. Photon Rush is an aspirational game, so there is no place for that weirdness.

But, foremost, it give a feeling of purity to every penny you earn. I personally feel that the money we earned so far with Photon Rush as first money that I have really earned in my life. It’s like the player saying: Hey, here you go, grab my hard earned money. I prefer your game to that! Thanks!

Moreover, this is not just a normal goods exchange, because they already have the full game. Your players pay because they think they own it to you, or want to say thanks, or just want more of your job. And this is a very warming though.

The concept is very similar to donations, and its philosophy is very similar to that of Kickstarter or Patreon. This improves the feeling of a win-win situation, so the player will grow a bond feeling with the studio.

Technical details

The Windows Store and the Windows Phone Store have the option of downloading an app as trial. In the Windows Store, you can set up a time trial after which the app stops working (managed by the OS), or leave it timeless so the developer would implement a trial experience. In the Windows Phone store, you have only the last option. We have implemented a trial experience using the Unity 3D provided API facade, so when the user wants to buy the game, she will be redirected to the Windows Store, where she can buy the app.

Android and iOS do not have this trial experience, so we have implemented our model using an in app purchase. The process is quite more cumbersome, since there is more things to keep in mind. To simplify things, we have used an open source plugin called Soomla.

The in app purchase has one advantage over the trial approach: With the latter, every Photon Rush player who has downloaded the game before we changed the model owns the game, so they will never see the option to buy it. On the contrary, with the in app purchase approach, the whole user base will see the options once the app is updated to the new version.

Wrapping up

There are people buying the game (thanks many, people!). Not many, but they are. I am not sure yet whether this model will draw more money than ads, and how much, but I feel much more comfortable with it. I am going to use the same revenue model for the next small game I will produce.

Photon Rush logo. Download link.

Click here to download Photon Rush!

Next Steps with Turing Adventure

Caixa Bank Tower under construction in Seville

After taking some time to calmly think about this, I believe that this game concept has the potential to become a full featured game. I’m still a one man team backed by a group of friends, but I believe that I can put together a short but well-done adventure game within some months, and push it to a curated store like Steam. I am already writing that game, studying technologies that will make my job easier, and planning its execution. This will be my main job for the next months.

Read more at the Game Jolt game page news update.

Turing Adventure: Press coverage / Recortes de prensa

Prensa

You can download and vote for Turing Adventure here!

English

Definitely ambitious and experimental

Games Crimes

Imagine trying to negotiate with Siri, or GLaDOS, or C-3PO, just to get them to help you get out of a room.

Indie Game Magazine

I was really captivated by the idea of using chatbot technology to build the NPCs. […] the feeling of being able to write whatever you wanted to say, and getting actual responses from them even if you went out a little out of context (like saying “I’m sad”) was really stimulating. […] this idea of a robot world with AI conversation bots as the NPCs might spawn something cool!

Jordi de Paco, one of the judges of the Adventure Jam, interviewed at Cheese Talks

It has tons of potential, but I just don’t know what the commands are. 🙂 Next!

Jupi Plays Indie games  [Video]

Spanish

La idea es genial, […] puede ser muy interesante encontrarse ante una aventura entera sólo con esta mecánica.

Desconsolados

Estoy imaginando una mecánica de este tipo, con el añadido del reconocimiento de voz, en un título como Mass Effect 4, y sólo de pensarlo me mojo entero […] Tremendamente interesante.

Vadejuegos [Vídeo]

Brillante […], el mero hecho de tener una conversación real con una máquina capaz de respondernos a todo lo que decimos me ha dejado con la boca abierta.

GeekyJuegos

Portuguese

É um jogo de escape the room diferente, pois ele depende da sua habilidade de conversação para se dar bem. […] A graça do jogo é exatamente essa: poder falar sobre o que quiser e, a partir disso, planejar a grande escapada.

Sem Tilt

Balancing Turing Adventure: Dialog AI vs puzzles

First posted on 18/Apr/2015 on the Game’s news feed at Game Jolt.

In pre-lauch tests, people use to complete the Turing Adventure in an average of two plays – which is what I was looking for.

Now, I am observing how some people cannot complete the games in three plays, while others complete the game in just ten lines! This high variance seems to be hard to balance.

However, comparing this data with those of my very early prototype, which no player was able to complete the game in less than three plays, I believe that this is going to work like this: As the robots knowledge database grow thanks to the user inputs, the puzzles will become more and more apparent to first time players. Actually, the puzzle of Turing Adventure is quite simple, so if robots talked close as if they were sentient, most people should complete the game in a single play. This lead me to think that, as robots learn to speak as I want to, I should rework the puzzles to make them harder.

Actually, that would be great news, since the game should revolve around the puzzles. The AI behind NPCs should be just a mechanism to further immerse the player in the adventure, and not to be an obstacle by itself!

For a future full-length game, there would be another factor to consider. As player progress in the game, they will learn what to expect from the chatbots, so talking their way out of the puzzles would be a more straightforward task. Therefore, chatbots from those puzzles should not need to be as polished as robots from the early game. We’ll see.

A word on defining the target audience for your game

Almost all manuals on Game Designing or Game Business recommend you to define the target audience for your game. That’s clever, since it can be really useful in order to define what your game is going to be.

Alas, almost all of them suggest that you define your target audience in terms of demography, with emphasis on age and gender. And that’s not smart. Let’s say, for example, Wii Sport Resort. It’s a game to play with friends, and it’s being played by anybody that can throw a party at home (or even at office): from children to grandpas (grandpas really liked the Wii, do not forget). Male and female alike. Does it means that the target audience of this game was “universal”?. No, it was not. And what about Tetris?

There is a better way. Instead, try to name game genres, real games titles, and platforms. If I tell you that the target audience of this game is Flappy Bird players, PC gamers who play Call of Duty online won’t even come to your mind, even though male teenager are a huge portion of both groups.

Mobile, console, PC; Casual, hardcore; multiplayer, single player; Indie, Tripe A; Arcade, adventure, puzzle… Are better words to define the target audience for your game. And even better are game titles.

Whilst it doesn’t sound very academic, it’s certainly a better way to communicate your ideas and envision your path.