It’s been a while since the last update. Here’s a small update on what I’m thinking about various stuff.
Gameplay is okay I guess. Nothing I would spent too much time on though. It looks a lot worse than GTA 4 though (same as Crackdown).
Seems to be lots of fun and some nice graphics, too.
Some weird texture filtering issues and the presentation doesn’t knock off my chair (terrain popping and other ugliness), but multiplayer is loads of fun with friends. Physics isn’t completely stable though. I played the game for one hour in MP with friends and there were quite a few cases where geometry dropped through the floor with enough pressure from above (after destroying a building).
A bad and quite stupid movie (Ali G in Da House is probably the only movie I kinda like that stars Cohen). If you haven’t watched it already, don’t >_<
I bought shadow complex a few weeks ago and I have to say that it is an awesome game. I read somewhere that the developer used the Metroid series as inspiration and it shows. It’s really fun to play and quite addictive. The graphics are pretty awesome (it is using the Unreal 3 engine) and the whole presentation is pretty polished. It certainly is worth its 1200 gamerpoints
A month ago I was doing some exercises in an analysis book (Königsberger) and found a nice/interesting problem:
Prove that if we denote of the sum of the numbers 1 to n to the p-th power by
, then the following equation by Pascal holds: 
It can be used to get recursively/iteratively get formulas for sums of higher powers of numbers.
This is interesting because the proof doesn’t need any advanced maths (like eg the Euler-MacLaurin formula, which can be used to show this, too).
You can download the proof and a few examples here.
Cheers
Some time ago somebody stole 1 million data records from StudiVZ, the German Facebook clone. I’m not exactly sure why people call the person a hacker who stole data, because it appears he simply wrote a tool that harvested the publicly available data from StudiVZ (which everyone with an account can view).
People on StudiVZ share all their data by default—contrary to Facebook which values a person’s private data a lot more. Thus by simply opening each profile from a dummy user and processing the HTML data from StudiVZ one can extract a lot and some more information from random people who probably don’t even know about it or don’t care.. so I’m not sure about the stealing part.
Apparently there are some captcha’s when you start browsing searches beyond a few pages. I guess that is where the hacking part comes in, because getting around a captcha probably constitutes hacking—maybe?
Anyway I think part of the media coverage is a bit ridiculous because anyone can write a simple harvester in an hour or two. It took me one and half hours, so I think I’m on the safe side with this estimate and I didn’t really have a clue about this stuff before either.
Since I don’t want to “hack”, I’ve only written a very tame harvester. It connects to your personal StudiVZ account, and retrieves the name and profile ID (and thus profile URL) of all your friends in the “Meine Freunde” pages.
It could do a lot more with that like retrieving everybody’s birthday or random pictures, but I’m too lazy to code that because you use the same pattern for extracting data over and over again and it stops being interesting quite fast.
You can download the project here. It is a one file C# project. I’m releasing it under GPL (whatever).
It’s really easy to explain how it works:
The code is quite ugly. Well, it’s not production code and this is only meant as a proof of concept.
Also note that I have at most violated the AGB of StudiVZ and not committed any criminal acts and I’m not planning to sell my friend’s profile IDs or data either
Maybe someone can extend the code and make it more useful. I guess it would be fun to automatically download all your pictures (including tags) and feed them into flickr or picasa… but someone else can do that.
Cheers,
Andreas
Tags: Profiles, Regex, StudiVZ
For the last two months I have been working on my bachelor thesis at the Chair of Computer Graphics and Visualization. It is about “Multi-Tile Terrain Rendering with OGL/Equalizer”´.
The chair has a very nice Direct3D 10 terrain rendering engine and they want to run it at the newly founded KAUST (King Abdullah University of Science and Technology´) in a massive CAVE environment. A CAVE is a room whose walls are actually screens.
The CAVE at KAUST even supports stereoscopic rendering. Thus in total 12 views can be rendered to.
My job was to port said terrain engine from Direct3D to OpenGL and afterwards to the Equalizer framework, which is an open-source framework for parallelizing OpenGL applications.
You can find/download an online version of my bachelor thesis here. I’ll upload the LaTeX at a later date and update this post.
I’ve spent the last months writing about all this, so I don’t feel like talking about the thesis itself anymore. Instead the remainder of this post will contain a post-mortem of it.
(more…)
Tags: Bachelor Thesis, Equalizer, Inkscape, LaTeX, Omondo, OpenGL, TikZ
I’ve already written about the semi-conductor project and how I’ve written some Flash animations/applications for it. Of course, I’m more interested in making fun stuff´, so I decided to put my knowledge to good use and write a small game to see how difficult/awkward Flash actually is.
To sum it up, it is somewhat awkward, at least if you use the IDE itself. FlashDevelop still is as nice as ever, but you can quickly develop games nonetheless. I prefer Torque Game Builder though in retrospect.
Before I continue talking about the development itself, let’s take a look at the actual game. Sploidz was the first game I wrote using Torque Game Builder for Joshua Dallman, and since I still had all the assets in my subversion repository, it was an easy decision to try and port this game. If you want to play it, you can download it for free here.
I haven’t ported everything: I’ve just rewritten the main characteristic features that make up Sploidz’s code in ActionScript.
Without further ado´ here is the game:
Click to open Sploidz in its own window
Because the art is still copyrighted and I haven’t heard back from Joshua yet ´, I decided to create a free version that only uses “coder art” – in this hand-drawn coder art
Some´ have said that this version looks cuter, decide for yourself:
Click to open SploidzCC in its own window
Below you’ll find a description of the development and at least one helpful trick and most importantly a link to the source code of the “copyright-free” version.
Because the orginal version is way too difficult to be really fun, I actually sat down one more time and added code to make the platform slower if you’re in danger of losing (up to 3 times slower):
Click to open SploidzMoreFun in its own window
Tags: ActionScript, Flash, FlashDevelop, game, Photoshop, Sploidz
I’ve finally finished Pattern-Oriented Software Architecture – A System of Patterns and I want to say a few words about it.
First I don’t think, it’s a must-buy. It’s okay to read (but more about that in a minute) and certainly it can come in handy to look up patterns while developing, but if you have small budget, it’s better to get it from a library.
The book can be roughly divided into 4 parts: architectural patterns, design patterns, idioms, “trivia”.
The chapter about architectural patterns is the most interesting, where as the chapter about design patterns is okay, too, but also borrow or expands upon lots of concepts from the GoF book. The idioms chapter only contains one idiom (think small, language-specific “design pattern”, e.g. reference counting in C++).
The “trivia” part contains information what pattern are, who came up with the idea, influences, the community, yada yada. The most interesting topic being the community and links in there.
The book itself is quite boring to read and the patterns are described in endless detail, which is good, if you want to look things up and avoid common mistakes. On the other hand this makes it a book, you should not read front to back, because it doesn’t really make sense and you won’t get a lot out of it either. (I actually read it front to back, and from that experience I draw my advice
) Just skim over the patterns, until you find something you don’t know and then read the paragraphs that are interesting until you think you understand the pattern and then read some more to verify that you really understand it, but you can probably skip 40% (or more) of the text, if you just want to learn about new patterns and not go into all the details.
Next I’ll try to write a few words about each pattern (so I´ can look up the pattern here instead of in the book)´.
Note: I just found an awesome page, http://vico.org/pages/PatronsDisseny.html, that contains information about all patterns in the book, so it doesn’t make sense for me to write about each and every one of them.
Now that I’m done with this, I want to share a few useful resources mentioned in the book:
Personally idioms are very interesting for me, too, because the day-to-day coding work is in a specific language and idioms are exactly about that.
A little googling already turns up lots of useful sources. For example:
There are a few more pattern books that I plan to read, so let’s see how that turns out..
This is an awesome book, that explains a lot about how to write research papers and also about all the little details you should pay attention, too. It’s a good read – I spent 1.5 hours a day for a bit more than a week to read through it – and I think it’s going to be quite useful, when I start writing my Bachelor Thesis in a few days.
I’m currently writing some ANTLR grammar and StringTemplate stuff and I might write something about that, too, on the weekend.
I’m not sure I’m really happy with ANTLR, but it’s probably the best thing out there at the moment, but I’m totally in love with StringTemplate, even though you might say it has some rough edges, too.
But more on that on another day.
Over and otu,
Andreas
Tags: Chicago Manual of Style, Design Patterns, Gang of Four, Idioms, Pattern-Oriented Software Architecture
Because people complained to me about the formula feature in my PowerPointLaTeX add-in, which used a somewhat experimental approach to editing formula objects by adding an editing text shape that contained the formula code and that would be merged back into the formula as soon as you deselect it, I decided to rewrite it to use a standard modal dialog to edit formula objects:
The editor isn’t perfect (yet), but it certainly shouldn’t add any bugs to the add-in and solve some natural issues the old approach created.
The idea was pretty straight-forward but the actual UI design was a PITA due me not knowning the panel/flow/table layout concepts very well and the code still has some annoying quirks with auto-scroll, so I need to fix that later.
I almost rewrote the whole cache system, because I’m using a background thread for updating the preview (if the text is changed, a 500 msec timer is started which triggers an update) and the update accesses the cache system, which in turn accesses PowerPoint to return some data, which in turn is busy because of the modal dialog -> dead-lock.
The solution to this is very simple but was not obvious to me at first (I actually began to rewrite the cache system with a feeling that there should be an easier solution):
The background thread needs an Invoke call to update the preview picture because the control has been created by a different thread (the main thread) and the code to get an updated picture can simply be moved into Invoke delegate function.
This solved all my problems and made 4 hours of previous work and thinking about a new cache system obsolete
Download the new build at: http://code.google.com/p/powerpointtools/downloads/list
Cheers,
Andreas
Tags: Formula Object, Invoke, LaTeX, PowerPoint
I’ve written my last exam yesterday (except for two oral exams in September), so now I have got some spare time before I start working on my Bachelor Thesis tomorrow and I want to use it to wrap up a few things.
During this term I took part in a course that was both a (research) project/presentation/lecture thing, which was fun but also a lot of work.
I’ve already written about one mathematical aspect of it in my post about Analysis, Cauchy-Schwarz and Reciprocal Sums.
The project was about optimizing semi-conductor wiring placement. We wrote a small paper about our findings and the work it was based one – you can look download it here.
We also created a self-running presentation that doesn’t contain any Maths at all but makes heavy use of Flash animations (which were exported to .gif manually, which was a huge pain in the ass, which I will never do again if possible) to visualize all the concepts and algorithms.
You can download a PowerPoint 2007 (.pptx) version here or one that works with PowerPoint 2003 here.
For the Student’s I sat down and wrote a small Flash application to show the algorithms at work. It’s not obvious how it works, so let me explain the major points:
Last but not least I’ve also uploaded the current version of all my .fla and .as files. You can download it here.
ActionScript is a nice language and you can quickly learn it using the available resources from Adobe.
While ActionScript 2.0 is arguably weird, ActionScript 3.0 is quite logical and it’s syntax is straight-forward and consistent, too. You can’t say that about the IDE (Flash CS4), which is braindead, but if you’re only interested in writing ActionScript code, FlashDevelop is an excellent and free alternative.
This is it for now, maybe I’ll play around with Flash some more another time.
Cheers,
Andreas
Tags: ActionScript, Flash, MatLAB, PowerPoint, Semi-Conductor Optimization
At my new workplace at university I’m currently porting an advanced terrain rendering engine from DirectX to OpenGL.
One of the performance optimizations the engine uses is that it draws the terrain tiles right from the index buffer without using a vertex buffer at all – that is it packs the vertex position into the 32-bit index and unpacks it in the vertex shader.
Why is this faster than rendering using a vertex buffer and no index buffer?
When using an index buffer the graphics card can make use of a cache of already transformed (vertex-shaded) vertices and when an index is reused, it can use the cached result instead of running the vertex shader again. Of course, this only works if there exists a certain temporal locality, but that is given.
If no index buffer is used, the vertex cache won’t be used, because the implicit index is different for each vertex.
Since I need to port the engine from DirectX to OpenGL, I did some research to see if it is possible to do the same in OpenGL.
It’s not really possible but you can achieve something quite similar in OpenGL 3.0.
This is meant as OpenGL analogon for Using the Input-Assembler Stage without Buffers (Direct3D 10).
I think the title is self-explanatory but for greater clarity let me rephrase it:
The aim is to render something without using vertex or index buffers, that is (in OpenGL speak) using neither vertex data nor an elements array to render something.
Instead the automatically supplied gl_VertexID attribute (vertexId in DirectX) is used to determine the vertex the shader is currently processing.
The example in MSDN simply draws a triangle using vertexId:
VSOut VSmain(VSIn input)
{
VSOut output;
if (input.vertexId == 0)
output.pos = float4(0.0, 0.5, 0.5, 1.0);
else if (input.vertexId == 2)
output.pos = float4(0.5, -0.5, 0.5, 1.0);
else if (input.vertexId == 1)
output.pos = float4(-0.5, -0.5, 0.5, 1.0);
output.color = clamp(output.pos, 0, 1);
return output;
}
If you want to do the same thing in OpenGL, you have at least two problems:
(from GL_EXT_gpu_shader_4)
There is no way around these requirements, but what you can do is to create dummy vertex buffer with one element, bind it as vertex array and simply draw as many vertices as you want. If you don’t access gl_Vertex there is no way that uninitialized data can affect the shader and although behavior is generally undefined in OpenGL, if you render beyond the vertex buffer size, it has worked so far that I’ve test this on.
You can download the source code here.
The next step is to start packing and unpacking data in the gl_VertexID. For this an integer type and bit operations (shifting and masking at least) are required in the vertex shader, so it requires GLSL 1.30 at least.
The code is quite short from my proof of concept project, so I’m pasting the shader here:
#version 130
#extension GL_EXT_gpu_shader4 : enable
out vec4 color;
vec3 unpackVertex(int index) {
return vec3( index & 0xFF, (index >> 8 ) & 0xFF, (index >> 16) & 0xFF ) * (2 / 255.0) - vec3(1.0);
}
void main()
{
vec3 unpackedData = unpackVertex( gl_VertexID );
gl_Position = vec4( unpackedData, 1.0 );
color = vec4( (unpackedData + 1.0) / 2.0, 1.0 );
}
In main.cpp the equivalent can be found for setting up the elements array:
#define packFloat(v) (int(((v) + 1.0) / 2 * 255) & 255)
#define packVertex(x,y,z) (packFloat( x ) + (packFloat( y ) << 8 ) + (packFloat( z ) << 16))
void display(void) {
[...]
unsigned indices[] = {
packVertex( 0.0, 0.0, -1.0 ), packVertex( 1.0, 0.0, -1.0 ), packVertex( 1.0, 1.0, -1.0 ),
packVertex( 0.0, 0.0, -1.0 ), packVertex( -1.0, 0.0, -1.0 ), packVertex( -1.0, -1.0, -1.0 )
};
glDrawElements( GL_TRIANGLES, sizeof( indices ) / sizeof( *indices ), GL_UNSIGNED_INT, indices );
[...]
}
For the code to actually make sense I should initialize an index buffer/elements array buffer in OpenGL and upload the indices into it but this was just for testing.
You can download the source code here.
PS: Wordpress is incredibly annoying – or rather this stupid SyntaxHighlighter Evolved plugin >_<
Tags: DirectX, no vertex buffer, OpenGL
I’ve quite a few things I’ve wanted to write about a long time ago and I actually started working on them and taking notes, etc. but never found time for one reason or another to write and publish the actual posts.
So this is meant as fast forward of all these text bits.
One awesome movie. I’ve seen it twice already and I still love the movie and its plot. I don’t want to spoil too much of the story, but some will probably inevitable.
A few bullet points:
Fahrenheit is a pretty cool. Like many movies it is excellent for 90% of the playtime and then it suddenly starts to suck and/or becomes very weird story-wise.
It’s not a typical game as more a cinematic experience that does a good job at combining gaming aspects with a very advanced plot and some pretty awesome action scenes.
I’ve really enjoyed the game and just like Omikron: The Nomad Soul (an earlier game by developer Quantic Dream) it’s positively refreshing and different.
Some random notes:
Last year I think I wrote that I had started reading “The Pragmatic Programmer“. I actually finished reading it quite a while ago, but here are a few remarks about it:
I’ve bought the “OpenGL Superbible” and it’s a pretty good book if you want to learn OpenGL or read a light text about certain advanced OpenGL features before rolling up your sleeves and digging around in the extension specs. It’s written like a big and pretty complete tutorial and the latest edition is a lot better suited for the new features than, say, the latest edition of the OpenGL Programming Guide (which is pretty horrible – I’ve read through the sixth edition and it’s pretty much the second edition plus a paragraph tacked on here and there and long explanations of deprecated features).
The only part of the book that is really, really weak and totally useless is the part about GLSL and shader programming. It contains a short description about GLSL and while the chapter summary mentions functions like glUniform and co, the function is not mentioned anywhere in the chapter nor does it provide even one example on how to set or access vertex attributes or uniforms, which is essential.
If you want to learn about GLSL and shader programming in OpenGL I can only recommend the OpenGL Shading Language and the GLSL language specifications.
First don’t buy this book. It’s from Intel Press (you can read the book description here) and it’s ridiculously expensive for the content it provides.
I got it for free at university presentation from Intel and have read through most of it in the last weeks and really – if you want to learn about OpenMP and threading techniques and tools, there are better sources available online for free.
This book on the other hand is awesome – buy it if you are interested in computer graphics and want to understand the underlying principles better.
It’s well-written and presents lots of advanced computer graphics topics in a very understandable way. Especially the chapters about local and global illumination and the physical base of them are very good. It is good starting point to look for resources and papers and the book’s homepage is also pretty useful: http://realtimerendering.com/.
Tags: Fahrenheit, Memento, Multi-Core Programming, OpenGL Superbible, Real-time Rendering, The Pragmatic Programmer
Today I want to write about something I’ve been working ages ago – specifically in March I wanted to see if I can extend a Java compiler to support LINQ´ expressions, too.
I probably spend more time on finding a good open-source compiler to experiment with than I later spent on trying things out, so let me share my preferred source with you: http://openjdk.java.net/ is a good address to start with.
More specifically http://openjdk.java.net/groups/compiler/ contains some valuable information about the way the compiler works.
A nice thing is that there is a branch that has added support for ANTLR which makes added language a tad bit easier since you get to change a grammar file instead of tweaking hand-written lexers and parsers. More info about it can be found at http://openjdk.java.net/projects/compiler-grammar/.
You can download the source code from http://hg.openjdk.java.net/ – don’t follow the link to http://hg.openjdk.java.net/compiler-grammar/compiler-grammar, that one will only allow you to download part of the branch´.
I didn’t come around to add support for LINQ in the end, but to get known to the compiler and the ANTLR grammer, I added support for the var keyword as known from C#, which allows for automatic type deduction and for anonymous objects (again using the C# syntax). Thus my changes allowed for the following to compile and execute correctly:
public class Test {
public static void main(String[] args) {
// automatic type deduction
var t = Math.atan(1);
System.out.println( t );
// anonymous type
var i = new { Amount = 108, message = "hello" };
System.out.println( i.Amount );
}
}