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.

Jul 312012
 

Durante a última semana, dos dias 25 a 28 de Julho, participei da 13a edição do Fórum Internacional do Software Livre – FISL 13 . Além de dar uma palestra no dia 26, fiquei no estande da ProFUSION Embedded Systems, que foi uma das patrocinadoras do evento.

No estande apresentamos alguns projetos desenvolvidos na empresa nos últimos 2 anos, como o software para o refrigerador Infinity I-Kitchen da Electrolux, o sistema de entretenimento de aviões da Zodiac, e o browser Endeavour, projeto nosso que conta com o apoio da FINEP. Todos são baseados nas Enlightenment Foundation Libraries, rodam em cima de Linux e do X11. O último utiliza ainda o port EFL do WebKit, para o qual tanto contribuimos. Durante estes quatro dias muitas pessoas passaram por nosso booth: desenvolvedores, membros das comunidades de software livre, estudantes, curiosos no geral, e inclusive alguns colegas que não via há algum tempo. Havia um grande interesse pelo que a empresa vem fazendo, sua relação com o software livre, e claro, pelos brindes.

Considero que a parte mais interessante de eventos como este é a possibilidade de se encontrar e ter conversas mais longas com desenvolvedores de outros projetos e outras empresas. Conheci algumas pessoas do INDT, conversei com desenvolvedores da Intel, da Red Hat e da Globo.com, além de membros da comunidade do KDE. Conversas sobre formas de contribuir para os projetos de software livre e como conquistar mais desenvolvedores foram frequentes.

Na palestra que dei, chamada “Linux na Geladeira”, utilizei um dos nossos projetos como caso de uso para explicar um pouco sobre desenvolvimento para embarcados e também para discutir formas de contribuir para projetos de software livre mesmo quando se é contratado para desenvolver um software proprietário. Algumas boas práticas de relacionamento com as comunidades foram apresentadas, além de dicas sobre como escolher as camadas onde se deve adicionar funcionalidades, mantendo parte do software desenvolvido com licença livre, permitindo assim seu reuso por todos.

Os slides da apresentação podem ser vistos abaixo ou baixados.

Segundo o site do FISL, o evento contou com a participação de mais de 7000 pessoas, vindas de todos os cantos do mundo e com os mais diversos interesses. Procurei assistir algumas palestras mais técnicas, porém mesmo neste aspecto o evento é muito plural, sendo que várias palestras que tocavam mais aspectos administrativos, legais e mesmo filosóficos foram apresentadas por pessoas muito relevantes nestas áreas.

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.

Jun 042012
 

No sábado, dia 26 de Maio, ocorreu a primeira edição da Tosconf, a conferência do Laboratório Hacker de Campinas. O evento ocorreu na própria sede do hackerspace, e contou com uma grade de palestras bem variada.

Foram 11 palestras, algumas mais filosóficas e políticas como cerceamento de liberdade na internet (JS Bueno), sobre rádio digital (Diniz), palestras técnicas sobre o Android (Rodrigo Chiossi) e Tizen (eu), até informações sobre como sobreviver à um ataque de zumbis, ministrada pelo Antognolli. Contamos inclusive com a participação de Richard Stallman, explicando o software livre e discutindo com o público a importância da liberdade para os usuários (agradecemos ao Alexandre Oliva por levá-lo). O cronograma completo está na página da Tosconf.

Ao todo, aproximadamente 60 pessoas passaram pela conferência, dentre elas membros do LHC, do Garoa, da Free Software Foundation, da Free Software Foundation Latin America, do Saravá, do CTI Renato Archer, desenvolvedores de varios projetos de software livre e curiosos no geral. Além de ver as palestras, parte do pessoal aproveitou para conhecer o espaço e se entrosar mais com os outros participantes.

Durante a palestra sobre desenvolvimento de aplicativos web com o Tizen, mostrei a arquitetura da plataforma, citando alguns do projetos envolvidos e explicando com um pouco mais de ênfase as Enlightenment Foundation Libraries. Depois dei algumas referências sobre instalação e fiz uma sessão mão-na-massa rodando o Tizen SDK, criando um “Hello World”. Este foi então emulado e passado para um dispositivo de desenvolvimento rodando o Tizen.

Sem dúvidas, temos muito a aprimorar em questões como organização e divulgação, mas considerando nossas restrições de recursos e tempo, foi um evento muito positivo para o hackerspace. Parabéns a todos os membros do LHC que puxaram o evento, e em especial para o Leandro. Nos vemos na próxima Tosconf.

Fotos tiradas pela Narinha, que promete disponibilizar mais fotos do evento em breve =)

May 212012
 

Durante os meses de Março e Abril ocorreu no SESC Ribeirão Preto um evento repleto de atividades de cultura hacker, chamado Hackeria. O Laboratório Hacker de Campinas (LHC) participou dando oficinas em dois finais de semana.  Não consegui encontrar a grade no site do SESC, porém está disponível no TecnoArteNews.

Uma das oficinas tratou da radiocomunicação, com discussões sobre radiodifusão, radio amadorismo, legislação e um bom tanto de prática: uma pequena estação transmissora foi montada com os participantes, que ficaram transmitindo e receptando nos arredores do local. Contou com a participação de um público bem jovem, que pareceu bem interessado e se divertiu muito.

A segunda oficina foi sobre desenvolvimento com Arduino, totalmente prática, com os conceitos básicos de programação e eletrônica sendo explicados durante o desenvolvimento dos projetos. Iniciamos com projetos bem simples que foram executados pelos participantes individualmente ou em duplas, partindo de piscar leds em uma determinada frequencia, uso de componentes de entrada, como potenciometros, botões e sensores de luz, até emissão de som com piezoelétricos. Depois passamos por projetos com complexidade um pouco mais elevada, unindo o uso de alguns destes componentes, e por fim fizemos um sintetizador de som com todos os participantes contribuindo juntos. Também foram apresentados alguns projetos utilizando o Arduino, como o TV-B-Gone.

Considerando que cada uma das oficinas teve duração de 6 horas, creio que muito conteúdo foi passado, mas de forma que todo mundo tenha conseguido assimilar bastante conhecimento. Sem dúvidas foi uma oportunidade muito legal de compartilhar um pouco do que sabemos, conhecer o pessoal do SESC Ribeirão, e tomar um chopp no Pinguim. Gostaria de aproveitar para agradecer a Michelle Magrini, que entrou em contato com a gente e viabilizou nossa participação no Hackeria. Esperamos participar de outros eventos lá no futuro.

Na sequencia, algumas fotos do evento tiradas pela Flávia Ferreira, que também trabalha no SESC.

May 152012
 

I’m just back from San Francisco, where Tizen Developer Conference 2012 took place, from May 7th to 9th. According to the organization, more than 700 people attended, and I had the opportunity to talk to many developers from different companies and projects. There were contributors of WebKit, BlueZ, ConnMan, oFono, and surely, the Enlightenment Foundation Libraries. And I finally met Raster, with whom I discussed a bit about EPhysics, a new library that will make developers lifes easier when physics are required in a software, and features to be implemented on Edje.

I’ve given a talk about our beloved layout library, Edje, on the last day of the event. Slides of “Creating Fancy User Interfaces with Edje” presentation can be read below or downloaded from here. Examples can be found here.

ProFUSION sponsored the conference and we’ve shown three demonstrations of EFL usage on products we’ve developed in our booth. Our showcase was composed by Electrolux Infinity I-Kitchen Fridge, Zodiac’s In-Flight Entertainment System demo, and Endeavour browser. All of them based on the EFL and the last one using the EFL port of WebKit as well. I’ve participated on the development of these softwares, so I was really proud of attendees’ interest on them.

EFL adoption to compose Tizen platform’s core is a nice chance to our community to attract more developers and to become even more relevant. Sure, releasing e17 soon would just add yet more momentum ;)

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.