dracoblue.net

How I built a social game in one week: SwarmFight

It has been an interesting past month, so I want to share how I build a social game for desktop and mobile devices by using Javascript and HTML/CSS.

Since it took me 7 days to make it, I entitled the blog post: "How to create a social game in one week"! I will post all 7 days of my development diary now, so you can see what progress I made at which time and which issues evolved and got fixed :).

The game is an online realtime multiplayer puzzle game called SwarmFight and freely available to join at http://swarmfight.com.

Continue reading ...

In javascript, jquery, jsb, php, swarmfight by DracoBlue @ 12 Feb 2012 | 1391 Words

JSB 1.3.0 released - Good bye Inline-Javascript

Today I finally finished JSB 1.3.0. The JsBehavourToolkit is a little toolkit to avoid any inline javascript, allow copy-and-paste of behaviour on html elements.

There is a native version, which works without any framework from (Firefox 3+, Safari 5+, Opera, Chrome and IE9+). The jQuery and Mootools Version works with any browser (even IE6).

New in 1.3.0 is a simple (by design!) event system. It is framework independent and works with simple channel identifier and a json-object as value.

jsb.fireEvent('HoneyPot::CLICKED', {"name": "Bob", "times": 2});

This should be fired by a Js-Behaviour which needs to say something, instead of global variables and direct call. This enables you to use dependency injection if you keep the channel identifier the same.

You can listen to that event, too:

jsb.on(
    'HoneyPot::CLICKED', // identifier
    function(values) { // callback
        alert('The user ' + values.name + ' clicked it already ' + values.times);
    }
);

It's even possible to filter for a filter-object when listening:

jsb.on(
    'HoneyPot::CLICKED', // identifier
    {"name": "Bob"}, // filter everything with name = Bob
    function(values) { // callback
        alert('The user ' + values.name + ' clicked it already ' + values.times);
    }
);

You may also use RegExp as channel identifier when calling jsb.on:

jsb.on(
    /^HoneyPot.*$, // identifier which starts with HoneyPot*
    function(values) { // callback
        alert('The user ' + values.name + ' clicked it already ' + values.times);
    }
);

Have fun with this release.

Sourcecode is of course MIT-Licensed and available on github. Tests for jquery, mootols and native version are shipped in the tests-folder.

In javascript, jquery, jsb, mootools, open source by DracoBlue @ 04 Jan 2012 | 278 Words

Spludo 1.1.0 released

Finally a new spludo 1.1.0 release is available. This is also the start of 1.2-dev development.

The 1.1-branch will stay to support node version 0.4, 1.2 will (soon) support only 0.6 and later.

Changes from 1.0.3 to 1.1.0:

* added dependency to node >=0.4.0 && node < 0.5.0
* generator for monit+upstart configuration
* code generation for migrations extended with shortcut fields definition
* added support for application/json paylod
* generate *ByIds method for services
* added ApiServiceController to register a service as REST service
* context.request now holds the current req instance
* added inflection.js
* added node_modules for own vendor libraries
* replaced own testing system with vows (if you want to run the tests, please install vows!)
* spludo_directory variable is now set always when calling spludo-gen
* added bootstrap_manager.whenLoaded(callback) to get notified as
  soon as the app is ready.
* replaced self with that
* fixed core_dev_change_build_version on MACOSX
* added jshint instead of jslint
* added support for node_modules folder in project directory
* added Criteria for DatabaseDrivers
* added code generation for Migrations
* added SqliteDatabaseDriver
* added a Database Migration system
* added MysqlDatabaseDriver
* added code generation for Services
* added DatabaseManager and ServiceManager
* added Logging#addTracing (makes the this.trace(function_name) obsolete)
* Codegeneration loads the spludo application now (this enables the developer
  to generate code against the base of the application)
* Codegeneration #validateParameter receives the validated parameters now
* TestCases are now able to call .debug+.log and so on, because the execute
  method is applied to the TestSuite.

I have been using this development version for plenty small projects and the

code generation, migrations and database driver stuff should really help you get your app developed way faster!

Loads of documentation and examples can be found in the spludo user guide.

Have fun!

In node.js, open source, spludo by DracoBlue @ 20 Nov 2011 | 313 Words

Remote logging with rsyslog, php and agavi

When I tried to get rsyslog running with php I didn't face much problems. Anyways I want to share some things I noticed while getting it to work.

First of all ubuntu uses rsyslog already. Just a simple

# apt-get install rsyslog-mysql

and all syslog messages went directly into the database "syslog". Configure /etc/rsyslog.d/mysql.conf to insert this information into a remote machine.

Now let's get to php. You have the option to set:

error_log=syslog

This however does log all messages with

php: whatever the issue or error is

If you want to replace "php" with a custom message, you have to call

openlog('myapp', LOG_PID | LOG_ODELAY, LOG_USER);

before any error happens. Because LOG_ODELAY is given, it won't connect to syslog unless any error happens, so one should be save to put this call at the top of your dispatcher file.

The final log message will look like that (254 is the process id):

Sep 26 13:39:44 root-server myapp[254]: the issue or error

Finally I wanted to log all messages created by agavi's logging system. Since I didn't found an existing

AgaviSyslogLoggerAppender, I wrote one and put it up on a github-gist.

Have fun logging!

In agavi, myquests, php, ubuntu by DracoBlue @ 26 Sep 2011 | 222 Words

Nginx always overwrites the Server-Header

When I was configuring the nodejs server behind nginx, I experienced the issue that nginx always overwrote the Server header response.

This is a bit annoying, since I want to know what version of spludo runs on my site.

The solution is not to set

server_tokens off

since that would only disable the version number.

The solution is:

proxy_pass_header Server;

In nginx, node.js, spludo by DracoBlue @ 19 Jun 2011 | 74 Words

Page 11 - Page 12 - Page 13

Give something back

Were my blog posts useful to you? If you want to give back, support one of these charities, too!

Report hate in social media Campact e.V. With our technology and your help, we protect the oceans from plastic waste. Gesellschaft fur Freiheitsrechte e. V. The civil eye in the mediterranean

Recent Dev-Articles

Read recently

Recent Files

About