3d in the era of J2me

Back in the deep dark past (2004-2007) I worked on a 3D game for phones of that era (before iphone, android). I recently found some of the test files for the engine, here are some videos. Very low poly racetrack The ubiquitous cube Spacekid in the spacestation corridors Our Maskot wanders the corridors .. you can't look too far ahead, to keep things really low, which means popup is a little...severe. Movement is a better in reality - the capture has made the movement a bit jerky. Dire Straits Obviously we didn't make this, but it heavily inspired our 3D engine ... textures were just too slow, so we aimed for this look.

Belated post on libregraphics meeting 2014

Here is my very late post on LGM 2014! Back in April I went to Leipzig for my first in-the-flesh meeting of Shoebot devs .. I met with Ricardo + to collaborate on a workshop on shoebot. To make it more fun we hadn't decided what to do it on ! In the anarchic OSP (open source publishing) house we came with a plan to get people making examples for shoebot. Luckily Ricardo had done a lot of this sort of thing before so did most of the talking, then I showed off some bots - evolution, spirals and also the livecoding work. Overall the workshop seemed to go over well; we got a bunch of examples, and there was even a plugin for sublime text !

Things that came out of the workshop:

People want an integrated editor - this is OK, since the IDE still exists. Differences between the Nodebox/Shoebot API and Cairo are not always intuitive. Livecoding is cool! Shoebot 2 ... or something else ? Going forward, it might be best to take the Nodebox approach and build something new based on these lessons, I'm not sure exactly what yet. What is the most intuitive API, how can we be close to standard APIs.

Non Shoebot Stuff

Outside of the workshops and talks there were plenty of time to drink and chat - apart from talking the head off of one of the mypaint guys I learned quite a lot about OSP off Sarah Magnan and Brendan Howell .. which made me regret missing many of their talks, including Brendans on the screenless office. Leipzig was a really great city to visit, the venue for LGM was particularly impressive being inside an old church that the East Germans repurposed to a university. Importantly for me I learned about the "kebab circle" - the ring of gentrification moving from the inside of the city outwards (beyond which you can still buy kebabs). With any luck LGM will be able to make it next year and meet everyone again.

Drawing to the same content to many windows, cairo and zeromq

Playing with python, zeromq and Gtk, I made this code to send graphics commands to several windows. Commands are sent over a zeromq PUB socket, the windows recieve them using zeromq SUB. Only a few commands are wrapped as it's a proof of concept. I'll clean it up and abstract some bits and it should be quite easy for building something like a live coding environment. Screenshot from 2013-06-15 19:19:37 See below for code - [UPDATE] Posted code to github, update to work with multiprocessing. https://github.com/stuaxo/zeromq-gtk-playground [/UPDATE] (more…)

Shoebot experiment – perlin noise..

Perlin noise is pretty cool, you can use it to generate realistic looking clouds or mountains. Here's a bot for shoebot I made a while back that uses perlin noise to generate some nice circles. You'll need shoebot and the lib "noise" installed into your environment for it to work;
# pip install noise
Then to run;
sbot -w perlin-circlescape1.bot
Here's a video of them in action - See below the break for the code - (more…)

Moving things in shoebot – simple particles…

OK, part 3 - now for something fun - extending parts 1 + 2 into a simple particle system. Particles, generally means - a lot of things moving around (the particles) and a way to generate them, an "emitter" Here we're going to take the code from the previous two parts and add a couple of things to make a basic particle system. Note - shoebot, isn't the fastest; but we do get nice looking results. Here's a video of our arrows as particles (arrowsplosion!): (more…)

Moving things in shoebot, adding different behaviours..

In my last post we made an arrow move around the screen, in this post we'll look to extend things so it's easy to make many things move around the screen. This will make the code a little more complex, but as usual it makes things simpler later on. Note: This python code runs in shoebot, planar.py is used to handle coordinates https://github.com/shoebot planar.py At the end we'll have two arrows, a blue one controlled with the keyboard and a pink one that moves on it's own: (more…)

Natural movement using polar coordinates in shoebot

Here's a little shoebot bot to experiment with natural movement. This uses polar coordinates to decide the direction and velocity of an arrow on the screen. Polar coordinates mean we can give an object a sense of 'forward', 'back', 'left' and 'right' The code below works on the current version of shoebot https://github.com/shoebot/shoebot.git With planar.py to handle the directions and velocity https://pypi.python.org/pypi/planar (more…)

Adding files to the django auto refresh

Django runserver and the app django-autotest are both good as they'll restart when modifcations are made to files in the app they will restart, however not *all* files will trigger a restart. Wanting to get some other files noticed, I added some in the __init__.py of my app, so it looked like this:
    from django.conf import settings

    if settings.DEBUG:
        import forms, util, tests
This seemed to be working fine until I swapped to postgres and tried to do syncdb .. and reset, uh oh ! Postgres said (names changed to protect the innocent):
2012-05-10 09:47:57 BST STATEMENT:
                    SELECT c.relname
                    FROM pg_catalog.pg_class c
                    LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
                    WHERE c.relkind IN ('r', 'v', '')
                        AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
                        AND pg_catalog.pg_table_is_visible(c.oid)
2012-05-10 09:47:57 BST LOG:  could not receive data from client: Connection reset by peer
2012-05-10 09:47:57 BST LOG:  unexpected EOF on client connection
2012-05-10 09:49:14 BST ERROR:  relation "sandwich_maker_filling" does not exist at character 72
2012-05-10 09:49:14 BST STATEMENT:  SELECT "sandwich_maker_filling"."id", "sandwich_maker_filling"."name" FROM "sandwich_maker_filling"
2012-05-10 09:49:14 BST ERROR:  current transaction is aborted, commands ignored until end of transaction block
And django wasn't too happy either:
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
  File "/home/stu/.virtualenvs/the_app/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
  File "/home/stu/.virtualenvs/the_app/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
  File "/home/stu/.virtualenvs/the_app/local/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/stu/.virtualenvs/the_app/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/home/stu/.virtualenvs/the_app/local/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/home/stu/.virtualenvs/the_app/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 60, in handle_noargs
    tables = connection.introspection.table_names()
  File "/home/stu/.virtualenvs/the_app/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 896, in table_names
    return self.get_table_list(cursor)
  File "/home/stu/.virtualenvs/the_app/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/introspection.py", line 33, in get_table_list
    AND pg_catalog.pg_table_is_visible(c.oid)""")
  File "/home/stu/.virtualenvs/the_app/local/lib/python2.7/site-packages/django/db/backends/util.py", line 40, in execute
    return self.cursor.execute(sql, params)
  File "/home/stu/.virtualenvs/the_app/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: current transaction is aborted, commands ignored until end of transaction block
In the end the solution was simple, just check for the args where we need the refresh to happen automatically:
## Automatically reload when forms or tests changed
    from django.conf import settings

    if settings.DEBUG:
        import sys
        if sys.argv == ['manage.py', 'autotest'] or sys.argv == ['manage.py', 'runserver']:
                # Need to check params as otherwise this can break syncdb, reset and
                # Friends !!
                import forms, util, tests
Hopefully this will be helpful to somebody with a similar error or that wants autotest or runserver to see more files.   This article was particularly helpful in debugging this:  debugging django syncdb

Cairo with python Ctypes

Uploaded some experiments with python and ctypes to here: https://gitorious.org/pycairo-ctypes/pycairo-ctypes   This is a really rough proof of concept that the pycairo API can be implemented with ctypes + metclasses.     So far only ImageSurface is supported on the SVG backend, along with Contexts.   The nice thing about this is that you can use a pycairo like API on pypy, where things should be faster (in theory).   There's a test that can be run to show the outputs the same for pycairo and cairo ctypes.