Jan 212013
 

After a few years writing Edje themes and leading teams doing such task, I’ve faced some errors and I’m going to list them and explain how to start to debug it with a specific tool: edje_player.

General explanations

Edje is the graphical design library, part of the Enlightenment Foundation Libraries. Themes are written as plain texts following the Edje Data Collections syntax and compiled with the program edje_cc. Later, it can be used by any program using Edje API.

Communication between code and theme is done via signals and messages. Signals are composed by two strings, source and signal and can be listened or emitted by a program block in the theme without the need of scripts. Messages can be more complex, can be a float, an integer, a string, an array of these types or a composition, like a string + a float, for example. Also, messages have identifier number. But to handle messages, the theme needs scripts.

So it is a bit error prone regarding typos, since it wouldn’t be checked in compile time (this issue can be reduced with the recently added codegen). Also, many other issues can happen, like a part not appearing where you expected, or a transition that doesn’t seem to be triggered.

Edje Player, more than just a tool used to visualize the theme, can be used to debug it. Between many options, the more relevant are:

  • -g –group : an edc file can have many groups, so if you want to load a group different from “main”, or from the first group of the collection, it should be used. E.g.: edje_player -g groupname file.edc. If you can’t remember the group name, groups can be listed with “–list-groups” option.
  • -Z –size : will try to set a specific size, but minimum sizes will be respected. If not set it will try a default size (that also will respect theme minimum size). E.g.: edje_player -Z 500×500 file.edc
  • -p –print : used to print signals and messages emitted by the theme to stdout. E.g.: edje_player -p file.edc
  • -S –slave-mode : really useful mode that will make edje player listen for commands on stdin. E.g.: edje_player -S file.edc. Main commands:
    • help: list all possible commands
    • signal <emission> <source> : send a signal to edje. If whitespaces are required the string should use double quotes. E.g.: signal “play next” player
    • message <id> <type> <args list>: sends a message to edje. It supports all message types, and args list can vary depending on them, so check the list with help. E.g.: message 2 Float 0.4

Troubleshooting

Usually when facing the following issues, an inexperienced developer tends to waste a lot of time digging into themes code just to get to the conclusion that it was an error in the program code, or make many changes to the program code to trigger the issue more easily or to print debugging information, like adding callbacks to signal “*” “*” of some objects.

So, as a first step, it’s required to check if it’s an issue on the theme or the program code, and I’m providing some suggestions of how to validate the theme using edje_player in many cases.

A general advice: check for typos in signals / sources and part names (for the case of swallows). To prevent it if used in more than one place, you could define a constant.

Animation to be tested is hard to trigger

Suppose you need to test / debug an animation that is triggered only after many interactions in your software, or it only happens after a long task. If the theme program that starts it listens for a signal or message, you can send it using Edje Player slave mode and save a lot of time. If the program is called by others using the after command or via script, you can add a signal there just for debugging purposes (or call the parent program of the whole chain).

Part with apparently wrong geometry

Using the info command of slave mode it will return the geometry of the part.
E.g.: info bg => INFO: “bg” 0,0,512,380

These four values are x and y coords, width and height of the part named “bg”.

If you receives the expected size, but yet theme looks wrong, and if the part is a swallow or text, many issues can be happening, like the swallowed object having a problem instead of the theme. In this case, you can change its type for a rectangle just to validate the part sizing.

Transition triggered by signal doesn’t play

If a transition that should be triggered by a signal doesn’t play, first thing to check is if it is an issue with the transition itself or it is the signal not being emitted by the code. For that, just use the signal command of the slave mode. If the transition plays, you know the theme is fine, you should look for a typo on signal emission on program code or check if it’s not being emitted at all.

Transition triggered by message doesn’t play

The same approach as transition triggered by signal should be used, but here, instead of typos on signal / source, you need to assure the message id and type are correct (or any other checks you are doing in your script). Using the message command of the slave mode is enough for an initial investigation.

Callback of signal or message isn’t called

To check if a theme is emitting a signal or message, you can run edje_player with -p argument. In this case, all the emitted signals and messages will be printed to stdout. If the emission you are looking for is done after a user interaction like clicking a part, dragging, mouse over, etc., just do it and you should read it in your terminal.

If the theme should emit it after a signal or message emitted by the program code, you should run edje player with -p and -S arguments, so it will also run in slave mode. For signals, use signal command, for messages, message command.

If you can see the signal / message emitted by the theme in your terminal, the theme is validated. You should check for:

  • typos of signal / message
  • callback added to the wrong object
  • code that adds the callback isn’t even called.
  • callbacks are deleted before signal / message emission.

Script variables debugging

Embryo scripts run in a sandbox, you can’t print to terminal directly to see a variable value. An easy way to check these values is to send signals or messages with the variables to be checked and run edje player with -p argument, so they will be print to stdout. With that you can inspect integer, string or float variables.

Signals are sent in embryo with emit(signal, source) and messages are sent in embryo with send_message(type, id, values list). For a full list of supported functions by embryo script, check the following files:

  • INSTALL_PREFIX/share/edje/include/edje.inc
  • INSTALL_PREFIX/share/embryo/include/default.inc

Example

A simple example of a theme that shows a background with a message to the user explaining it will emit a signal back when it receives ‘hello’ from source ‘player’:


/* Simple EDC exemplifying how to receive and emit signals */

collections {
   group {
      name: "main";

      parts {
         part {
            name: "bg";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               min: 500 50;
               max: 500 50;
               color: 0 0 0 255;
            }
         }

         part {
            name: "text";
            type: TEXT;
            mouse_events: 1;
            description {
               state: "default" 0.0;
               color: 255 255 255 255;
               text {
                  font: "Sans";
                  size: 20;
                  text: "I will reply to the signal 'hello' 'player'";
               }
            }
         }
      }

      programs {
         program {
            name: "reply";
            signal: "hello";
            source: "player";
            action: SIGNAL_EMIT "hi" "theme";
         }
      }
   }
}

It should be compiled and played:

edje_cc signals.edc
edje_player -p -S signals.edj

It will start sending some signals by default to the theme. After that, you can move the mouse cursor over the text. It will emit signals related to mouse movement. It will print in output:

SIGNAL: "mouse,in" "text"
SIGNAL: "mouse,move" "text"
SIGNAL: "mouse,move" "text"
SIGNAL: "mouse,out" "text"

This kind of signals are not emitted when the cursor moves over the background because the “bg” part was set to not handle it with “mouse_events: 0”.

To emit the ‘hello’ signal, just type:

signal hello player

and you’ll see the following output:

SIGNAL: "hello" "player"
SIGNAL: "hi" "theme"

signals_edj

Dec 142012
 

Michael Blumenkrantz, the very acclaimed e17 release manager, and I have been working on Etrophy, and it’s ready for a 0.5 release.

Etrophy is a library that manages scores, trophies and unlockables. It will store them and provide views to display them. It could be used by games based on EFL and any other application where such a thing could make sense.

It’s already in use by Escape From Booty Bay, Econcentration and Echo. And who knows what else is coming ?

Etrophy can be checked out from E Project’s svn repository:

$ svn co http://svn.enlightenment.org/svn/e/trunk/PROTO/etrophy

or downloaded in release tarball form.

Online documentation isn’t in E server yet, but can be accessed here.

There are still a lot of tasks to be concluded before the 1.0 release, including adding a remote backend, adding more views, creating some examples and improving  docs. Since we are developing it mostly in our free time, between many other projects, anyone willing to help to speed up things a bit will be very, very welcome.

Nov 262012
 

EPhysics has been vastly improved since it reached E project’s repository, a few months ago. Most of the road map was implemented, including the release of a game based on it, Escape From Booty Bay. It means EPhysics now support soft bodies and cloths, uses threads, works with the concept of Camera, has helpers to make it easier to use, has a sandbox tool to test scenes without coding and even supports 3D scenes somehow. Details are presented below with screenshots and video.

3D scenes

Perspective: Applying perspective to the camera allows developers to create more realistic scenes, setting the “infinite distance” point and focal distance.

Light: It’s possible to set an environment light and a light point, that can be moved around. Light colors can be changed as well, producing really interesting effects. Bodies that should be affected by light can be configured by the user.

It is simple, having some limitations worth mentioning: it doesn’t support light absorption, refraction or reflection and bodies don’t make shadows over  others.

Primitive types faces: Instead of just setting an Evas Object to each body, support to setting objects for each face of the primitive types was implemented.  So you can have different objects in each one of the six faces of a cube.

Soft Body

A soft body will deform when colliding with other bodies and when suffering specific types of impulse, handling with its mesh. Its hardness and bending constraints can be set to simulate different materials.

Have you always wanted to have a soft button in your software interface that deforms depending where the user press it ?

OK, now it’s possible.

Cloth

A cloth is a kind of deformable open mesh. It can be used to make objects act like pages or flags.

Sandbox

Sandbox is a tool to make it possible to test how bodies will interact under specific conditions. So it’s possible to modify world and bodies attributes  easily, set velocities, apply impulses, forces and see how they interact without a single line of code. Sometimes fine tuning physics scenes is harder, and  tools like that should avoid time spent in many “small code changes, build and test” cycles.

Marina Proni helped designing this tool, and she has posted about its development under a designer point of view. Article in Brazilian Portuguese.

Camera

A camera defines the region of the physics world that will be rendered on the canvas. It sets the point of view. Can be set to follow a specific body or apply  custom perspective.

More

Many helpers were added, so instead of setting body’s mass, for example, it’s possible to set its density, or even its material, so properties like density,  restitution and friction will be set considering default values. Many default values are exposed as well to make developers life easier.

Documentation was heavily improved, with the entire API covered, and many explained examples. A nightly build is now accessible on Enlightenment project site.

Future

We are currently focusing on make its API stable to be released in 1.8 cycle, fixing bugs, and discussing a proposal to support physics on Edje in e-devel  mails list.

p.s.: This post is dedicated to David Seikel, always following the development of EPhysics.

Sep 112012
 

Escape From Booty Bay (efbb) is the newest game made using the Enlightenment Foundation Libraries. It’s a physics puzzle game in which players operate a cannon to stop pirates escaping from the prison. As players advance through the game levels, difficulty increases and new challenges are placed, like firing against moving targets.

The main goal of this game is to test and demonstrate the usage of EPhysics. EPhysics is a library that integrates the EFL and Bullet Physics. More details can be found at this post.

I’ve being working on this game here at ProFUSION with Ricardo de Almeida Gonzaga (software developer) and Marina Proni (designer), while Leandro Dorileo and I continued the development of EPhysics, adding new features and fixing bugs. Great job, team!

Its initial version reached SVN last week, and can be checked out with:

svn co http://svn.enlightenment.org/svn/e/trunk/GAMES/efbb

Building instructions are on the INSTALL file.

In case of doubts, #edevelop at Freenode is a good place to ask.

Bug reports, patches and new levels are very welcome.

Jun 262012
 

EPhysics, a fresh new library is reaching Enlightenment project’s SVN repository today. It’s a wrapper between Bullet Physics and EFL to add physics effects in a simple way.

It’s possible to checkout it from our SVN repository:

svn co http://svn.enlightenment.org/svn/e/trunk/ephysics

The video covers the tests that are included in our source code, as one can see the code is pretty simple to an EFL programmer and we expect them to adopt EPhysics to create their next splash screen, transition effects and even more games!

Why Bullet Physics?

Bullet Physics is a very well established physics engine. It’s stable, fast and simple to use, licensed under a permissive license and packaged for most distributions. It’s used by many big companies for games and movies such as Sony, Disney, Activision and Rockstar Games.

How is it structured?

It’s possible to create a World and add many Bodies, that can be represented by Evas Objects. These bodies have physical attributes such as mass, friction and restitution and shape. They may receive impulses and collide between them. Events occur when something happens, as a body moving, two bodies colliding, or the entire world getting halted (all the bodies stopped). The following diagram should help to make it all a bit clearer.

Everything is documented using doxygen, so you can build documentation with:

$ make doc

or access it online here. It’s just a temporary place until it reaches our project’s server.

And much more is coming. On our roadmap we have:

  • Create collision shapes from image;
  • Helpers to help the physics inexperienced people to define attributes and use it;
  • Sandbox tools to try different materials / properties in a live, what-you-see-is-what-you-get way;
  • Deform objects;
  • Adding camera concept (POV);
  • Creating a game

A more extensive list can be found at TODO file. Adding support to physics effects on Edje is planned as well, making it possible to configure physics environment and reacting to events.

So if you liked that, give it a try. I’ll be glad to help. Bug reports, reviews, feature requests and patches are very welcome. I’ll try to post a tutorial on creating applications with EPhysics soon.

Jan 052012
 

Hi there. New ProFUSION’s site is live at profusion.mobi! OK, kind of old news, but the new news is that it was made with nanoc.

nanoc is a nice tool to build small static websites. <joke> Sure, it’s written on Ruby, it won’t scale </joke>. It helps to convert articles written in Markdown language (making it easier to add posts), lay out pages, and has some helpers to common tasks like sorting posts and filtering stuff. Also, writing extra helpers is easy, even for non Rubyists.

But why moving from Drupal to a static website?

Ok, it’s faster to serve static HTML pages. But it wasn’t the main reason.

Actually, using Content Management Systems is time consuming, since you have to setup lots of things and update it all the time. And unless you already know the CMS you are using, you will spend a fair amount of time trying to figure out how to do what you want. In the other side, almost everybody here in the company already knows HTML and CSS, so anybody can change things quickly.

Another good reason is it is safer to host static websites. We had some security issues with Drupal recently.

If you are interested in knowing more about it, check the project’s page and wiki. Also, take a look at some sites made with nanoc, as Myst Online and Antognolli’s blog.

May 132011
 
I’m migrating the game Nines Time from github to our beloved svn repository. Tonight, finally, I had time to fix the last 2 known bugs and substitute an image for something a bit less fugly. My hope is that, being there, more people will notice its existence, using it like an example of python bindings usage, will play it, and (who knows) maybe contribute to make it better.
Nines Time is a game about digit 9 tyranny over the other digits. You are a 6 undercovered for years studying the 9s and providing information for your HQ so you could stop them, but your arms fail after years of handplant and you need to survive for 9 minutes until your pals rescue you. What’s your weapon? Math, dude! You need to operate the number trying to get you.
It started as an entry for last month PyWeek, as jprvita already mentioned on his blog, when I “worked” with him, acidx and antognolli. Actually, it was more about fun than anything else. Using efl python bindings is really straight-forward. If you’re interested on the development process during the challenge, there’s a diary.
Some people complained about the chosen music. It’s Priya’s Journey fault for not recording anything so far ;)
Check out right now and enjoy:
svn co http://svn.enlightenment.org/svn/e/trunk/GAMES/ninestime 

Nov 242010
 

You probably know that EFL is reaching version 1.0, consequently more people will be interested on them, and we’ll need a nice documentation. Documenting the libraries and softwares that we maintain is one of our priorities now. As I was writing about Editje on enlightenment wiki I decided to blog a bit about it.

Editje is a tool for designing and building graphical user interfaces quickly and easily. It’s an WYSIWYG (What You See Is What You Get) editor for Edje files, making possible to create very rich GUI using Edje parts, including external objects, like Elementary widgets and Emotion. But it’s much more than a tool to simple set parts positions and their properties, you can create animations and define the interaction via signals.

It provides three edition modes:

  • part mode: where you can compose your interface: adding, removing and changing parts and their states;
  • animations mode: enable you to set frames in a timeline and to define frame and part state details;
  • signals mode: make it possible to manage signals, that in Editje is the way of interact easier with the UI using messages exchange.

And when you may want to test what you have done so far, you can just click the Run button and interact with your interface ;)

If you are interested, you can look at Editje user’s manual made from some developers at Profusion: glima, Sachiel, masaki and tiago – nice work, guys. It’s provided as pdf or html and it’s source is kept on project’s repository.

Editje is written in python, it’s a free software released under GPLv3 and it can be checked out from enlightenment project repository.

Nov 202010
 

This week a couple of games reached Enlightenment repository. They are in the first hours of development and a bit ugly. If you are a designer, please give us a hand  =)

While talking to Luis Strano we decided to have a game hack day on Sunday, 21 November. We’ll be hacking and hanging around #edevelop, nothing too formal. If you are interested, Barbieri wrote a list of simple games asking to be developed.

If you want to check out this stuff:

svn co https://svn.enlightenment.org/svn/e/trunk/GAMES

You will find there a good looking game too, eskiss, developed by Raoul Hecky,as you can check in this video.

So, if you are looking for some fun on this Sunday, talk to us at #edevelop@freenode.net.