Archive for Kolf

Kolf, Palapeli: Total change of course

What’s a clear sign of craziness? Scheduling a project to be finished in two weeks, and then completely rewriting it.

Long story short Short story long: I’ve noticed that I’ve (effectively) only seven to eight days left until university courses start again. This is not enough time to get Kolf 2 into a state that allows us to release it. The editor is (from a user’s perspective) nearly useless (though many important foundations have been laid), the terrain has weird collision bugs (I hoped that these problems stop with usage of an external physics engine *sigh*), we’re lacking good textures and of course courses (pun intended).

So, we’ve (more or less) decided to not release Kolf 2.0 with KDE 4.4. I’m not sure about when Kolf 2.0 will first appear. We might do some preview releases before the KDE 4.5 alpha/beta cycle starts, but that has not been decided yet.

Instead, I’m doing something that could be achieved in seven to eight days of intense work. Some months ago, I wrote libpala, a new library as a foundation for Palapeli (my jigsaw puzzle game). Unfortunately, libpala is so different from the old libpalapelibase that I effectively have to rewrite the whole game. Still, this task is much easier than getting Kolf 2 ready, and I’m confident to get everything finished in time to get Palapeli included in KDE 4.4.

Leave a comment »

RFC: Texture range selector design

Here’s your chance to help KDE: I need some quick opinions on the design of a widget, for which I’ve made a mockup.

Basic situation: Kolf needs a new configuration interface for its texture blender. The task of this texture blender is to create a texture for a given heightmap. It uses several base textures and inserts these base textures into the result at different height ranges. For example, low heights might be painted with a water texture, medium heights with a grass texture, and high heights with some stone texture. That’s what the interface looks like currently:

Current state of the texture blender (click to enlarge)

Current state of the texture blender (click to enlarge)

On the left side is a list of all base textures. Each base texture has three values (out of a range from 0 to 255, where 0 is the lowest height level, and 255 is the highest one). The left and right value are the minimum and maximum height where this base texture is used. The middle value is the height where the base texture is inserted in the texture in a completely unaltered manner. (I call this “median height” from now on. Above and below this height, the texture is darkened and lightened to create a depth impression.) Everyone here should agree that this configuration interface is completely obscure (would you have guessed that you have to click on the textures to edit these heights?) and much too techy.

Gladly, one of our artists has proposed a new interface, and I have made a simple mockup (only for the left side, the texture preview at the right which will stay there):

Mockup for the new texture blender (click to enlarge)

Mockup for the new texture blender (click to enlarge)

This design is based on a layered “stack” of base textures (at the left). The higher a base texture is in this stack, the higher are the heights at which this base texture is used. One can drag the textures along the vertical axis to re-order them. The right side is the actual height range selection. The first, third and fifth marker stand for the aforementioned median heights, while the second and fourth marker denote the area where one texture is gradually replaced by the next one.

One special note: The textures on the left axis are not on the same height as the median markers on the right axis. This is intentional because this restriction might cause texture images on the left axis to overlap, which is something which I want to avoid.

Here is my RFC: What do you like and dislike this mockup? Do you have further ideas on how I can improve this interface? How should user interaction be implemented? I have some basic ideas for the last point, but am eager to hear your ideas and do not want to bias you. Apart from the obvious mouse interaction (i.e., dragging the base textures to reorder them, and dragging the markers to change the height ranges), the user needs to be able to add new base textures, and delete base textures from the stack. Also, keyboard control might be good for accessibility and convenience.

Comments (3) »

[RFC x 3] On property editors

Many of you may already have dealt with property editors. These are generic widgets that display properties of some object, and allow to edit them. I’ll also have to do one of these property editors for Kolf as an addition to the already available graphical interface, which can only be used to edit geometrical properties, not behavioral ones.

Of course, I want to reuse existing code to get Kolf ready soon, so I had a look around for other property editors. Below is a selection from what I found. The first one is the widget property editor of Qt Designer, the second one is used in Step (a physics simulator from kdeedu) to display and edit the physical properties of some body, and the third one is from Rocs (a graph-editing application which Tomaz Canabrava is working on).

propertydialogs-qtdesigner

propertydialogs-step

propertydialogs-rocs

As you can see, each of those editors looks (and probably also behaves) differently. This indicates that there is no library-based generic property editor. This is the first RFC: Am I wrong? Is there a generic property editor widget somewhere in Qt or kdelibs? And before I forget it, here’s the second RFC: Are there any other property editors which I’ve forgotten, and which might be worth to look at?

Now that the option of using a library-based property editor is out, it seems like I have to create one. And this means that more investigation about the pros and cons of the existing property editors is needed.

Let’s begin with the last picture. It is actually a detail from a screenshot that Tomaz published in a blog entry yesterday. In the same post, he indicated that this interface is “less than ok, it’s really ugly.” It’s easy to see that Rocs’s property editor is the odd one out in the above gallery. While the other dialogs use a single list/tree view to display all properties, the Rocs dialog uses widgets arranged in something that looks similar to a QFormLayout (though it also has a list view for something called “dynamic properties”).

Let’s move on: Step’s dialog is plain and simple. After my fancy, the structure is not totally clear because it contains too less lines. Step’s dialog also has something which only a physical simulation program needs: units. (Not visible in the screenshot: The unit disappears while editing the value.) In these two regards, the Designer dialog is the complete opposite: It uses colors and lines very extensively, can group properties (although only by class, not by type), can also add dynamic properties (the green plus button at the top), has sorting and filtering, and uses a tree model for complex properties. Qt shows off what can be done with its generic frameworks.

From these three samples, the Designer dialog is closest to what I want to have. I’m not sure whether the coloring is compatible with our HIG, and I don’t know whether it is possible to easily add support for own data types (which Kolf uses plenty of, because Qt’s geometry data structures cannot be applied to a 3D space). I haven’t had time yet to read into the code for these property editors.

Last but not least, the third RFC: Is anyone here interested to collaborate with me on a generic property editor dialog for KDE applications? I have the following requirements:

  • It has to read and write QObject’s meta properties, which requires it to cope with QVariant values and such correctly.
  • I need to be able to add support for new data types inside an application that uses this dialog, preferably in a very straight-forward manner.
  • Optionally, I would like to be able to group properties by type (e.g. “shape”, “position”, and “behavior” for Kolf objects).

Of course, this list can be extended to meet your requirements if you want to use this property dialog in one of your applications. If you’re interested, please get in touch with me. You should be able to find my mail address easily (e.g. in the license headers or in the about box of kdiamond, palapeli or kolf-ng).

Comments (16) »

Kolf: Internal cleanups and a new “New game” dialog

Over the last weeks, I’ve put together a new tiny component framework for Kolf, which degrades the main window to a kind of interface server where games insert their UI components. Today, I was finally able to kill all the old components and port everything to the new system. This is not exciting because it does not show off yet, but here’s something screenshot-friendly: I’ve killed the “New game” dialog and built a “New game” widget instead:

The new "New game" widget

As you see, all interface in Kolf is now concentrated in the mighty tab widget in the center (with the only exception being dock widgets). If a game is currently in progress, the “New game” widget also opens as a tab, allowing you to continue to play your game if you decide not to start a new game.

Comments (2) »

Code documentation is really important

One of the things I learned about during my continuing involvement in Kolf is the importance of code documentation. All of you will know user documentation (handbooks, tooltips, …), and developers know about API documentation. But developer documentation is also happening on a more abstract level. It doesn’t help if you understand what single functions do, if you do not get the big picture. How do these classes work together? And which class should I use in the code I’m working on?

These questions were exactly the ones I couldn’t answer when I was looking at the source code of Kolf 1. It might have been that I could get into it with enough time and will (it seems doable), but you see: Missing developer documentation raises the entry barrier.

I was enthusiastic to get proper, extensive documentation in Kolf 2. From the start, every class API has been documented (the obligatory lower level of developer documentation). Unfortunately, the high level documentation was going very slowly until last weekend. When I started to refactor some internals, I set the private goal to not proceed with the refactoring until I documented the last part. Currently, I’m working on documentation for the basements of Kolf, which look like this:

Class layout in Kolf 2 (cut-out)

Class layout in Kolf 2 (cut-out)

I would like to encourage every developer out there to write high-level developer documentation, to be sure that work on his code can continue even if he is not available anymore. Writing documentation is also a good opportunity for reflections on the class layout and the semantics of the classes.

P.S. You might’ve noticed that above graphics uses TeX fonts. It’s actually written in LaTeX (with PGF/TikZ), the sources are in SVN at trunk/playground/games/kolf-ng/doc (view in WebSVN), where the complete documentation is located (see the README for how to compile).

Comments (1) »

Kolf: Much progress, no screenshots

Yesterday, I had my last exam. Today, I broke Kolf. During this interesting experience, I managed to establish a new record: Revision 1001908 changed 66 source files (which is about the half of Kolf). I tried to break it into multiple commits, but it did not work out: I have refactored one of the central classes to not be a singleton anymore, thereby also shifting the semantical meaning of some related classes.

The result was like an earthquake: Although it happened at a quite distinct point in the code, it caused structures to fall apart everywhere. Now nearly everything is working, only the course boundary does not load properly. (I know what the problem is, but I’m too tired for the solution right now.)

The sad thing about structural changes is that the benefit is a priori only visible to the developers. I hope that the clear structure I’m building for Kolf 2 will help other developers understand it when I’m not available for maintenance anymore. Apart from that, some of the changes I’m making now allow for more interesting features to be added.

In other news, Kolf’s GSoC student Zeng Huan is working on the first bits of a heightmap editor right now. Again, it’s too early to show screenshots, but expect screenshots and more information to appear here over the next weeks.

Leave a comment »

Kolf: Creating a terrain texture, and the 4.3 release

A long time, I haven’t written about Kolf. I’m not having any time for coding lately, but Zeng Huan, our GSoC student, has made progress on the automatic generation of terrain textures. The code for that is not in Kolf at the moment, we have decided on him working on it in a separate test bed, the kolf-textureblender:

kolf-textureblender1

In other news (which might be more interesting for most readers at the moment), Kolf in KDE 4.3 is broken. The first hole of every course loads fine, but on the following holes, only one object will be displayed (which is definitely too less). Mauricio Piacentini looked into the code, but didn’t find anything. He meant it looks like Kolf is trying to re-use objects from previous holes, but some changes in Qt 4.5 seem to interfere with this technique very badly. If no one finds the bug quickly (which will likely not happen, as the code of Kolf 1 is a total mess), it is quite realistic that we will have to remove Kolf from KDE 4.3.

If this bothers you and you want to help Kolf return in KDE 4.4 as Kolf 2, please join our team! Write to the kde-games-devel mailing list for more information.

Leave a comment »

Kolf: Work on multiple fronts

For some reason, I did not update you about Kolf developments for nearly a month, though there is plenty progress: First, GSoC has started, and there is already first progress made by Zeng Huan, Kolf’s very own GSoC student: (It could be more, but we have to deal with internal issues like coordinate systems or how the OpenGL rendering will exactly work.)

First foundations laid for a terrain in Kolf 2

First foundations laid for a terrain in Kolf 2

I haven’t been inactive in the meanwhile. Apart from working with Zeng one the foundations of Kolf, I’ve polished the available bits of the editor interface a bit and added storage classes. I’m quite excited about these, even if the results are as unspectacular as Save and Undo/Redo buttons:

The new storage framework pays off.

The new storage framework pays off.

The exciting thing about the storage solution is that it adapts to any new kind of object. Next on my list of editor features is to make it store and reload the complete editing history, so that you can go back anytime if you made some change that turns out bad.

Now I do not know how to end this blog entry. Maybe I should just stop inside some word, to make it look mo…

Comments (5) »

Kolf: More editor interface (now with screenshots)

Last time I did not include any screenshots, but I know that only from screenshots derived a magical force called “buzz”, so here comes a screenshot of what I did this evening:

kolf-editorscreen2

First, note that the rectangle (which is in fact a cuboid block) appears in green, and the line at the right (a simple wall) seems to glow in a similar color. These are new interactors which I added to the editor interface. When you hover an object, a translucent overlay appears (like on the wall here). And when you click on this shape, the overlay will become more opaque, can be dragged to move the object, and more handles appear to manipulate the object’s geometry.

Second, please also note that the rectangle is rotated a bit. I was astonished how less changes were required in the Kolf codebase to make this happen.

Another usability improvement (though not visible here) is that objects cannot be shrunk below a certain size anymore. This prevents you from making objects so small that you cannot click them anymore. The creation of objects with an arbitrary size will become possible later when a property editor will be added.

In other news, I have quite detailed plans on how to implement data persistency in Kolf. That may not mean anything to you, but it means that we could have undo/redo and save functions in the Kolf editor very soon (perhaps by the end of the week).

Leave a comment »

Kolf: Quick updates on the editor interface

This is not only to SoC students: Think about the internal design of your project thoroughly. It may be hard sometimes, but it surely pays off.

For example, the design of the complete game engine in Kolf 2 relies on merely seven base classes and one helper class. The rest (two thirds currently, and counting) are specific implementations (e.g. Kolf::Object has subclasses for the rectangle block, the circle block, the wall, the hole, etc.). It has been quite hard in the beginning because it takes a while before you get results. In this phase, it certainly makes it easier if you like well-done generic algorithms for their elegance and compactness (like I do).

Considering the interaction between editor interface and game engine, this part seems to be done now for me. Today, I implemented mouse-based overlay activation (as in: when you click on an object, its editing overlay is shown, and any other overlays are hidden), and that took me only one hour of coding. As I said, coding becomes a breeze if you rely in good foundations.

More interesting from the technical side is the fact that games can now contain actions. For any readers that are not developers: “Actions” in Qt/KDE-speak define tasks that can be done. They are accumulated in the KActionCollection of a window and then converted into menu entries and toolbar buttons. This is done by the KXmlGuiFactory which belongs to the mainwindow. Now (and that is the interesting part) one can simply insert KXmlGuiClient instances into this factory to dynamically add or remove actions from the toolbars and menus (or even complete toolbars and menus). This allows you to adjust the toolbar and menubar layout very dynamically to your application’s current context.

The problem with both new features is that they’re not very visible on simple screenshots, so I’ll leave the screenshot out for now. Checkout kolf-ng from trunk/playground/games if you cannot wait.

Leave a comment »