Effic’asthme – Asthma Attack Simulator

During 9 month, we worked with DOWiNO and the Paris Descartes University on a medical serious game.
Effic’asthme is available both on the Play store ( https://play.google.com/store/apps/details?id=fr.parisdescartes.efficasthme ) and the App store ( https://itunes.apple.com/fr/app/efficasthme/id1400814236?mt=8 ).

The app targets parents of children suffering from asthma to help them face asthma attacks. The app is based on and supported by a thesis of a PhD student in health David DRUMMOND. (Link to the thesis – in French )

Effic’asthme provides : a digital action planning to deal with asthma attacks, a small encyclopedia on asthma attacks, a diary, and a simulator with realistic medical behaviors and a screen debriefing the event.

In the rest of the article, I will explain the most important parts of Effic’asthme : the simulator.

Continue reading Effic’asthme – Asthma Attack Simulator

Franc-Tamponnage 2018 goes AR & VR!



Magna Vox is an association located at Dijon organizing concerts in the Burgundy – Franche – Comté region. In 2017 we already participate to the Franc Tamponnage‘s edition, with some applications you can find here. This time we improved one and create two others!

Continue reading Franc-Tamponnage 2018 goes AR & VR!

Smokitten – two apps to help prevent and treat nicotine addiction

App links and official info :

DOWiNO‘s official website for Smokitten
Smokitten iOS Android
Smokitten Park iOS Android

Smokitten and SmokittenPark are two sides of the same coin. A  Willingness for the creators of this serious game, DOWiNO, to help people who are smoking to stop and younger non smokers to never start. The former will get informed about their habit, track their progress, get notified, and the latter will be informed about this addiction and help the cat caracter to stop smoking.

Along with health professionals specialized in addiction, DOWiNO has devised a number of fun and addictive clicker-like minigames so that Smokitten players (smokers) can get through their craving period, and SmokittenPark players (non-smokers) can have fun playing the game, helping the smoking cat to get rid of his addiction.

Continue reading Smokitten – two apps to help prevent and treat nicotine addiction

Click Hanger – Procedurally generating a mountain

Today we’re proud to show our work on the latest game for the Française Des Jeux (France’s national lottery game)! Made with Isobar and our friends at James Bang.

Click Hanger, the first non lottery game of the FDJ, is a mobile climbing game available on Android and iOS.

Read more on its development process below!

Continue reading Click Hanger – Procedurally generating a mountain

Playing with AR & Vuforia

Augmented reality is one of the next big thing. It’s been present since a while (do you remember all those old cool Flash experiments in the browser?) but nowadays the tech is almost ready to blow our mind!

The Google Glass raised many criticism concerning private life but companies were very confident about the technology. Then the Microsoft HoloLens came on the market, but its pricing made it unaffordable for individuals.

During the same time, many companies tried to make AR working on devices: Google with special devices (Google Tango) and Vuforia established itself as a leader thanks to its SDKs. Apps & SDKs contiuned to improve during those last years (thanks to device performances and better cameras), but finally, this year, Apple with ARKit and then Google with ARCore show this technology was ready (on high end devices).

Maison Tangible
Guillaume Bertrand from Atelier Supersenor and 3615 Senor an artlab / hackerspace at Besançon, asked us to help him on an AR application. We’re glad to release the app for iOS and Android. Watch it in action:

Please help them to make their next collection live!

Lynx Optique
With James Bang, we made an AR app for a brand of optical shops with winning moments. After a digital form, visitors seek for a marker in the shop and once they found it scan it via an iPad. A cool Kinematic Inversion animation is displayed on the marker with the result. Here is the proof of concept:

And you what are you making with AR this days?

Filters 2D : the rebirth

Filters 2D was a good experiment into shaders land. I joined Da Viking Code in April and one of my main mission was to update this plugin and going deeper in shaders experiments. We’re glad to provide a plugin update with many improvements. Let’s go for some explanations on problems we encounter during the upgrades and fixes. Continue reading Filters 2D : the rebirth

Building a 3D furniture visualiser with Three.js

Blanc Cambouis is a company selling high end furniture to their customer. In order to let the customer visualize the product they are buying we were asked to create a custom real-time 3D object viewer, able to manage different kinds of models and to customize them on the fly.

While Integral Service worked on the web side of the product, us at Da Viking Code worked on the object viewer.

In order to meet their requirement we built a Three.js (WebGL Based) app using the Haxe language and yar3333’s Haxe extern for Three.js, we needed a modular solution to import the furniture into the engine, but also to enable the furniture’s multiple customization option without implementing new logic for each model.
Continue reading Building a 3D furniture visualiser with Three.js

Run pngquant via a NativeProcess: C#, Unity & AS3/AIR

After our Unity runtime SpriteSheets generator, it is a good idea to optimize the generated pngs files.

pngquant is a command-line utility and a library for lossy compression of PNG images. The conversion reduces file sizes significantly (often as much as 70%) and preserves full alpha transparency. In other words this is a must have tool if you’re working with many pngs!

I used many times pngquant directly from the command line, but depending your project, you might need to run it directly inside your application! I didn’t find example for doing this, and it was way harder than I thought due to my lack of knowledge with batch and shell scripts! So here we go:

We use custom batch file (for Windows) and shell script (for Mac OS X) for launching pngquant. It will take the path to pngs to compress and overwrite them.

OS X:

#!/bin/sh
#!/usr/bin/env bash
#$ -N $2

DIR="$( cd "$( dirname "$0" )" && pwd )"

(cd "$DIR" && ./pngquant -f --ext .png "$1"/*.png)

Windows:

cd %~dp0
pngquant -f --ext .png "%~1"/*.png

Now a C# example for calling thoses scripts, note it works fine with Unity too:

System.Diagnostics.Process process = new  System.Diagnostics.Process();

string exec = "";
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer)
	exec = "pngquant-windows.cmd";
else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer)
	exec = "pngquant-osx";
else
	throw new Exception("Platform not supported");

process.StartInfo.FileName = Application.dataPath + "/../../" + exec;
process.StartInfo.Arguments = Application.dataPath + "/../../png-to-compress";

// if your path have blank spaces use:
//process.StartInfo.Arguments = "\"" + Application.dataPath + "/../../png compress\"";

process.StartInfo.CreateNoWindow = true;
process.StartInfo.UseShellExecute = false;

process.Start();

And finally an example with AS3 for AIR:

var process:NativeProcess = new NativeProcess();

var startupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var file:File = File.applicationDirectory;

var exec:String = "";
if (Capabilities.os.indexOf("Windows") >= 0)
	exec = "pngquant-windows.cmd";
else if (Capabilities.os.indexOf("Mac") >= 0)
	exec = "pngquant-osx";
else
	throw new Error("doesn't work on " + Capabilities.os + " operating system");

file.nativePath = file.nativePath + "/../" + exec;
startupInfo.executable = file;

var processArgs:Vector.<String> = new Vector.<String>();
processArgs[0] = File.applicationDirectory.nativePath + "/../png-to-compress";
startupInfo.arguments = processArgs;

process.start(startupInfo);

Be sure to have a look to PngQuantNativeProcess’s git repository to be up to date!

Unity – generate SpriteSheets at runtime!

Unity and plugins provide many great ways to build Sprite Sheets. However they’re used directly into Unity Editor or with an external software which is perfect in many case, but none provide the ability to generate SpriteSheets at runtime. So we made our own library.

The goal of a sprite sheet is to pack as many sub-textures as possible in one big texture. So the first thing to do was a packing algorithm. Fortunately we remembered the one made and open-sourced by Ville Koskela in AS3, so we started with a Unity C# port.
Click here to view the Unity rectangle packing example running in your browser in WebGL!

Once the packing algorithm done, we worked on a cache system so the generated sprite sheets are written and saved on disk for a future loading. The generator process won’t be needed anymore unless you increase your cache version!

Give a try to UnityRuntimeSpriteSheetsGenerator!

Unity – sprite packing

Best practices with Unity have always been an hidden gem. Most precisely concerning the Resources folder. Hopefully things are changing with Unity’s best practices guide! And things are simple concerning the Resources folder: just don’t use it!

Managing 2D Sprites in Unity is simple if you have a static scene: just put every sprite needed on your screen and you’re almost done. Obviously you should package them in Spritesheets. The easy way to do it is via Unity’ Sprite Packer tool. But what to do if you need to load Sprites at runtime? How to access a Sprite if it’s not linked directly on a GameObject or a Prefab and without using the Resources folder?

Create a ScriptableObject! They are the best way to store informations within Unity. Here is an Editor Script for generating ScriptableObjects with a list of Sprites for each Packing Tag mentioned:

using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;

[Serializable]
public class SpritesData:ScriptableObject {

	[SerializeField]
	public Sprite[] sprites;

	static public string assetDirPath = "RuntimeSprites/SpritesData/";
	static public string assetPath = "Assets/RuntimeSprites/SpritesData/{0}.asset";

	#if UNITY_EDITOR
	[MenuItem("Data/Create Sprites Data")]
	static void CreateSpritesData() {
		string dirPath = Application.dataPath + "/" +  assetDirPath;

		if (!System.IO.Directory.Exists(dirPath))
			System.IO.Directory.CreateDirectory(@dirPath);

		SpritesData data = ScriptableObject.CreateInstance<SpritesData>();

		List<Sprite> spritesList = new List<Sprite>();

		string[] anims = AssetDatabase.FindAssets("t:Sprite", new string[] {"Assets/Sprites"});

		string currentTag = "";

		foreach (string anim in anims) {

			string path = AssetDatabase.GUIDToAssetPath(anim);

			TextureImporter ti = TextureImporter.GetAtPath(path) as TextureImporter;

			if (ti.spritePackingTag != currentTag) {

				if (data && currentTag != "") {

					data.sprites = spritesList.ToArray();
					AssetDatabase.CreateAsset(data, string.Format(assetPath, currentTag));
				}

				data = ScriptableObject.CreateInstance<SpritesData>();
				spritesList = new List<Sprite>();

				currentTag = ti.spritePackingTag;
			}

			Sprite sprite = AssetDatabase.LoadAssetAtPath<Sprite>(path);

			spritesList.Add(sprite);
		}

		data.sprites = spritesList.ToArray();
		AssetDatabase.CreateAsset(data, string.Format(assetPath, currentTag));
	}
	#endif
}

Now that you have all your SpritesData you just have to create a MonoBehaviour with a public SpritesData[] spritesDatas; property, then you will have access to all your sprites! The good things is while a sprite isn’t displayed on Screen it’s not in memory.

Cheers!