Recent

Author Topic: Pascal Fantasy Console  (Read 520 times)

x2nie

  • Sr. Member
  • ****
  • Posts: 487
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Pascal Fantasy Console
« on: October 20, 2020, 03:42:29 pm »
Hi everyone !


I just landed into fantasy console world,
and meet to say Pico-8, LIKO-12, Picolove, Neko8, Tic-computer, Pixel Vison 8, and many more ..
it's quite mind blowing while playing with small screen & big pixels.
A lot of them is FOSS; but, I wonder that none of them is written in pascal yet. :o
(at least I didn't found any)


And, hey, isn't freepascal/lazarus a perfect tool to build such one?
Lazarus already able to compile for most platform (including android & raspi) and machines (x86,arm,etc)
no need specific VM,
and luckily: there are many scripting language for lazarus like (pascalscript, python, php, lua, javascript?)
 :o


So maybe let start discussion about it,
I think it would be a lot of fun if we could write one. 




hmm....
(if there was no any fantasy console written in freepascal/lazarus)
maybe the spec is something like this:
* There are 3 area to develop: Game Player. Game Cassette (the game), Game Editor.
* Game Player is an application built with lazarus, in which the game is running on it
* Game Cassette is a file contained anything (sprites, tilemap, script) to run the game
* Game Editor is an application to develop a game cassette, such as writing script, drawing sprites etc.
well,
since using Lazarus gives us rich of options, the possibility is then open to us to provide much implemented application. Let say, someone may create Game Player part using LCL, while other might use MSE, fpGUI,  dedicated android, or targeting arduino, or export as web, or terminal/text console; who knows?
You can add advanced technology like openGL, OpenAudioLib, SDL, SSE-aware, unimagined tech, etc.
So,
obviously the cassette format should be portable (just like as fantasy console game file in common)
if we want all game player variant able to run many games.
Yeah, you guessed it that the game is in a text format, additionally can be converted into png file.


That is said, game editor can be your favorite text editor, or a specific-purpose application written in lazarus (as you might guess) for drawing sprites, making sounds, music and editing game source code, of course.
-------------------


Nah, what you are saying now?
Let's start discussing  ;D 8-) :P

When you were logged in, you can see attachments.
Lazarus Trunk @ Windows7 64bit, XP 32bit, Debian under VirtualMachine

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1072
    • Burdjia
Re: Pascal Fantasy Console
« Reply #1 on: October 20, 2020, 09:12:05 pm »
That would be great.

Unfortunately I have a ton of projects so I can help (now), but you can use Allegro.pas so that would be like I helped...  ;D
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

x2nie

  • Sr. Member
  • ****
  • Posts: 487
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Pascal Fantasy Console
« Reply #2 on: November 08, 2020, 01:40:04 pm »
Hi Ñuño_Martínez  ;D


Yeah, Allegro5-pas is awesome. I have played with it for several days.
and currently my fantasy console can play this game cassette:


Code: Pascal  [Select][+][-]
  1. lite8 https://github.com/lite8
  2.  
  3. ver. 0.1
  4.  
  5.  
  6. __script__
  7. .pas
  8. program HelloWorld02;
  9.  
  10.  
  11. var
  12.   x,y: integer;
  13. procedure _init();
  14. begin
  15.   x:=64;
  16.   y:=64;
  17. end;
  18.  
  19.  
  20. procedure _update();
  21. begin
  22.     if btn(0) then X := X - 1;
  23.     if btn(1) then X := X + 1;
  24.  
  25.  
  26.     if btn(2) then Y := Y - 1;
  27.     if btn(3) then Y := Y + 1;
  28.        
  29.        
  30.     { if btn(10) then dec(Y,5); //pgup }
  31.     { if btn(11) then inc(Y,5); }
  32.        
  33.     if btn(12) then dec(Y);    
  34.     if btn(13) then inc(Y);
  35. end;  
  36.  
  37. procedure _draw();
  38. begin
  39.   cls(1);
  40.   color(7);
  41.   //al_put_pixel (x, y, Red);
  42.   pset(x,y,9);
  43. //   print('halo');
  44.   { print('world',30,8); }
  45.   //-1
  46. //   print     (  ' hey',8,8);
  47.   //0
  48. //   print(
  49.         // 'yolayhey',16,16); print('fooh!');
  50.   //a
  51.   print('Hello',30,64, 11);
  52.   //b
  53.   print('World !');
  54.   //c
  55.   spr(0, x,y);
  56. end;
  57.  
  58.  
  59. begin
  60. end.
  61.  
  62.  
  63. __palette__
  64. later..
  65. 0|ff8800
  66. a|aabbcc
  67. f|0088ff
  68.  
  69.  
  70. __sprite__
  71. 00444440004444400000000000000000
  72. 00eeeee000eeeee00000000000000000
  73. 0ef75f500ef75f500000000000000000
  74. 0efffff00efff8f00000000000000000
  75. 000ee00000eeee000000000000000000
  76. 00eeee000f0ee0f00000000000000000
  77. 0f0e40f00f0e40f00000000000000000
  78. 00e0040000e004000000000000000000
  79. 00044444000444440004444400044444
  80. 0eeeeeee0e0eeeeee00eeeeee0eeeeee
  81. e00ff75fe0eff75f0eeff75f0e0ff75f
  82. 000ffff8000ffff8000ffff8000ffff8
  83. 0feee0000feee0000feee0000feee000
  84. 000ee000000ee000000ee000000ee000
  85. 0ee0400000e400000440e000004e0000
  86. 0000400000e400000000e000004e0000
  87. 00044444e00444440000000000000000
  88. 00eeeeee0eeeeeee0444440000000000
  89. 0e0ff75f000ff75f0eeeee0000000000
  90. e00ffff8000ffff8ef75f50000000000
  91. 00eee0000000eee0efff8f0000000000
  92. 0f0ee0000000ee0f00eeeef000000000
  93. 004e000000000e400f0ee40000000000
  94. 04e00000000000e40000ee4400000000
  95.  
  96.  
  97.  
  98.  
  99. __maptile__
  100. 0123456789...256
  101. later..
  102.  
  103.  
  104. __sound__
  105. later..
  106.  
  107.  
  108. __music__
  109. later..
  110.  



The pascal code above is executed via custom pascal-script (to work around "overload" procedure/function).
It was lot of fun developing this project. In future I may develop similar framework using other backend like ZenGL, Libreto-FPC, msegui, oh... there are tons of option to work with, actually;
each of them will able to run game cassette like above  ;D




Now,  Ñuño_Martínez, my question: how to create 4bit / 16 palette bitmap with Allegro5.pas ?
I was searching, but allegro c/c++ was not support 4bit bitmap. any solution?
When you were logged in, you can see attachments.
Lazarus Trunk @ Windows7 64bit, XP 32bit, Debian under VirtualMachine

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1072
    • Burdjia
Re: Pascal Fantasy Console
« Reply #3 on: November 08, 2020, 07:46:13 pm »
Looks great!  Good job.

Now,  Ñuño_Martínez, my question: how to create 4bit / 16 palette bitmap with Allegro5.pas ?
I was searching, but allegro c/c++ was not support 4bit bitmap. any solution?
I theory you can write a sort of driver to support such bitmaps, but in Allegro5 is quite annoying since it uses GLSL & HLSL for final rendering and, as far as I know, internal API isn't as strightforward than Allegro4.

You can try a workaround: example ex_palette.pas shows how to fake 8bpp/256colour palette modes.  May be you can do something to convert the 4bit bitmap in to 8bit bitmaps.

Actually I want 8bpp/256 color palette for my game engine and I'm considering the possibility to build my very own game library supporting old-school stuff like that (8bpp graphic, MIDI sound, etc) in modern (and old) architectures.  But first I must finish a game for a customer.
« Last Edit: November 08, 2020, 07:48:05 pm by Ñuño_Martínez »
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

 

TinyPortal © 2005-2018