Recent

Author Topic: What graphics engine could achieve this ?  (Read 17993 times)

turrican

  • Full Member
  • ***
  • Posts: 133
  • Pascal is my life.
    • Homepage
Re: What graphics engine could achieve this ?
« Reply #15 on: June 30, 2017, 10:45:49 am »
ZenGL was one of the thing in my have to learn list. But some years ago I learned from their forum, the development of ZenGL will be stopped. The author said, he is a perfectionist, Pascal was slow he had to play around with C-code for speed, which is boring, FPC and Lazarus was not as good as he want, Delphi was expensive, Pascal community was almost dead.

Sad :'(

Andru, ZenGL author is a great developer. But his words aren't justificated... He lost the interest for this project (dot). W
ith Pascal you can do almost everything you can do in C, C++ with a 5% to 20% of speed lose. For 2D games with OpenGL or DX Pascal is more than suficient. People are developing using python. Is python faster than pascal???? NOT.




Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: What graphics engine could achieve this ?
« Reply #16 on: June 30, 2017, 11:19:11 am »
I have a framework to simplify and abstract ZenGL called SimpleZenGL . Features are OOP, Scenes, SpriteBatches, Collisions, Events, Input and Sound.

I can't find SimpleZenGL on the web. May you share it?

Andru, ZenGL author is a great developer. But his words aren't justificated... He lost the interest for this project (dot). W
ith Pascal you can do almost everything you can do in C, C++ with a 5% to 20% of speed lose. For 2D games with OpenGL or DX Pascal is more than suficient.

He said that in 2013. Perhaps at that moment, it was the bad time for Pascal. Now, Lazarus and Free Pascal has improved a lot, the community is strong. Delphi Berlin Starter is offered for free with limited commercial usage. Things are better now.

BASIC was my first programming language. Soon I found it was too slow. So I spent some time learning Assembly using debug.com. I am glad I found Pascal, it is a good balance between power and performance.

turrican

  • Full Member
  • ***
  • Posts: 133
  • Pascal is my life.
    • Homepage
Re: What graphics engine could achieve this ?
« Reply #17 on: June 30, 2017, 11:36:02 am »
Quote
I can't find SimpleZenGL on the web. May you share it?

Sorry, I need to upload to GitHub to share it with a working example. This afternoon I will do it. :)

As you said I also started with my old Amstrad CPC 6128 BASIC when I was 6 years old :)

I'm not a fanboy but I found on Pascal most equilibrated programming language for all platforms. I could do everything I need. Easy to learn, hard to master.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: What graphics engine could achieve this ?
« Reply #18 on: July 02, 2017, 05:30:31 am »
You could pull off this Diablo clone in a whole lot of different frameworks! If you want specifics, personally I'd recommend the Castle Game Engine as it is actively developed and uses modern functionality. Definitely don't use ZenGL.

Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: What graphics engine could achieve this ?
« Reply #19 on: July 02, 2017, 01:54:13 pm »
You could pull off this Diablo clone in a whole lot of different frameworks! If you want specifics, personally I'd recommend the Castle Game Engine as it is actively developed and uses modern functionality. Definitely don't use ZenGL.

It first came out in 2000/2001 so maybe predates diablo.
I did look at the Castle engine but I tend to give up easily if something doesn't work right like an install fail or something else.
Thanks for all the input.

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: What graphics engine could achieve this ?
« Reply #20 on: July 02, 2017, 04:30:45 pm »
My first install of Castle Game Engine was failed too. After weeks later, I managed to install it on my second attempt and the demos run correctly. But because I was busy, I didn't have time to learn more about it.

... Definitely don't use ZenGL.

I haven't try it but I already heard a lot of praise about ZenGL. I am open to hear from different point of views, can you please explain more why you do not recommend ZenGL?

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: What graphics engine could achieve this ?
« Reply #21 on: July 02, 2017, 06:27:13 pm »
It first came out in 2000/2001 so maybe predates diablo.

The original Diablo came out in 1996.

I haven't try it but I already heard a lot of praise about ZenGL. I am open to hear from different point of views, can you please explain more why you do not recommend ZenGL?

It's not a bad engine by any means and there have certainly been good games made with it. However, it's an abandoned project (meaning it obviously won't be improved or receive any bug fixes in the future) and it's also built around outdated GL functionality which leaves it with something of a "ceiling" performance-wise. Lastly the overall design of the engine is largely procedural and doesn't fit in particularly well with object-oriented projects.
« Last Edit: July 02, 2017, 07:06:24 pm by Akira1364 »

Paul_

  • Full Member
  • ***
  • Posts: 143
Re: What graphics engine could achieve this ?
« Reply #22 on: July 02, 2017, 10:07:48 pm »
it's also built around outdated GL functionality which leaves it with something of a "ceiling" performance-wise. Lastly the overall design of the engine is largely procedural and doesn't fit in particularly well with object-oriented projects.

What is this new functionality or approach in OpenGL?

And because you're talking about performance I also checked Castle engine demos related to 2D graphics :)
1) PC with AMD RX 480
isometric_game - 180/180 FPS (even with 180 FPS scrolling isn't smooth)
2d_dragon_spine_game - 900/400 FPS  (when I add 100 trees into scene, FPS drop to 100)
tiled - 120/120 FPS

2) Old PC, Atom + ATI 6450
isometric_game - 30 FPS
2d_dragon_spine_game - 120 FPS

Well, scenes are absolutely not complicated and such 2D rendering performance is really hardly usable..

ZenGL tests:
1) PC with AMD RX 480
Demo 08 sprite engine - 60000 animated sprites ~60 FPS
2) Old PC
Demo 08 sprite engine - 2000 animated sprites ~60 FPS

Compiled in FPC (-O3).

Everyone likes a different style. Anyway how we can see this ZenGL procedural approach in framework is "super" efficient and it is very clear.
(There is also ZenGL OOP wrapper MondoZenGL.)

Because ZenGL is dead it isn't best choice. For smaller project why not. For something bigger are fine frameworks like SDL2 or SFML.

kagamma

  • New Member
  • *
  • Posts: 13
Re: What graphics engine could achieve this ?
« Reply #23 on: July 02, 2017, 10:31:02 pm »
The reason castle game engine (CGE) has worse performance compare to ZenGL in your test is because it doesnt do any batching under the hood (it was never easy to do batching on 3D engines when a model is always construct from differents parts with different materials, unlike simple 2D sprites, and yes Spine is treated as 3D object in CGE). In order to achieve good performance in CGE you need to implement your own batching and CGE provides necessary tools to help you with the task. Or, wait for Michalis or any contributor to implement proper batching as it is one of the planned features in roadmap.

Another reason is CGE is a full-blown game engine with scene manager, AI and many fancy stuff on top of it, unlike ZenGL which is just a simple wrapper around OpenGL. :)

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: What graphics engine could achieve this ?
« Reply #24 on: July 03, 2017, 12:17:10 am »
What is this new functionality or approach in OpenGL?

The most basic approach would be roughly something like the following:

First, you'd need to define some kind of interleaved OpenGL data structure, such as what's shown below.

Code: Pascal  [Select][+][-]
  1.   TTexCoord = record
  2.     U, V: Single;
  3.   end;
  4.  
  5.   TFloatColor = record
  6.     R, G, B: Single;
  7.   end;
  8.  
  9.   TVertex = record
  10.     X, Y, Z: Single;
  11.   end;
  12.  
  13.   TSpriteVertex = record
  14.     T2F: TTexCoord;
  15.     C3F: TFloatColor;
  16.     V3F: TVertex;
  17.   end;
  18.  
  19.   TSpriteTriangle = record
  20.     V1, V2, V3: TSpriteVertex;
  21.   end;
  22.  
  23.   TSpriteQuad = record
  24.     Tri1, Tri2: TSpriteTriangle;
  25.   end;
  26.  
  27.   TSpriteQuadArray = array of TSpriteQuad;

Then, you would need to define some kind of sprite manager class (or even advanced record) that had its own TSpriteQuadArray as well as a separate array of actual individual sprites (which would each have their own TSpriteQuad, as well as texture ID). Before drawing you'd sort the array of actual sprites by texture ID from low to high, call glBindTexture on the first one, and then loop over the array copying each sprites TSpriteQuad sequentially into the managers TSpriteQuadArray, until the texture ID of the current sprite was different from the previous one. At that point, you'd bind your vertex buffer and use something along the lines of glBufferSubData to upload the data from the TSpriteQuadArray into it, and then set up your "vertex attribute pointers" so that the stride matches your previously defined interleaved data structure. Then you'd call glDrawArrays (in GL_TRIANGLES mode of course), clear the managers TSpriteQuadArray, bind the new texture ID, and return to your initial loop at the index you left off until you hit a different texture ID again.

Doing things that way you'd be looking at enormous framerate increases over how ZenGL currently does things, both because you'd be making drastically fewer OpenGL function calls (we're talking hundreds/thousands VS. tens of millions here) and also because all of the data OpenGL needs would be getting uploaded to the GPU in a single array ahead of time, instead of vertex-by-vertex in an endless series of glVertex3Fs and glTexCoord2Fs.

As far as your benchmarks, you are certainly comparing apples to oranges. The ZenGL demo is an utterly simplistic "true 2D" loop that just renders the same six textures in a row (thereby "animating" them) over and over again while adjusting their position every so often based on input from a timer. There are no matrix transformations, world space computations, or "game logic" of any kind going on. The Castle Dragon demo on the other hand is loading fully articulated spine models from JSON files and computing the transformations of each joint in real time, while also dealing with 3D matrix computations (since nothing in Castle is ever actually 2D, as demonstrated by the 3D camera mode you can switch to in that demo) as well as rendering the on-screen menu buttons. Most of the same things apply to the isometric demo, other than the use of "rigged" spine models.
« Last Edit: July 10, 2017, 12:07:05 am by Akira1364 »

Paul_

  • Full Member
  • ***
  • Posts: 143
Re: What graphics engine could achieve this ?
« Reply #25 on: July 03, 2017, 01:29:53 am »
This kind of sprite batching is in LibGDX I think.

So you recommend 3D engine for 2D Diablo-like game, when you know that is slow, because there are no 2D sprite routines? :)
And it is unnecessary to notify ZenGL performance in that case, because this "outdated" rendering is maybe 1000x faster..

He only needs simple gameloop, texture manager, timers, fast rendering etc. So everything what ZenGL have.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: What graphics engine could achieve this ?
« Reply #26 on: July 03, 2017, 02:07:22 am »
This kind of sprite batching is in LibGDX I think.

So you recommend 3D engine for 2D Diablo-like game, when you know that is slow, because there are no 2D sprite routines? :)
And it is unnecessary to notify ZenGL performance in that case, because this "outdated" rendering is maybe 1000x faster..

He only needs simple gameloop, texture manager, timers, fast rendering etc. So everything what ZenGL have.

You're being remarkably disingenuous.

Notwithstanding what I already pointed out about the flawed comparisons you made, even if they were actually accurate they still wouldn't be 1000x faster or anywhere close. The only reason you were locked at 60FPS is because ZenGL turns on VSync by default when the window is initialized. If you turned on VSync with any Castle demo you'd be locked at 60FPS in the same way. (And again, you were getting more than 60FPS across the board to begin with in the Castle demos, so I'm not entirely sure what your actual complaint even was.)

Secondly, he needs a lot more than a "simple gameloop, texture manager, timers, and fast rendering" to do that sort of game. Action RPGs aren't Flappy Bird. The actual graphics backend is only a very small piece of the puzzle, which is why I recommended Castle which can in fact do the rendering just fine while also providing all of the necessary functionality that he'd need for the actual gameplay.

kagamma

  • New Member
  • *
  • Posts: 13
Re: What graphics engine could achieve this ?
« Reply #27 on: July 03, 2017, 03:02:39 am »
Since some people doubt about Castle Game Engine's performance I decided to make simple tests with the engine (with my own batching method of course ;D )

Specs: Intel core i7 6700HQ 2.6Ghz, 8GB RAM, Intel HD Graphics 530.
Compiler: FPC 3.0.2.
Target: Win32 with -O3 optimization.

1: demo_tilemap
- This test will try to load a huge, ugly tilemap :-[ with 2048x2048 tiles, 2 layers, each tile has a size 32x32 pixels.
- The program will try to load all resources before render so it will take some time and eat a lot of memory (~1.4GB RAM on my PC). Once the load completed, it will make use of CGE's scene manager to remove all tiles outside viewport from the drawing pipeline.
- Use arrow keys to scroll the map.
- Result: ~1500 FPS.

2. demo_sprite
- This test is basically a crude port of ZenGL's demo 08, with my own implementation of simple sprite batching.
- Result: ~60FPS with around 30000 sprites on screen (in comparison, ZenGL renders around 23000 sprites on my PC before drop down to < 60FPS).
- Edit: The reason for ZenGL's poor performance compare to CGE, despite all the "bloat" CGE has, is because ZenGL still use OpenGL immediate mode for rendering i.e. by calling hundred thousands of glVertexXX/glTexCoordXX/glColorXX commands per frame. This cause a huge performance impact on the test.
- Edit2: In another run on another PC with a nVidia GTX950 graphics card, both programs have almost the same result, so I guess driver/graphics card quality also play an important part in here.

Link: https://mega.nz/#!hIRWBKxT!VBIFZNbYWaoYaW1tJQ5pnytwQlgU379EcW2S4DPXb5U
« Last Edit: July 03, 2017, 08:33:38 pm by kagamma »

Paul_

  • Full Member
  • ***
  • Posts: 143
Re: What graphics engine could achieve this ?
« Reply #28 on: July 03, 2017, 10:58:57 am »
Notwithstanding what I already pointed out about the flawed comparisons you made..

I did not test it with VSync, just added objects until game hits 60 FPS. Also there is no default 60 FPS rendering lock in ZenGL.


Anyway kagamma's tests looks much better :)

turrican

  • Full Member
  • ***
  • Posts: 133
  • Pascal is my life.
    • Homepage
Re: What graphics engine could achieve this ?
« Reply #29 on: July 03, 2017, 02:34:29 pm »
Since some people doubt about Castle Game Engine's performance I decided to make simple tests with the engine (with my own batching method of course ;D )

Specs: Intel core i7 6700HQ 2.6Ghz, 8GB RAM, Intel HD Graphics 530.
Compiler: FPC 3.0.2.
Target: Win32 with -O3 optimization.

1: demo_tilemap
- This test will try to load a huge, ugly tilemap :-[ with 2048x2048 tiles, 2 layers, each tile has a size 32x32 pixels.
- The program will try to load all resources before render so it will take some time and eat a lot of memory (~1.4GB RAM on my PC). Once the load completed, it will make use of CGE's scene manager to remove all tiles outside viewport from the drawing pipeline.
- Use arrow keys to scroll the map.
- Result: ~1500 FPS.

2. demo_sprite
- This test is basically a crude port of ZenGL's demo 08, with my own implementation of simple sprite batching.
- Result: ~60FPS with around 30000 sprites on screen (in comparison, ZenGL renders around 23000 sprites on my PC before drop down to < 60FPS).
Edit: The reason for ZenGL's poor performance compare to CGE, despite all the "bloat" CGE has, is because ZenGL still use OpenGL immediate mode for rendering i.e. by calling hundred thousands of glVertexXX/glTexCoordXX/glColorXX commands per frame. This cause a huge performance impact on the test.
Edit2: In another run on another PC with a nVidia GTX950 graphics card, both programs have almost the same result, so I guess driver/graphics card quality also play an important part in here.

Link: https://mega.nz/#!oVBzSYLb!N4JMO25nMrZzAsyxTFvF1Gy6E1LiQwasIvIFrZeZd6E

Nice tests... I'm going to check this framework before I move to SDL2.

 

TinyPortal © 2005-2018