Thursday, September 3, 2015

Perkun as a library.

Imagine you would like to use Perkun ( as a library in your own project. It is possible! Take a look at my game: Perkun Wars (

In your you have to add the line:

PKG_CHECK_MODULES([PERKUN], [libperkun >= 0.0.7])

In src/ you will add the flags defined by this macro - PERKUN_CFLAGS to AM_CXXFLAGS and PERKUN_LIBS to your LDADD. For example:

    -I.. -I../inc \

perkun_wars_LDADD = \

In your header file you need to include <perkun.h>. See the file inc/perkun_wars.h.

Define a new class inheriting perkun::optimizer_with_all_data, In Perkun Wars it is the class npc.

Instantiate the class and run the perkun interpreter (see the file src/, function main_perkun). You run the interpreter calling the function "parse".

This function main_perkun runs in a separate process, because in Perkun specification we use the loop. But there are pipes in place and the redefined virtual functions of the class npc communicate with the main process through the pipes. In fact there are three extra processes in Perkun Wars. They are named after the heros:
  • Dorban
  • Pregor
  • Thragos

No comments:

Post a Comment