Recent

Author Topic: Here's some Pong game. Suggestions? Feedback? Ideeas?  (Read 1961 times)

Darie

  • New Member
  • *
  • Posts: 31
Here's some Pong game. Suggestions? Feedback? Ideeas?
« on: March 17, 2024, 02:59:57 pm »
As I was saying in another thread, I am teaching my child programming. We made this pong game in console, no graph mode (just) yet. And I was thinking the concept may be extended to some other games, given loading config & level functionalities, one can easily see an Arkanoid, ManicMiner etc. clone running in terminal. While there are a few for linux/bsd, not so much can be said about Win. Although, with such approach, this can be done. What do you think?

Code: Pascal  [Select][+][-]
  1. {$CODEPAGE UTF8}
  2. PROGRAM
  3.   Pong;
  4. USES
  5. {$IFDEF UNIX}
  6.   unix,
  7. {$ENDIF}
  8.   crt,
  9.   sysutils,
  10.   tones;
  11. CONST
  12.   MinimumWidth = 1;
  13.   MaximumWidth = 80;
  14.   MinimumHeight = 1;
  15.   MaximumHeight = 25;
  16.  
  17.   MinHeight = MinimumHeight +1;
  18.   MaxHeight = MaximumHeight -1;
  19.   MidHeight = MaximumHeight div 2;
  20.   MidWidth = MaximumWidth div 2;
  21.  
  22.   ArenaChar = '#';
  23.   NetChar = '#';
  24.   PadChar = '#';
  25.   BallChar = '@';
  26.  
  27.   ArenaColor = Green;
  28.   NetColor = LightGreen;
  29.   Pad1Color = LightMagenta;
  30.   Pad2Color = LightBlue;
  31.   BallColor = Yellow;
  32.  
  33.   BorderHeight = MaximumHeight div 5;
  34.  
  35.   BallDelay = 75; // game speed
  36.   PaddDelay = 5; // game confort
  37. VAR
  38.   DeltaWidth, DeltaHeight: integer;
  39.  
  40.   ballX, ballY: integer;
  41.   ballDX, ballDY: integer;
  42.   paddle1Y, paddle2Y: integer;
  43.   quitRequested: boolean;
  44.  
  45.   score1, score2: integer;
  46.   scored: integer;
  47.   ton_on: boolean;
  48.  
  49.   x, y, i: integer;
  50.   s: string;
  51.  
  52.   msg_last_x: integer;
  53.   msg_delay: integer;
  54.   msg_last: integer;
  55.  
  56.   game_mode: boolean;
  57.   PaddleDelta: integer;
  58.   PaddleHeight: integer;
  59.  
  60. procedure InitGame;
  61. begin
  62.   scored := 1;
  63.   score1 := 0;
  64.   score2 := 0;
  65.   ton_on := true;
  66.  
  67.   msg_last := 0;
  68.   msg_delay := 0;
  69.   msg_last_x := MinimumWidth + 2;
  70.  
  71.   game_mode := true;
  72.   PaddleDelta := 0;
  73.   PaddleHeight := MaximumHeight div 5;
  74. end;
  75.  
  76. procedure DrawArena;
  77. begin
  78.   // draw net
  79.   textcolor(NetColor);
  80.   for i := MinimumHeight to MaximumHeight do begin
  81.     gotoxy(MidWidth, i);
  82.     write(NetChar);
  83.   end;
  84.   // draw arena
  85.   textcolor(ArenaColor);
  86.   for i := MinimumWidth to MaximumWidth do begin
  87.     gotoxy(i, MinimumHeight);
  88.     write(ArenaChar);
  89.     gotoxy(i, MaximumHeight);
  90.     write(ArenaChar);
  91.   end;
  92.   // altered game mode
  93.   if not game_mode then begin
  94.     for i := 1 to BorderHeight do begin
  95.       // top
  96.       gotoxy(MinimumWidth, MinimumHeight +i);
  97.       write(ArenaChar);
  98.       gotoxy(MaximumWidth, MinimumHeight +i);
  99.       write(ArenaChar);
  100.       // bot
  101.       gotoxy(MinimumWidth, MaximumHeight -i);
  102.       write(ArenaChar);
  103.       gotoxy(MaximumWidth, MaximumHeight -i);
  104.       write(ArenaChar);
  105.     end;
  106.   end;
  107. end;
  108.  
  109. procedure DrawScores;
  110. begin
  111.   textcolor(BallColor);
  112.   s := inttostr(score1);
  113.   x := (MaximumWidth div 2) -3 -length(s);
  114.   gotoxy(x, MinimumHeight);
  115.   write(' ', score1, ' ');
  116.   x := (MaximumWidth div 2) +2;
  117.   gotoxy(x, MinimumHeight);
  118.   write(' ', score2, ' ');
  119. end;
  120. procedure ResetScores;
  121. begin
  122.   score1 := 0;
  123.   score2 := 0;
  124.   DrawArena;
  125.   DrawScores;
  126. end;
  127.  
  128. procedure DrawBanner;
  129. var
  130.   msg: string;
  131.   msg_x: integer;
  132. begin
  133.   if ( msg_delay > 0 ) then begin
  134.     dec(msg_delay);
  135.     exit;
  136.   end;
  137.  
  138.   case msg_last of
  139.     0: msg := 'P1: E & C; P2: I & N; Hit SPACE to start. ESC to quit. Enjoy!';
  140.     1: msg := 'Player 1: E up & C down';
  141.     2: msg := 'Player 2: I up & N down';
  142.     3: msg := 'SPACE to un/pause';
  143.     4: msg := 'TAB to un/mute';
  144.     5: msg := 'ENTER to toggle game mode';
  145.     6: msg := 'BACKSPACE to reset scores';
  146.     7: msg := 'Ping? Pong! Have fun :)';
  147.     8: msg := 'ESC to quit';
  148.     9: msg := 'Copyleft 2024 by Nikita'
  149.     otherwise begin msg_last := 1; exit; end;
  150.   end;
  151.  
  152.   msg_x := msg_last_x;
  153.   msg := ' ' + msg + ' ' + ArenaChar;
  154.  
  155.   if ( length(msg) + msg_x > MaximumWidth ) then begin
  156.     msg := leftstr(msg, MaximumWidth - msg_x + 1);
  157.   end;
  158.  
  159.   if ( msg_x < MinimumWidth ) then begin
  160.     msg_x := length(msg) + msg_last_x;
  161.     msg := rightstr(msg, msg_x);
  162.     msg_x := MinimumWidth;
  163.   end;
  164.  
  165.   if ( msg_x = MinimumWidth ) and ( length(msg) = 1 ) then begin
  166.     inc(msg_last);
  167.     msg_last_x := MaximumWidth;
  168.     msg_delay := MaxHeight + random(MaximumWidth);
  169.   end;
  170.  
  171.   textcolor(ArenaColor);
  172.   gotoxy(msg_x, MaxHeight +1);
  173.   write(msg);
  174.  
  175.   dec(msg_last_x);
  176. end;
  177.  
  178. procedure ErasePaddles;
  179. begin
  180.   for i := MinHeight to MaxHeight do begin
  181.     gotoxy(MinimumWidth +PaddleDelta, i);
  182.     write(' ');
  183.     gotoxy(MaximumWidth -PaddleDelta, i);
  184.     write(' ');
  185.   end;
  186. end;
  187. procedure DrawPaddles;
  188. begin
  189.   ErasePaddles;
  190.   for i := 1 to PaddleHeight do begin
  191.     gotoxy(MinimumWidth +PaddleDelta, paddle1Y +i);
  192.     textcolor(Pad1Color);
  193.     write(PadChar);
  194.     gotoxy(MaximumWidth -PaddleDelta, paddle2Y +i);
  195.     textcolor(Pad2Color);
  196.     write(PadChar);
  197.   end;
  198. end;
  199.  
  200. procedure ResetCoords;
  201. begin
  202.   // init coords
  203.   ballX := MidWidth;
  204.   ballY := MidHeight;
  205.   // ball dir
  206.   ballDX := 1 * scored; // L / R
  207.   ballDY := 1; // random Hi / Lo
  208.   if ( random(2) = 1 ) then begin
  209.     ballDY := -ballDY;
  210.   end;
  211.   // paddles
  212.   paddle1Y := MidHeight - ( PaddleHeight div 2 );
  213.   paddle2Y := MidHeight - ( PaddleHeight div 2 );
  214. end;
  215.  
  216. procedure ResetGame(mode: boolean);
  217. begin
  218.   // game mode has been toggled
  219.   if not ( game_mode = mode ) then begin
  220.     clrscr;
  221.     InitGame;
  222.   end;
  223.   // current mode
  224.   game_mode := mode;
  225.   // altered mode values
  226.   if not game_mode then begin
  227.     PaddleDelta := MaximumWidth div 10;
  228.     PaddleHeight := MaximumHeight div 7;
  229.   end;
  230.   ResetCoords;
  231.   DrawArena;
  232.   DrawPaddles;
  233.   DrawScores;
  234. end;
  235.  
  236. procedure PauseGame;
  237. var c: char;
  238. begin
  239.   repeat
  240.  
  241.     repeat
  242.       DrawBanner;
  243.       delay(50);
  244.     until keypressed;
  245.  
  246.     c := readkey;
  247.     case c of
  248.       #8: ResetScores;
  249.       #9: ton_on := not ton_on;
  250.       #13: ResetGame(not game_mode);
  251.       #27: quitRequested := true;
  252.     end;
  253.  
  254.   until ( c = ' ' ) or ( c = #27 );
  255. end;
  256.  
  257. procedure EraseBall;
  258. begin
  259.   gotoxy(ballX, ballY);
  260.   write(' ');
  261.   // net
  262.   if ( ballX = MidWidth ) then begin
  263.     textcolor(NetColor);
  264.     gotoxy(ballX, ballY);
  265.     write(NetChar);
  266.   end;
  267.   // pads
  268.   if ( ballX = MinimumWidth + PaddleDelta )
  269.   and ( ballY >= paddle1Y )
  270.   and ( ballY <= paddle1Y + PaddleHeight )  
  271.   or ( ballX = MaximumWidth - PaddleDelta )
  272.   and ( ballY >= paddle2Y )
  273.   and ( ballY <= paddle2Y + PaddleHeight )
  274.   then DrawPaddles;
  275. end;
  276.  
  277. procedure UpdateGameState;
  278. var ton: char;
  279. begin
  280.   ton := '_';
  281.   // del ball
  282.   EraseBall;
  283.   // new ball coords
  284.   ballX := ballX + ballDX;
  285.   ballY := ballY + ballDY;
  286.   // check new ball coords
  287.   if (ballY = MinHeight)
  288.   or (ballY = MaxHeight)
  289.   then begin // Hi / Lo Touch
  290.     ballDY := -ballDY;
  291.     ton := 'W';
  292.   end;
  293.   if (ballX = MinimumWidth +PaddleDelta)
  294.   and (ballY >= paddle1Y)
  295.   and (ballY <= paddle1Y +PaddleHeight)
  296.   then begin // Left Paddle Touch
  297.     ton := 'L';
  298.     ballDX := -ballDX;
  299.   end;
  300.   if (ballX = MaximumWidth -PaddleDelta)
  301.   and (ballY >= paddle2Y)
  302.   and (ballY <= paddle2Y +PaddleHeight)
  303.   then begin // Right Paddle Touch
  304.     ton := 'R';
  305.     ballDX := -ballDX;
  306.   end;
  307.   if not game_mode then begin
  308.     if (ballX = MinimumWidth +1) or (ballX = MaximumWidth -1) then begin // L or R
  309.       if (ballY <= MinHeight +BorderHeight) //top
  310.       or (ballY >= MaxHeight -BorderHeight) //bot
  311.       then begin
  312.         ballDX := -ballDX;
  313.         ton := 'W';
  314.       end;
  315.     end;
  316.   end;
  317.   // out ?
  318.   if ( ballX = MaximumWidth ) and ( ton <> 'R' ) then begin
  319.     // Out Right
  320.     ton := 'X';
  321.     inc(score1);
  322.     scored := 1;
  323.     ResetGame(game_mode);
  324.   end;
  325.   if ( ballX = MinimumWidth ) and ( ton <> 'L' ) then begin
  326.     // Out Left
  327.     ton := 'X';
  328.     inc(score2);
  329.     scored := -1;
  330.     ResetGame(game_mode);
  331.   end;
  332.   // draw ball
  333.   textcolor(BallColor);
  334.   gotoxy(ballX, ballY);
  335.   write(BallChar);
  336.   // beep
  337.   if ton_on then case ton of
  338.     'W': atone(500, 50);
  339.     'L': atone(900, 100);
  340.     'R': atone(900, 100);
  341.     'X': tone(300, 600);
  342.   end;
  343.   // game speed
  344.   delay(BallDelay);
  345. end;
  346.  
  347. procedure HandleKeypress(key: char);
  348. begin
  349.   // check pressed key
  350.   case key of
  351.     'e': if not (paddle1Y = MinHeight -1) then dec(paddle1Y);
  352.     'c': if not (paddle1Y = MaxHeight -PaddleHeight) then inc(paddle1Y);
  353.     'i': if not (paddle2Y = MinHeight -1) then dec(paddle2Y);
  354.     'n': if not (paddle2Y = MaxHeight -PaddleHeight) then inc(paddle2Y);
  355.     ' ': PauseGame;
  356.      #8: ResetScores;
  357.      #9: ton_on := not ton_on;
  358.     #13: ResetGame(not game_mode);
  359.     #27: quitRequested := true;
  360.   end;
  361.   // update position
  362.   DrawPaddles;
  363.   // game confort
  364.   delay(PaddDelay);
  365. end;
  366.  
  367. BEGIN
  368.   clrscr;
  369.   cursoroff;
  370.   {$IFDEF UNIX}
  371.   fpsystem('tput civis');
  372.   {$ENDIF}
  373.  
  374.   DeltaWidth := ( WindMaxX - MaximumWidth ) div 2;
  375.   DeltaHeight := ( WindMaxY - MaximumHeight ) div 2;
  376.   window(DeltaWidth, DeltaHeight,
  377.     DeltaWidth+MaximumWidth, DeltaHeight+MaximumHeight);
  378.  
  379.   randomize;
  380.   quitRequested := false;
  381.  
  382.   InitGame;
  383.   ResetGame(game_mode);
  384.   PauseGame;
  385.  
  386.   repeat
  387.     DrawBanner;
  388.  
  389.     while keypressed
  390.       do HandleKeypress(readkey);
  391.     UpdateGameState;
  392.  
  393.   until quitRequested;
  394.   textcolor(darkgray);
  395.  
  396.   {$IFDEF UNIX}
  397.   fpsystem('tput cnorm');
  398.   {$ENDIF}
  399.   cursoron;
  400.   clrscr;
  401. END.

And the tones unit:
Code: Pascal  [Select][+][-]
  1. UNIT
  2.   Tones;
  3.  
  4. INTERFACE
  5.  
  6. procedure
  7.    Tone(frequency_hz, duration_ms: word);
  8. procedure
  9.   aTone(frequency_hz, duration_ms: word);
  10.  
  11. IMPLEMENTATION
  12.  
  13. USES
  14.   process,
  15.   sysutils;
  16.  
  17. procedure Tone(frequency_hz, duration_ms: word);
  18. // uses sysutils
  19. var cmd, duration_s: ansistring;
  20. begin
  21.   {$IFDEF WINDOWS}
  22.   cmd := 'try{[console]::beep(%d,%d)}catch{}';
  23.   cmd := Format(cmd, [frequency_hz, duration_ms]);
  24.   ExecuteProcess('powershell', ['-command', cmd]);
  25.   {$ELSE}
  26.   duration_s := FloatToStrF(duration_ms/1000, ffFixed, 3, 3); // ms to s
  27.   cmd := '(2>/dev/null 1>&2 speaker-test -t sine -f %d)& pid=$!; sleep %ss; kill -9 $pid';
  28.   cmd := Format(cmd, [frequency_hz, duration_s]);
  29.   ExecuteProcess('/bin/sh', ['-c', cmd]);
  30.   {$ENDIF}
  31. end;
  32.  
  33. procedure aTone(frequency_hz, duration_ms: word); //async
  34. // uses sysutils, process
  35. var
  36.   cmd, duration_s: string;
  37.   prc: TProcess;
  38. begin
  39.   prc := TProcess.Create(nil);
  40.   {$IFDEF WINDOWS}
  41.   cmd := 'try{[console]::beep(%d,%d)}catch{}';
  42.   cmd := Format(cmd, [frequency_hz, duration_ms]);
  43.   prc.executable := 'powershell';
  44.   prc.parameters.add('-command');
  45.   {$ELSE}
  46.   duration_s := FloatToStrF(duration_ms/1000, ffFixed, 3, 3); // ms to s
  47.   cmd := '(2>/dev/null 1>&2 speaker-test -t sine -f %d)& pid=$!; sleep %ss; kill -9 $pid';
  48.   cmd := Format(cmd, [frequency_hz, duration_s]);
  49.   prc.executable := '/bin/sh';
  50.   prc.parameters.add('-c');
  51.   {$ENDIF}
  52.   prc.parameters.add(cmd);
  53.   prc.execute;
  54.   prc.free;
  55. end;
  56.  
  57. END.
« Last Edit: March 18, 2024, 04:40:17 pm by Darie »
The sphere of knowledge is in continuous expansion. So is the contact of it's points with the unknown --Blaise Pascal

Handoko

  • Hero Member
  • *****
  • Posts: 5208
  • My goal: build my own game engine using Lazarus
Re: Here's some Pong game. Suggestions? Feedback? Ideeas?
« Reply #1 on: March 17, 2024, 04:06:10 pm »
Nice!

For teaching purpose, your code serves it well. It has game mainloop, easy to understand fully procedural non-OOP approach, and audio.

Computer graphics has been advanced so much. It would be great if you can provide a graphics mode version. I think nowadays kids aren't very interested to see games that created using CRT unit.

Object Oriented Programming is a bit harder, which I think is not suitable for beginners/kids to start with. But teaching them to use OOP components isn't hard, it can greatly reduce the complexity of the code if you use it correctly.

If you interested, you can see my very simple Pong:
https://forum.lazarus.freepascal.org/index.php/topic,42439.msg297949.html#msg297949
« Last Edit: March 17, 2024, 04:08:51 pm by Handoko »

minesadorada

  • Sr. Member
  • ****
  • Posts: 452
  • Retired
Re: Here's some Pong game. Suggestions? Feedback? Ideeas?
« Reply #2 on: March 17, 2024, 04:31:24 pm »
I am surprised how many console apps are still being written - kudos to those young programmers!

Desktop apps have long been replaced with Android/Apple apps which have left me long behind.

I still rely on a desktop computer for day-to-day programming use, whilst using my phone to contact my fieinds and use social media.

I think it's kind-of sad that there's no more easy money to be made from desktop programming, but there again I am 70 years old and a spectator rather than a contributor nowadays.  The early days were too easy to be honest.  Sales folk and managers sold "magic" which programmers were expected to provide, with no guidance nor business acumen.  Most of my early software was written in a text editor, but it was good enough to make "magic"

The current A.I. is based on massive datasets and free/fast communication, along with almost unlimited data space, and I think it is a dead end.  A.I simply iterates what is known, without any creative "spark"  Great for making money, but not any real advance in GAI in my opinion.

There's my rant over.  No need to flame nor agree - I'm a 70-year old programmer who doesn't care about internet popularity but cares about popular trends.
BTW, I love object-oriented programming.  It was a revalation to me when I learned about it after so many years of GOTOs and GOSUBs.  Even variables made of more than one letter was so liberating!
PASCAL is my language of choice, and LAZARUS is my IDE of choice - I love the agility and power of the language, and the fantastic dedication of the LAZARUS open-source team to make such a powerful easy environment for any would-be programmer.
« Last Edit: March 17, 2024, 04:39:27 pm by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

Darie

  • New Member
  • *
  • Posts: 31
Re: Here's some Pong game. Suggestions? Feedback? Ideeas?
« Reply #3 on: March 18, 2024, 05:23:35 pm »
Thank you for your answers :)

For the moment I think I'll stick to text mode only, we will see how things evolve in the next few months. As for the OOP / functional paradigm(s), I know the kids learn fast but I am mostly interested in correctly structuring the thought process (logical schema, pseudocode & imperative implementation) more than achieving some visual result using modern libraries and tools. Although the result obtained by using modern approaches may be appealing either because is pleasing and/or fast to implement, the thing learned this way is mostly using a framework than understanding the underlying logic (declarations, data types, execution order, input, output). I mostly seek teaching to think logically by practicing programming than using a specific tool &/ language which, imho, will be superseded by next AI models.

I found some modern cross-platform re-implementation of the CRT unit https://wiki.freepascal.org/LazTermUtils and I am sure there are many others. Right now, as I mentioned, we hit some drawbacks as there is no GetCharAtXY(x,y) which could be used in collision detection, no screen buffer ( which may be easily implemented using arrays ) and some mechanics for the ini/level/state load & save files. Some other functionalities that may be interesting for a multiplayer game may be some networking functionalities, UDP broadcast in LAN for game discovery, TCP communication. With these the world of algorithms opens in a fun & interactive manner :)
The sphere of knowledge is in continuous expansion. So is the contact of it's points with the unknown --Blaise Pascal

cdbc

  • Hero Member
  • *****
  • Posts: 1165
    • http://www.cdbc.dk
Re: Here's some Pong game. Suggestions? Feedback? Ideeas?
« Reply #4 on: March 18, 2024, 05:53:08 pm »
Hi
Have a looksee here: https://github.com/Warfley/LazTextForms
that's from the same author as the 'LazTermUtils' you mentioned, namely 'Warfley'. It amo. contains a TTextCanvas, maybe it can be of use to you...  8)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

Handoko

  • Hero Member
  • *****
  • Posts: 5208
  • My goal: build my own game engine using Lazarus
Re: Here's some Pong game. Suggestions? Feedback? Ideeas?
« Reply #5 on: March 18, 2024, 07:43:19 pm »
... we hit some drawbacks as there is no GetCharAtXY(x,y) which could be used in collision detection, no screen buffer ( which may be easily implemented using arrays ) and some mechanics for the ini/level/state load & save files.

Looking at the code you wrote, I can sure to say you must have been doing programming for quite a long time. As a less experienced programmer, I shouldn't give you advice. But if you don't mind, I recommend:

https://forum.lazarus.freepascal.org/index.php/topic,38136.msg258381.html#msg258381

Darie

  • New Member
  • *
  • Posts: 31
Re: Here's some Pong game. Suggestions? Feedback? Ideeas?
« Reply #6 on: March 18, 2024, 10:22:49 pm »
Thank you for the suggestions!

I had a look at https://github.com/Warfley/LazTextForms and indeed, what can I say? Thanks for the completion :)

As for the canvases handling they are always a source of inspiration, thank you for that too :)

Otherwise, I think there is no such thing as a bad programmer. There are, over time, some habits you start to notice and include in your workflow: test for in/equalities (not ranges), program as there is no else (go for default, test for exceptions); indent carefully (more than three levels? you should split). In FreePascal we keep seeing some differences (time gain) if these guides are followed even if modern compilers are awesome at translating the code in ASM / binary.

Once again thank you for the heads-up and I'll keep you posted on the evolution of this project. I live this as real fun, as in arduino & agon tinkering, deus ex machina :)

PS: We have started on screen buffering and level management. Maybe what I want is a cross-platform text-mode game engine? ;)
The sphere of knowledge is in continuous expansion. So is the contact of it's points with the unknown --Blaise Pascal

Seenkao

  • Hero Member
  • *****
  • Posts: 552
    • New ZenGL.
Re: Here's some Pong game. Suggestions? Feedback? Ideeas?
« Reply #7 on: March 19, 2024, 04:28:13 am »
Могу я предложить ZenGL? Он работает с графикой используя OpenGL, но для того чтоб его использовать не обязательно знать OpenGL. Уже есть готовый функционал, для отрисовки примитивов, использования спрайтов, работы с ресурсами и многое другое. Всё можно увидеть в демо-версиях идущих вместе с библиотекой.
И, он поддерживает несколько платформ: Windows, Linux, MacOS, Android.  :)

Я не думаю, что это будет намного сложнее чем работать в текстовом режиме. И допустим уже есть готовые функции для проверки столкновения.
Я бы посоветовал вам другие какие-то движки, но не уверен насколько они просты для изучения. В данном случае вам нужно знать только паскаль и уметь им пользоваться. Демонстрации показывают основную функциональность и вместе с ними код документирован. А так же ведётся документация внутри библиотеки ZenGL. На данный момент не полностью, но постепенно заполняются не документированные части.
-----------------------------------------------------

Google translate:
May I suggest ZenGL? It works with graphics using OpenGL, but you don't need to know OpenGL to use it. There is already ready-made functionality for drawing primitives, using sprites, working with resources, and much more. Everything can be seen in the demo versions that come with the library.
And, it supports multiple platforms: Windows, Linux, MacOS, Android. :)

I don't think it will be much more difficult than working in text mode. And let’s say there are already ready-made functions for checking collisions.
I would recommend some other engines, but I'm not sure how easy they are to learn. In this case, you only need to know Pascal and be able to use it. The demos show the basic functionality and along with them the code is documented. Documentation is also maintained inside the ZenGL library. At the moment, not completely, but the undocumented parts are gradually being filled in.
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

Darie

  • New Member
  • *
  • Posts: 31
Re: Here's some Pong game. Suggestions? Feedback? Ideeas?
« Reply #8 on: March 19, 2024, 09:28:43 am »
Hey Mariian, thank you for the suggestion, I already knew about your project, ZenGL, and I am impressed with the work you have done!

Sadly, I don't speak Russian so I have a hard time following your videos on YouTube but I am even more impressed by your tinkering with KolibriOS.

I have downloaded ZenGL and I'll give it a spin in Windows. I am also wondering if there is a way to compile it without Lazarus on a text-only Linux install (Alpine). Any hints/suggestions are welcome :)

-- .ru (translated with ChatGPT 4)
Привет, Мариан, спасибо за предложение, я уже знал о вашем проекте ZenGL, и я впечатлён проделанной вами работой!

К сожалению, я не говорю по-русски, поэтому мне сложно следить за вашими видео на YouTube, но я ещё больше впечатлён вашими экспериментами с KolibriOS.

Я скачал ZenGL и попробую его в Windows. Меня также интересует, можно ли его скомпилировать без Lazarus на Linux только с текстовым интерфейсом (Alpine). Любые подсказки или предложения приветствуются :)
The sphere of knowledge is in continuous expansion. So is the contact of it's points with the unknown --Blaise Pascal

Seenkao

  • Hero Member
  • *****
  • Posts: 552
    • New ZenGL.
Re: Here's some Pong game. Suggestions? Feedback? Ideeas?
« Reply #9 on: March 19, 2024, 10:16:13 am »
Quote from: Darie
Sadly, I don't speak Russian so I have a hard time following your videos on YouTube but I am even more impressed by your tinkering with KolibriOS.
Thanks!
Quote from: Darie
I am also wondering if there is a way to compile it without Lazarus on a text-only Linux install (Alpine). Any hints/suggestions are welcome :)
Загляните в папку "demos/FreePascal". Во всех демках есть "Makefile", все демки можно собрать используя его. Но, если вы самостоятельно собрали FPC или с помощью FPCUPDeluxe, то в "Makefile" вам надо будет: в строке "FPC     = fpc.sh" вместо "fpc.sh" указать полный путь до вашего FPC.

Надеюсь вам это поможет! ;)
-------------------------------------------------------
Google translate:
Look in the "demos/FreePascal" folder. All demos have a "Makefile", all demos can be built using it. But, if you built FPC yourself or using FPCUPDeluxe, then in the “Makefile” you will need to: in the line “FPC = fpc.sh” instead of “fpc.sh” indicate the full path to your FPC.

Hope this helps you! ;)
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

Darie

  • New Member
  • *
  • Posts: 31
Re: Here's some Pong game. Suggestions? Feedback? Ideeas?
« Reply #10 on: April 04, 2024, 11:08:47 pm »
The saga continues! Here's the latest adventure: https://github.com/DariePOP/PopPingPong
The sphere of knowledge is in continuous expansion. So is the contact of it's points with the unknown --Blaise Pascal

 

TinyPortal © 2005-2018