Blog Posts

Only showing blog posts from the Computing category. Reset Filtering


GIMP Single-Windowed?

Posted On Thursday 14 April 2011 by Tom Leese (TomMan)

Although GIMP 2.8 is not out yet, its Single-Window mode is available for testing!

I have been using GIMP 2.7 for some time now and I much prefer the GIMP Single-Window mode.

BBCode-included image

It is still a little bit buggy in some aspects, for example, if you open a new dockable window it does not appear within the single-window mode, but I cannot wait till GIMP 2.8 is released!

You can follow the development of GIMP here: GIMP Progress Tracking

0 Comments

For(;;) a While(true)

Posted On Saturday 26 February 2011 by Freddie Nash (FredFace)

Incase someone is wondering, for(;;) and while(true) compile identically in CPP and C#. C# is my forte, so I'll demonstrate the intermediate code produced (the same) for each. Consider the following C# Code:


for (;;)
{
    if (threadBreaker)
        break;
}
while (true)
{
    if (threadBreaker)
        break;
}


Clearly, it represents two loops which will be broken out of when a variable (bool threadBreaker) is set to true (this is just give something to look at).

After moving each loop to a separate function and compiling (without optimizatins) the IL for the functions is identical, and thus:


  .maxstack  2
  .locals init ([0] bool CS$4$0000)
  IL_0000:  nop
  IL_0001:  br.s       IL_0013
  IL_0003:  nop
  IL_0004:  ldsfld     bool ConsoleTestGround.Program::threadBreaker
  IL_0009:  ldc.i4.0
  IL_000a:  ceq
  IL_000c:  stloc.0
  IL_000d:  ldloc.0
  IL_000e:  brtrue.s   IL_0012
  IL_0010:  br.s       IL_0017
  IL_0012:  nop
  IL_0013:  ldc.i4.1
  IL_0014:  stloc.0
  IL_0015:  br.s       IL_0003
  IL_0017:  ret


A quick skim will show up how very inefficiant this is - the need for a stored local variable alone is uncalled for, but it does show that the said variable is assigned the value true (IL_0013 onwards), but it is never compared to anything.

With oprtimizations, the code size is reduced dramatically, but oddly the maxstack is quadrupled in size. Both functions are again, identical:


  .maxstack  8
  IL_0000:  ldsfld     bool ConsoleTestGround.Program::threadBreaker
  IL_0005:  brfalse.s  IL_0000
  IL_0007:  ret


Well, nothing more to say...

Enjoy

0 Comments

Battle of the Programming Languages

Posted On Saturday 26 February 2011 by Tom Leese (TomMan)

I recently put together a series of tests to find out which is faster between: Python, Lua, and PHP.

The tests consisted of:



Here are the results:


python3  11.29s
lua      8.46s
php      15.01s



As you can see, Lua is the fastest language, python is the next and PHP is the slowest.

I did all these tests on an Intel Atom processor under Arch Linux. With all the tests I had: Chromimum, Kate and XChat running (and KDE).

Python Code · PHP Code · Lua Code

0 Comments

Planar

Posted On Thursday 21 October 2010 by Freddie Nash (FredFace)

Yes, it does exist.

Planar is a fun platformer, where you run about and are vapourised regularly inorder to reach the next level.

Its heavily under development at the moment and the game can be downloaded here: Planar.zip

It uses some slightly hacky Line Collsion detection I wrote almost a year ago, and currently adopts Glut and OpenGL for the rendering. There is a GDI+ rendering 'option', but this sequence is no longer updated.

Planar uses Tao and FreeGlut, where before it employed the 'SimpleGLControl'. This change happened only today and so it all looks a bit haphazard (2 forms, one accepts input, one render).

If you like moding games, you might as well mod Planar, is could hardly be easier. Here are some reasons why:
- Nothing is compressed
- 'Animations' comprise of string referenced PNGs
- It has a nice set of commands (the docs for which I can't be bothered to update, just read the code if you need to find something)
- Runtime console helps debugging (levels etc.) and can result in excessive amounts of fun
- As implied, I provide the source
- I'll probably write a tutoruial for moding at some point

Have fun.

0 Comments

Concatenation

Posted On Wednesday 1 September 2010 by Freddie Nash (FredFace)

Hello! Its another pointless test of the .NET Framework!

I ran a quick test just now, to see which is faster (without csc optimizations):



I won't go into detail, and shall just give you my results.

The times in Milliseconds are:


string.Concat(): 44
string.Format(): 186
a + b:           25



No suprises there, as String.Format does a lot more then the other 2 methods, but this does show how much slower it is. I never use it now :(

0 Comments

What is the best way of making games in C++ in Open Source toolkits?

Posted On Thursday 5 August 2010 by Tom Leese (TomMan)

In C++ there are many ways in which you could create games. Here are your options:



There are probably some more that I've missed but these are the toolkits I am most familiar with.

Firstly, we have SDL. SDL is designed to be used for making games from the beginning. SDL is very fast and very lightweight. Unfortunately, it is low-level so it can be a hard to start programming with SDL. In general, SDL is an excellent toolkit for writing games.

Next, OpenGL. This is the best option for people who want awesome looking and extremely fast 2D games, or excellent 3D Games. OpenGL can't be used on it's own, it has to be used with a library for managing windows, etc. From what I know you can use OpenGL with Qt, SDL, Windows Forms, GTK, and GLUT.

Next, Qt! Now, Qt is by far my favorite toolkit of them all. It is fast, easy to use and has amazing documentation. Unfortunately though, Qt is not the best toolkit for making games. It has a lot of useless technologies behind it when you write games in it which can make the games slow compared to SDL or OpenGL.

Finallly, GTK. I have not really used GTK must, but I used to use PyGTK loads because I prefered it to PyQt. From what I can see GTK is not really a very good toolkit for making games, but it is an excellent toolkit for making applications.

In conclusion, I have decided that if I were writing a game I would choose SDL + OpenGL because it is fastest and although it requires some learning it is an excellent solution for creating games.

Further Reading

1 Comments

Qt and its Awesomeness!

Posted On Thursday 29 July 2010 by Tom Leese (TomMan)

I would just like to say a few things about Qt and its awesomeness :p

Ok, so everything in Qt is based around the concept of events. This means that everything from the Window Manager wanting the window to be redrawn, to a mouse button being clicked, to the window being resized is done in events.

Here is some example code of drawing a circle in the middle of the window (200x200) when the window manager wants it.


void MainWindow::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing, true);
    QPen pen(Qt::blue, 2);
    painter.setPen(pen);
    QBrush brush(Qt::green);
    painter.setBrush(brush);
    painter.drawEllipse(20, 20, 160, 160);
}


0 Comments