Difference between revisions of "Game framework"

From Lazarus wiki
Jump to navigationJump to search
 
(32 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{Infobox game development}}
+
{{Menu_Game_Development}}
  
A '''game framework''' is a library designed to help game development.  It usually defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] to deal with [[Graphics libraries|graphics]], sound, user input, data files, etc.  In most cases it defines a high-level API that allows [[cross-platform]] development.
+
A '''game framework''' is a library designed to help game development.  It usually defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] to deal with [[Graphics libraries|graphics]], sound, user input, data files, etc.  In most cases it defines a high-level API that allows cross-platform development.
  
Main difference between game frameworks and [[Game Engine|game engines]] is that the later also implements the game loop, as well as complex data structures (maps, actors...), data containers and tools.
+
Main difference between game frameworks and [[Game Engine|game engines]] is that the latter also implements the game loop, as well as complex data structures (maps, actors...), data containers and tools.
  
 
==Game frameworks==
 
==Game frameworks==
Line 18: Line 18:
 
| [http://allegro-pas.sourceforge.net/ Bindings Allegro-pas]
 
| [http://allegro-pas.sourceforge.net/ Bindings Allegro-pas]
 
| Allegro 1-4: Beerware, Allegro 5: zlib
 
| Allegro 1-4: Beerware, Allegro 5: zlib
| Info: Allegro is a cross-platform library mainly aimed at video game and multimedia programming. It handles common, low-level tasks such as creating windows,  
+
| Allegro is a cross-platform library mainly aimed at video game and multimedia programming. It handles common, low-level tasks such as creating windows, accepting user input, loading data, drawing images, playing sounds, etc. and generally abstracting away the underlying platform.
accepting user input, loading data, drawing images, playing sounds, etc. and generally abstracting away the underlying platform.
 
 
|-
 
|-
 
| Phoenix
 
| Phoenix
| [https://code.google.com/p/phoenixlib/ code.google.com]
+
| [https://github.com/GuvaCode/PGF GitHub]
 
| FPC/Delphi
 
| FPC/Delphi
|
+
| Mozilla Public License
|
+
| A set of Delphi 7+ and Free Pascal components and classes to help in creating hardware accelerated 2D and 3D games.
 
|-
 
|-
 
| [[GLScene]]
 
| [[GLScene]]
| [http://glscene.sourceforge.net/ sourceforge.net]  
+
| [http://glscene.sourceforge.net/ SourceForge]  
 
| FPC/Delphi
 
| FPC/Delphi
 
| Mozilla Public License
 
| Mozilla Public License
 
| GLScene is a free OpenGL-based library for the Delphi programming language, C++ and Free Pascal. It provides visual components and objects allowing description and rendering of 3D scenes.
 
| GLScene is a free OpenGL-based library for the Delphi programming language, C++ and Free Pascal. It provides visual components and objects allowing description and rendering of 3D scenes.
 +
|-
 +
| Raylib
 +
| [https://www.raylib.com/ www.raylib.com]
 +
| FPC/Lazarus [https://github.com/sysrpl/Raylib.4.0.Pascal Raylib 4.0 Pascal Bindings]
 +
| Zlib
 +
| Raylib is a popular game development toolkit in the computer programming education space. It provides windowing, input, graphics, text, audio, collision detection, and a basic GUI. The official website contains many examples and an easy to learn and use documentation cheatsheet.
 +
|-
 +
| SFML
 +
| [https://www.sfml-dev.org/ www.sfml-dev.org]
 +
| FPC/Lazarus [https://github.com/DJMaster/csfml-fpc SFML headers] [https://github.com/CWBudde/PasSFML PasSFML(OOP)]
 +
 +
| SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics, audio and network.
 +
|-
 +
| SDL
 +
| [http://www.libsdl.org www.libsdl.org]
 +
| [https://github.com/PascalGameDevelopment/SDL2-for-Pascal SDL2 for Pascal] [http://sourceforge.net/projects/sdl2fpc/?source=directory SDL2 bindings for FPC] [https://sourceforge.net/projects/lazsdl2/ Laz2SDL] [https://github.com/ev1313/Pascal-SDL-2-Headers SDL2 Headers] 
 +
|  SDL2: [http://libsdl.org/license.php zlib]
 +
|  Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.
 +
|-
 +
| [[ZenGL]]
 +
| [https://sourceforge.net/projects/new-zengl/ SourceForge]
 +
| FPC/Delphi
 +
| [http://www.zengl.org/license.html Zlib]
 +
| Cross-platform game development library written in Pascal, designed to provide necessary functionality for rendering 2D-graphics, handling input, sound output, etc.
 +
|}
  
 +
==Other libraries for games==
 +
Libraries that aren't to create games but are useful.
  
 +
{| class="wikitable sortable" width="100%"
 +
! Name
 +
! Site
 +
! Usage
 +
! License
 +
! Notes
 
|-
 
|-
| SMFL
+
| [[Steam Wrapper]]
| [http://www.sfml-dev.org/index-fr.php http://www.sfml-dev.org/index-fr.php]  
+
| [https://github.com/thecocce/steamwrapper https://github.com/thecocce/steamwrapper]  
| [https://github.com/DJMaster/csfml-fpc PasSFML][https://github.com/CWBudde/PasSFML Bindings PasSFML(OOP)]
+
| FPC/Delphi
|
 
| SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing,
 
graphics, audio and network.
 
|-
 
| SDL/SDL2
 
| [http://www.libsdl.org www.libsdl.org]
 
| [http://sourceforge.net/projects/sdl2fpc/?source=directory Bindings SDL2 for Free Pascal Compiler]
 
 
|
 
|
| Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick,
+
| Cross-platform game development wrapper written in Pascal, designed to provide necessary functionality for rendering 2D-graphics, handling input, sound output, etc.
and graphics hardware via OpenGL and Direct3D
 
 
|}
 
|}
 +
 +
==Using LCL for game development==
 +
1) From forum member '''furious programming'''.
 +
 +
I suggest not to waste your time on LCL to build games, because it is not suitable for creating games for many reasons, including the most important:
 +
 +
*    no Direct3D and OpenGL support
 +
*    unable to use GPU for rendering textures
 +
*    no exclusive video mode support and available screen resolutions
 +
*    absolutely no support for sound mixer and playing multiple sounds at the same time
 +
*    lack of support for game controllers and their full functionality
 +
*    lack o V-Sync support
 +
 +
What I mentioned above are the basics, without which creating even a simple game will be inconvenient, the game itself will be very limited, and its performance will be very low (software rendering is horribly slow in compare to GPU rendering). As you can see, it doesn't make much sense.
 +
 +
Whether you want to make a tiny game or a bigger one, use the library dedicated to their creation. It does not have to be SDL, but it is important that it has all the functionality to create full-fledged video games. However, if you are interested in creating a 2D game, I strongly advise you not to use 3D engines for this purpose, because it will significantly complicate the implementation, and you will get discouraged very quickly.
 +
 +
Use something small, light, functional and, above all, supported at all times. I suggest SDL because it meets all the requirements and is great, but it can also be Allegro, because it's the same shelf.
 +
 +
2) From forum member '''Seenkao'''.
 +
 +
There are quite a few solutions for using both LCL and OpenGL/DirectX at the same time. They can be seen in neighboring topics and on the Free Pascal wiki. In the German forum, almost all OpenGL tutorials are made under LCL. dglOpenGL.pas - allows you to work with LCL on Windows without much knowledge of creating an OpenGL window/context.
 +
 +
*    [[OpenGL Tutorial]]
 +
*    [https://wiki.delphigl.com/index.php/Lazarus_-_OpenGL_3.3_Tutorial dglOpenGL tutorial, Deutsch]
 +
*    [https://forum.lazarus.freepascal.org/index.php/topic,42306.0.html Metal, OpenGL demos]
 +
*    [[GLScene]]
 +
*    [https://github.com/Dev-Demi/GLEngine2D GLEngine2D], based on dglOpenGL. Deprecated. But it works.
 +
*    [[Game Engine]]
 +
 +
I don't even think I can fully cover this topic. And there's a good chance I'll miss something. LCL can also be used with SDL, Castle Game Engine, PGF, Apus Game Engine, ZenGL and many other engines.
 +
Connecting controllers does not depend at all on what we use. To do this, you just need to use the necessary libraries. Often that already come with game engines. And it can also be used in LCL.
 +
With sound, no one forbids the use of single-channel / multi-channel sound. All this is provided in the respective libraries. And it can also be used in LCL.
 +
 +
The only reason this is not a suitable option is if you have a highly loaded application. Here I partly agree! In simple games, this has almost no effect.
  
 
==See also==
 
==See also==
 
* [[Graphics libraries]]
 
* [[Graphics libraries]]
 
* [[Game Engine|Game engine]]
 
* [[Game Engine|Game engine]]
 
  
 
[[Category:Game Development]] [[Category:Games]]
 
[[Category:Game Development]] [[Category:Games]]

Latest revision as of 14:05, 30 September 2023

Game Development

A game framework is a library designed to help game development. It usually defines APIs to deal with graphics, sound, user input, data files, etc. In most cases it defines a high-level API that allows cross-platform development.

Main difference between game frameworks and game engines is that the latter also implements the game loop, as well as complex data structures (maps, actors...), data containers and tools.

Game frameworks

Name Site Usage License Notes
Allegro liballeg.org Bindings Allegro-pas Allegro 1-4: Beerware, Allegro 5: zlib Allegro is a cross-platform library mainly aimed at video game and multimedia programming. It handles common, low-level tasks such as creating windows, accepting user input, loading data, drawing images, playing sounds, etc. and generally abstracting away the underlying platform.
Phoenix GitHub FPC/Delphi Mozilla Public License A set of Delphi 7+ and Free Pascal components and classes to help in creating hardware accelerated 2D and 3D games.
GLScene SourceForge FPC/Delphi Mozilla Public License GLScene is a free OpenGL-based library for the Delphi programming language, C++ and Free Pascal. It provides visual components and objects allowing description and rendering of 3D scenes.
Raylib www.raylib.com FPC/Lazarus Raylib 4.0 Pascal Bindings Zlib Raylib is a popular game development toolkit in the computer programming education space. It provides windowing, input, graphics, text, audio, collision detection, and a basic GUI. The official website contains many examples and an easy to learn and use documentation cheatsheet.
SFML www.sfml-dev.org FPC/Lazarus SFML headers PasSFML(OOP) SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics, audio and network.
SDL www.libsdl.org SDL2 for Pascal SDL2 bindings for FPC Laz2SDL SDL2 Headers SDL2: zlib Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.
ZenGL SourceForge FPC/Delphi Zlib Cross-platform game development library written in Pascal, designed to provide necessary functionality for rendering 2D-graphics, handling input, sound output, etc.

Other libraries for games

Libraries that aren't to create games but are useful.

Name Site Usage License Notes
Steam Wrapper https://github.com/thecocce/steamwrapper FPC/Delphi Cross-platform game development wrapper written in Pascal, designed to provide necessary functionality for rendering 2D-graphics, handling input, sound output, etc.

Using LCL for game development

1) From forum member furious programming.

I suggest not to waste your time on LCL to build games, because it is not suitable for creating games for many reasons, including the most important:

  • no Direct3D and OpenGL support
  • unable to use GPU for rendering textures
  • no exclusive video mode support and available screen resolutions
  • absolutely no support for sound mixer and playing multiple sounds at the same time
  • lack of support for game controllers and their full functionality
  • lack o V-Sync support

What I mentioned above are the basics, without which creating even a simple game will be inconvenient, the game itself will be very limited, and its performance will be very low (software rendering is horribly slow in compare to GPU rendering). As you can see, it doesn't make much sense.

Whether you want to make a tiny game or a bigger one, use the library dedicated to their creation. It does not have to be SDL, but it is important that it has all the functionality to create full-fledged video games. However, if you are interested in creating a 2D game, I strongly advise you not to use 3D engines for this purpose, because it will significantly complicate the implementation, and you will get discouraged very quickly.

Use something small, light, functional and, above all, supported at all times. I suggest SDL because it meets all the requirements and is great, but it can also be Allegro, because it's the same shelf.

2) From forum member Seenkao.

There are quite a few solutions for using both LCL and OpenGL/DirectX at the same time. They can be seen in neighboring topics and on the Free Pascal wiki. In the German forum, almost all OpenGL tutorials are made under LCL. dglOpenGL.pas - allows you to work with LCL on Windows without much knowledge of creating an OpenGL window/context.

I don't even think I can fully cover this topic. And there's a good chance I'll miss something. LCL can also be used with SDL, Castle Game Engine, PGF, Apus Game Engine, ZenGL and many other engines. Connecting controllers does not depend at all on what we use. To do this, you just need to use the necessary libraries. Often that already come with game engines. And it can also be used in LCL. With sound, no one forbids the use of single-channel / multi-channel sound. All this is provided in the respective libraries. And it can also be used in LCL.

The only reason this is not a suitable option is if you have a highly loaded application. Here I partly agree! In simple games, this has almost no effect.

See also