SafeDrive project

A project written in Javascript with a Phaser framework (http://http://phaser.io/).
A presentation is showing dangerous/illegal traffic situation according to the Polish traffic law.

Project is published here: http://skobo.pl/safedrive

Source code: https://github.com/adamskopl/safeDrive

All graphics by Anna Skobodzińska (http://anna.skobo.pl, anna@skobo.pl).

Nothing more to add : ).
Just start clicking.

(it’s best to test it here): http://skobo.pl/safedrive

Cubicforest: progress report and gameplay rules.

A little report on my work on Cubicforest.

Unfortunately from the beginning of October my life was completely upside down to the end of December and I couldn’t find time and energy for continuing the project. But I will start new commits soon.

Last time I was working on levels resolver. Being surprised by the number of combinations of the possible game courses, I’ve realized, that a class solving levels is necessary.

Let’s say we have a simple level:

cubic_example.png

The rules of Cubicforest are as follows:

  1. Player is moving to any accessible tile, having 3 points of movement. Player can end its movement with building an item.
  2. After player the enemy’s movement is taking place (3 points of movement also). It’s AI is simple to pain: every enemy, one after one, is moving to end on a tile nearest to the nearest hero.
  3. Player loses if enemy ends its movement on a Player’s tile and wins if every Player’s character has ended movement on a Portal item (which has to be built by a player).

Getting back to the example. Player can end movement by putting one of 2 items or none of them. So the combinations for turns are:

  1. Player’s first turn: player can move on 7 tiles (including the one he’s starting from). He can also put items, so it gives 21 choices on a first turn (7 tiles to move, plus we can put on every tile an item – 7 + 7*2 choices).
  2. Enemy’s first turn: Enemy can move 3 tiles, so if player moved in a first turn more than 2 tiles away, he will loose. Otherwise the game continues.
  3. Assuming that player has not lost, the number of possible choices in a player’s first turn shrinks to 3 fields, so with items we have 3 + 3*2 = 9 choices. Player places a trap, so level after enemies movement could look like this:

    cubic_example_turn2.png

  4. Now if player wants to live, he has to move somewhere else. In the next turn enemy will follow its pray, and he will meet a trap and disappear. Player has 3 fields where he can move, plus he can put a portal item (which gives him a victory). So: 6 choices.

With this simple example we can see, that coming up with level riddles is a complicated task, because of the number of available choices in every turn. In above example in first turn player has 9 valid choices, and then 6, or 15 or another number, depending on chosen field and item options. So it gives (very approximately) 54 choices in only two turns. And this is a very simple level, with only 1 player character and one enemy.

Conclusion: testing Cubicforest levels it’s very time consuming. It’s better to be willing to sweat and program a tool, which will check if it’s event possible to win designed level.

Having 60% of the resolver done, I’ve used Memento design pattern, to remember level’s every possible objects combinations and to recover any game’s state. In this way Resolver class is looking for every possible combination of player’s moves, but only to some level. I want maps, which can be solved in a reasonable number of turns.

Little demonstration of the current version with commentary:

Buildings editor

Project from 2011 written as a Bachelor thesis.

Project’s goal was to create program allowing to quickly define 3d urban spaces and to explore them in a Java applet (it was a second program called CityCube allowing to move user’s avatar through the building).

Buildings data is created by defining floor sectors, which can be enriched with walls, windows and connected with stairs or doors. Data can be exported to XML and loaded by CityCube, where is rendered. Building’s structure allows to explore created space in a logical way, by creating paths between any building’s sectors. E.g. user’s avatar can look up for a specific room and program will calculate the shortest path by connecting nodes, which lays on every sector’s border and on edges of the doors and stairs. In this way avatar can travel through created path.

Program’s mascot is a little pig engineer:

montage.jpg

Video presenting designing process (should be wathced with 720p HD):

Tangbang

Project from 2010 written for educational purposes.

Continue reading “Tangbang”

Code was used to present basics of games programming during classes of an academic circle about programming games on a Białystok Technical University.

Covered topics: generating OpenGL graphics; using SDL for input, window system and sound; collisions detection; simple AI.

https://github.com/adamskopl/tangbang

https://www.youtube.com/watch?v=M03VRuG0qH0&feature=youtu.be

Recording application video with sound: Alsa + Recordmydesktop

How to capture video from an application with the sound?

Continue reading “Recording application video with sound: Alsa + Recordmydesktop”

Don’t know if it’s by default, but in my Xubuntu, only a sound from the microphone can be recorded. This link came with help: https://trac.ffmpeg.org/wiki/Capture/ALSA. How to do the same with a recordmydesktop application:

  1. Create .asoundrc file in Your home directory like in mentioned webpage:
    # .asoundrc
    # uncomment to record audio from applications. uncomment afterwards to
    # restore default Alsa settings:
    # pcm.!default { type plug slave.pcm "hw:Loopback,0,0" }
    

    When the last line is uncommented, there will be no sound for every application launched from that moment, because generally it’s redirected to the recording output.

  2. Load the snd_aloop module:
    modprobe snd-aloop pcm_substreams=1
    
  3. Launch an application, from which the video will be captured. Check it’s window id with xwinfo and by pointing application’s window:
    xwininfo | grep 'id:'
    
  4. Invoke recordmydesktop with hw:Loopback,1,0 as a sound device. PID will be needed to send signal to stop recording (‘& echo$!’)
    recordmydesktop --windowid [application wid] --device
    hw:Loopback,1,0 --v_quality 45 --s_quality 7 --overwrite & echo $!
    
  5. Stop recording by sending SIGTERM signal:
    kill -s SIGTERM [recordmydesktop PID]
    
  6. Uncomment line in .asoundrc file to restore Alsa settings.

Cubicforest: using Tiled

In a second post I was writting about creating my own level editor. A lot has happended since then (thank You reality, You’re a perfect teacher): games is being written in Java using http://libgdx.badlogicgames.com/ right now and for editing levels I’m using Tiled editor http://www.mapeditor.org/.

I’m very happy from that solution. Level is exported to Json.

Loading done with gson https://sites.google.com/site/gson/gson-user-guide. Just a few classes reflecting Json’s file structure and I was ready to go…

public class TiledMap {

	private Integer width;
	private Integer height;
	private Integer tileheight;
	private Integer tilewidth;
	private List<TiledLayer> layers;
...
public class TiledLayer {

	private String name;	
	private Integer height;
	List<TiledObject> objects;
...
public class TiledObject {

	private Integer gid;
	private String name;
	private String type;
	private Integer x;
	private Integer y;

What’s interesting: loading is done with one line!

public class MapsLoader {

	TiledMap tiledMap;
...
tiledMap = new Gson().fromJson(mapFileString, TiledMap.class);

… and TiledMap class is filled with a data about designed level

Project’s repository: https://github.com/adamskopl/cubicforest-java.

Tiled editor:

tiled.png

Level loaded in a game:

tiled-cubic.png

Mass e-mails: avoid being marked as a spam.

For four months now I’m volunteering my time at Uniwersytet Dzieci organization (a child university). Amongs the others I’m helping in running lessons about the Blender software. Lessons are crowned with a show, where students can present their new skills. After organizing students mailing list I’ve encountered some problems.

Continue reading “Mass e-mails: avoid being marked as a spam.”

The problem

I’ve gathered more than 40 emails to write to students about their roles in the show. I’ve created a couple of mailing lists, e.g. the list including all of the students. First mail was composed by adding this list as BCC to make addresses private. On the last lesson I’ve realized, that Gmail users had not received my mail, while students with addresses from other domains did.

The reason is unknown, but I’ve searched the web and have found some clues:

  • filters can reject mails, where receiver is in BCC
  • filters can reject mails if there is a big number of receivers
  • filters can reject mails if the server had received a big amount of messages from one address in a short period of time

I’m not completely sure if above statements are true (it was a quick search throught the forums), but none the less, Gmail was rejecting my mass messages, while individual written mails were delievered.

The solution

Thunderbird Mail Merge add on.

I’m composing mails from mailing lists as always, but instead messages are sent:

  • individually (just like I would send mails one by one)
  • in a 10 seconds intervals

I don’t know if this solves a problem, but I’m sure that there is no more I can do to avoid spam filters. Because in the end: Mail Merge is doing the same job, as if I would compose 40 emails one by one.