Recent

Author Topic: Game Contest 2018  (Read 111040 times)

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Game Contest 2018
« Reply #90 on: February 27, 2018, 08:45:08 pm »
Well, I take back most of what I wrote earlier.
A simple dynamic array of TItem performs better than TFPList in every test except QuickSort, where TFPList is still consistently better in my tests, though only by a small margin. I tested with -O3 optimisation.
I could not get on with your test program, which was too 'procedural' for me to follow easily, so I did my own version which is a bit more object oriented. I think the algorithm comparison is identical, however. Attached for completeness.
Going for iterations much above 10,000,000 gave me heap overflow errors (or locked up my machine).

Typical output is as follows:

------- BENCHMARK with 1000 items ----------

CREATE AND FILL - TEST: [1000 items]
DynArray of TItem: 0.089 ms
  DynArray of PItem: 0.12 ms
    TPFList of PItem:  0.124 ms

ACCESS - TEST: [1000 items]
DynArray of TItem: 0.007 ms
  DynArray of PItem: 0.008 ms
    TPFList of PItem:  0.013 ms

QUICKSORT - TEST: [1000 items]
DynArray of TItem: 0.344 ms
  DynArray of PItem: 0.181 ms
    TPFList of PItem:  0.173 ms

FINALIZATION - TEST: [1000 items]
DynArray of TItem: 0.018 ms
  DynArray of PItem: 0.043 ms
    TPFList of PItem:  0.08 ms

------- BENCHMARK with 10000 items ----------

CREATE AND FILL - TEST: [10000 items]
DynArray of TItem: 1.089 ms
  DynArray of PItem: 1.103 ms
    TPFList of PItem:  1.158 ms

ACCESS - TEST: [10000 items]
DynArray of TItem: 0.082 ms
  DynArray of PItem: 0.07 ms
    TPFList of PItem:  0.13 ms

QUICKSORT - TEST: [10000 items]
DynArray of TItem: 4.371 ms
  DynArray of PItem: 2.322 ms
    TPFList of PItem:  2.027 ms

FINALIZATION - TEST: [10000 items]
DynArray of TItem: 0.258 ms
  DynArray of PItem: 0.786 ms
    TPFList of PItem:  0.87 ms

------- BENCHMARK with 50000 items ----------

CREATE AND FILL - TEST: [50000 items]
DynArray of TItem: 3.195 ms
  DynArray of PItem: 5.109 ms
    TPFList of PItem:  5.08 ms

ACCESS - TEST: [50000 items]
DynArray of TItem: 0.808 ms
  DynArray of PItem: 0.941 ms
    TPFList of PItem:  1.289 ms

QUICKSORT - TEST: [50000 items]
DynArray of TItem: 21.935 ms
  DynArray of PItem: 12.674 ms
    TPFList of PItem:  10.96 ms

FINALIZATION - TEST: [50000 items]
DynArray of TItem: 0.619 ms
  DynArray of PItem: 8.389 ms
    TPFList of PItem:  8.727 ms

------- BENCHMARK with 1000000 items ----------

CREATE AND FILL - TEST: [1000000 items]
DynArray of TItem: 43.389 ms
  DynArray of PItem: 52.806 ms
    TPFList of PItem:  46.093 ms

ACCESS - TEST: [1000000 items]
DynArray of TItem: 14.524 ms
  DynArray of PItem: 15.844 ms
    TPFList of PItem:  20.588 ms

QUICKSORT - TEST: [1000000 items]
DynArray of TItem: 323.348 ms
  DynArray of PItem: 261.171 ms
    TPFList of PItem:  244.879 ms

FINALIZATION - TEST: [1000000 items]
DynArray of TItem: 5.788 ms
  DynArray of PItem: 199.68 ms
    TPFList of PItem:  205.156 ms

------- BENCHMARK with 10000000 items ----------

CREATE AND FILL - TEST: [10000000 items]
DynArray of TItem: 381.413 ms
  DynArray of PItem: 447.635 ms
    TPFList of PItem:  446.729 ms

ACCESS - TEST: [10000000 items]
DynArray of TItem: 115.339 ms
  DynArray of PItem: 129.613 ms
    TPFList of PItem:  194.798 ms

QUICKSORT - TEST: [10000000 items]
DynArray of TItem: 3865.828 ms
  DynArray of PItem: 4271.55 ms
    TPFList of PItem:  4109.075 ms

FINALIZATION - TEST: [10000000 items]
DynArray of TItem: 57.777 ms
  DynArray of PItem: 2344.408 ms
    TPFList of PItem:  2457.059 ms


Paul_

  • Full Member
  • ***
  • Posts: 143
Re: Game Contest 2018
« Reply #91 on: February 27, 2018, 10:54:01 pm »
Your code have way better structure and FPListQSort code is completely out of my imagination. I must check some things more close.

Anyway, "for pi in pitemFPList do" instead of "pitemFPList.List[ i ]". Why use this slower way? It makes biggest difference in benchmark.
« Last Edit: February 27, 2018, 10:55:38 pm by Paul_ »

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Game Contest 2018
« Reply #92 on: February 28, 2018, 12:03:07 am »
Anyway, "for pi in pitemFPList do" instead of "pitemFPList.List[ i ]". Why use this slower way? It makes biggest difference in benchmark.

I assumed (without testing) that using the built-in enumerator would be fast. Perhaps its main value is just syntax sugar. I'm sure you can optimise my code at points, and perhaps alter the comparison results significantly.

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Game Contest 2018
« Reply #93 on: March 17, 2018, 03:37:39 am »
I'm playing with SDL2. It's good  :D. But I don't like it needs external *.dll. I'm testing on Windows, I hope no problems in Linux.

I am triying to remember my old Commodore 64 games. I lost them. 

This is my first screen.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Game Contest 2018
« Reply #94 on: March 19, 2018, 03:32:47 am »
Some disappointed with SDL2. Rendering with SDL_RenderDrawPoints() is as slow as using SDL_RenderDrawPoint() (And I don't get this works properly http://forum.lazarus.freepascal.org/index.php/topic,40526.msg280031/topicseen.html#new ).
It gives me just 15 FPS in my Corei7 3.4GHz - RAM 8GB.  :-[
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Game Contest 2018
« Reply #95 on: March 19, 2018, 01:01:14 pm »
Some disappointed with SDL2. Rendering with SDL_RenderDrawPoints() is as slow as using SDL_RenderDrawPoint() (And I don't get this works properly http://forum.lazarus.freepascal.org/index.php/topic,40526.msg280031/topicseen.html#new ).
It gives me just 15 FPS in my Corei7 3.4GHz - RAM 8GB.  :-[

Is like drawing a single pixel?

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Game Contest 2018
« Reply #96 on: March 19, 2018, 06:12:25 pm »
Some disappointed with SDL2. Rendering with SDL_RenderDrawPoints() is as slow as using SDL_RenderDrawPoint() (And I don't get this works properly http://forum.lazarus.freepascal.org/index.php/topic,40526.msg280031/topicseen.html#new ).
It gives me just 15 FPS in my Corei7 3.4GHz - RAM 8GB.  :-[
Use Allegro.pas.  ;D

Just kidding (nope).  I'm pretty sure there is a "bitmap lock" function in SDL (as it is in Allegro) that should speed up bitmap access.  Just look for it.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Game Contest 2018
« Reply #97 on: March 19, 2018, 10:18:02 pm »
Some disappointed with SDL2. Rendering with SDL_RenderDrawPoints() is as slow as using SDL_RenderDrawPoint() (And I don't get this works properly http://forum.lazarus.freepascal.org/index.php/topic,40526.msg280031/topicseen.html#new ).
It gives me just 15 FPS in my Corei7 3.4GHz - RAM 8GB.  :-[

Is like drawing a single pixel?

Yes. Using SDL_RenderDrawPoints() with an array of Pixels is as slow as drawing each pixel with SDL_RenderDrawPoint(). It's supposed to be faster.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Paul_

  • Full Member
  • ***
  • Posts: 143
Re: Game Contest 2018
« Reply #98 on: March 19, 2018, 11:24:00 pm »
You can check their documentation, there is no mention how it's done and if it's faster or not - https://wiki.libsdl.org/SDL_RenderDrawPoints#Syntax
Then you have to look at the source codes.

Btw. best documented framework is probably SFML:
https://www.sfml-dev.org/tutorials/2.4/graphics-vertex-array.php
https://www.sfml-dev.org/documentation/2.4.2/classsf_1_1VertexArray.php

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Game Contest 2018
« Reply #99 on: March 20, 2018, 09:57:29 pm »
Well I read some post where suggest to use RenderDrawPoints() instead RenderDrawPoint() to a better perfomance. No matter.
I see there is a lack of documentation for SDL using Free Pascal (I only see the https://www.freepascal-meets-sdl.net/).
Is there a Wiki for that? Maybe I can collaborate, now I'm starting using SDL2.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Game Contest 2018
« Reply #100 on: March 22, 2018, 07:00:50 pm »
And your application code is slower than drawing with TCanvas on a regular Form?

If not, at least is not that slow =)

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Game Contest 2018
« Reply #101 on: March 23, 2018, 06:12:21 pm »
And your application code is slower than drawing with TCanvas on a regular Form?

If not, at least is not that slow =)
That was the question I was doing too. I wanted to do a comparison, but after improving the performance of my program I forgot. I will try to compare just for information.

Cuurently I'm not doing RenderDrawPoints() or RenderDrawPoint(). They are too slow in SDL2. I'm working with textures now and I get 128 FPS.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Game Contest 2018
« Reply #102 on: March 26, 2018, 11:44:33 am »
I think you should open another thread to discuss that, shouldn't you?

On-topic:  There's a game programming contest at the end of the month. The idea is to resurrect an old project. I'll try to participate, so may be we'll have a new game.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Paul_

  • Full Member
  • ***
  • Posts: 143
Re: Game Contest 2018
« Reply #103 on: March 26, 2018, 06:25:53 pm »
Which one?

20.4. - starts LUDUM DARE 41
I will participate for the second time. My simple SFML "engine" is now more prepared (also thanks to this topic contest) but it still miss sprite animation system (something like Spine) and 2D physics engine (Chipmunk, Box2D).

There is one global minor problem with all game jams, people are lazy download game files.
They prefer to run them via browser (Unity, html5, Java, Godot), which is logical :)

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Game Contest 2018
« Reply #104 on: March 26, 2018, 10:00:36 pm »
Which one?

Yes, we want to know =)


There is one global minor problem with all game jams, people are lazy download game files.
They prefer to run them via browser (Unity, html5, Java, Godot), which is logical :)

A downloader UI can do the trick, just download a small .exe (few kb) that gives you a nice downloader, that works also as menu to launch, for each project.

That way is the way, say it to Steam =)

 

TinyPortal © 2005-2018