RetroBASIC

Retrogamecoding(.org) => Pulsar2D => Topic started by: Cybermonkey on November 16, 2013, 09:55:51 PM

Title: Welcome to the new board for Pulsar2D
Post by: Cybermonkey on November 16, 2013, 09:55:51 PM
Yes, it's time to reveal the name for my next Lua interpreter and Free Pascal game engione based on SDL2: Pulsar2D
I just finished the Lua bindings with the so far implemented functions. Here you can se the somewhat comprehensive list:
Quote
openwindow
setactivewindow
closeapplication
wait
color
redraw
circle
clearwindow
cls
closewindow
backcolor
inkey
dot
line
getkey
fillcircle
mousex
mousey
mousebutton
ellipse
fillellipse
loadimage
mousehide
mouseshow
keystate
timeleft
setframetimer
colorkey
loadsound
playsound
drawtext
mousezone
loadmusic
playmusic
pausemusic
resumemusic
togglefullscreen
spritewidth
spriteheight
nocolorkey
timerticks
ostype
joystickplugged
getjoyx
getjoyy
getjoybutton
numberjoybuttons
setcaption
triangle
filltriangle
boxcoll
rnd
int
chr
asc
val
left
right
mid
insert
len
time
date
uppercase
lowercase
input
resizewindow
arguments
freeimage
windowwidth
windowheight
bmptext
bmpinput
bmpfont
sqrt
abs
cos
sin
exp
floor
ceil
imagecoll
circlecoll
roundcoll
sidecoll
sync
open
close
finput
eof
eoln
fprint
fileexists
directoryexists
makedir
removedir
changedir
deletefile
system
insidetriangle
insiderectangle
insidecircle
drawtile
tileset
warpmouse
bmpfontheight
bmpfontwidth
rectangle
illrectangle
round
createsprite
freesprite
drawsprite
drawspritepart
spritecolor
setvirtualsize
bmpfontsize
bmpinputcolor
bmpinputbackcolor
bmpfontnagle
textsize
textwidth
textheight
textinputcolor
textinputbackcolor
messagebox
setscalequality
seticon
fullscreen
fademusic
haltmusic
freesound
freemusic
A lot of things have changed, a lot have kept the same. Still missing are sprite animations and particles. These are the next things I wil implement, I just wanted to be sure that the rest is working as expected.
Here is the first example code in Lua:
Code: [Select]
-- first test of Lua bindings to Pulsar2D
require "scancodes"

win=openwindow ("First Test",-1,-1,1024,768)
setactivewindow (win)
setframetimer (250)
image = loadimage ("media/sprite.bmp")
sprite = createsprite (image)
freeimage (image)
x= 150
y= 250

repeat
key=getkey()
cls()
  color (255,255,0,255)
  fillcircle (612,356,50)
  drawtext ("Hello and welcome to Pulsar2D",10,10)
  drawsprite (sprite,x,y,2,2,0,false,true)
 
  if keystate (SCANCODE_LEFT) then
      x=x-1
  end
  if keystate (SCANCODE_RIGHT) then
      x=x+1
  end
  if keystate (SCANCODE_UP) then
      y=y-1
  end
  if keystate (SCANCODE_DOWN) then
      y=y+1
  end
   sync()
until key == SCANCODE_ESCAPE

freesprite (sprite)
closewindow (win)
closeapplication()
With the scancodes.lua one needn't to remember all those numbers. If you want to check the escape key just use SCANCODE_ESCAPE (of course you can use the number if you prefer that but since these are now scancodes they are different from the EGSL keycodes).
A nice thing is that all error message are now inside a message box, so if you type the wrong filename for example... see the attachment.
Title: Re: Wlecome to the new board for Pulsar2D
Post by: Osgeld on November 17, 2013, 05:30:07 AM
looks interesting, thanks for your efforts

regarding the scancodes, would it be a big deal to just embed them, nothing that EGSL runs on currently requires non pc keyboard scancodes (IE adb based MAC)?
Title: Re: Wlecome to the new board for Pulsar2D
Post by: Cybermonkey on November 17, 2013, 10:14:40 AM
Well, as I said you don't need to use the scancodes from scancodes.lua. Just use the numbers instead (you don't have to include scancodes.lua then). But the numbers changed, so better look into the file first. For example escape has the number 41 (used to be 27 on EGSL).
Title: Re: Wlecome to the new board for Pulsar2D
Post by: GEEK on November 17, 2013, 09:42:46 PM
looks great  ;D
Title: Re: Wlecome to the new board for Pulsar2D
Post by: Cybermonkey on November 18, 2013, 08:53:37 AM
Thanks.
On Windows the messageboxes have a native look btw:
Title: Re: Wlecome to the new board for Pulsar2D
Post by: Osgeld on November 19, 2013, 03:14:05 AM
so when's beta going to be out?  :D
Title: Re: Wlecome to the new board for Pulsar2D
Post by: Cybermonkey on November 19, 2013, 08:32:07 AM
I think the first version will be alpha.  ;) But yesterday I implemented sprite animations with some improvements over the EGSL versions. I have to admit that the animation timer in EGSL is just an integer counting to the given value. In Pulsar2D it's a real timer which means if one specifies e.g. 50 the animation frame changes every 50 ms independently from the FPS limiter. Oh and another thing I want to add this evening: animaton loops. Just like in playsound, if one sets the loop to -1 it's looping forver, a 0 loops once, 1 loops twice etc. And another handy thing will be added: a start frame and end frame. So if a sprite consits out of several animations that's no problem anymore. For example like this one
(http://opengameart.org/sites/default/files/styles/medium/public/spritesheet-300x300.jpg)
Title: Re: Wlecome to the new board for Pulsar2D
Post by: piradyne on November 21, 2013, 07:01:08 PM
Looking good man. Keep coding!

Respect!
Title: Re: Wlecome to the new board for Pulsar2D
Post by: Cybermonkey on November 21, 2013, 09:04:34 PM
Thanks Jarrod. By the way, it came to my mind that my game engine should work theoretically with Game Pascal once both are finished ...  ;)
Title: Re: Wlecome to the new board for Pulsar2D
Post by: piradyne on November 22, 2013, 03:09:06 AM
Hi, yes it should work indeed. I can't want to try it out and test the GP compiler in more complex situations. Cool man.
Title: Re: Wlecome to the new board for Pulsar2D
Post by: GEEK on November 23, 2013, 08:06:07 PM
Just saw that you misspelled "welcome" (Wlecome) :p
Still busy with the documentation of EGSL, but I have to work now to so please be patient...

I'm doing the best I can ;)
Title: Re: Welcome to the new board for Pulsar2D
Post by: Cybermonkey on November 23, 2013, 08:41:59 PM
Just saw that you misspelled "welcome" (Wlecome) :p
Still busy with the documentation of EGSL, but I have to work now to so please be patient...

I'm doing the best I can ;)
Thanks, I corrected the mistake.
BTW, documentation for Pulsar2D will start soon. This time I will be using Markdown language so it's easy to convert it to all formats: odt, docx, pdf, html or even epub.  :D
Title: Re: Welcome to the new board for Pulsar2D
Post by: GEEK on November 25, 2013, 07:45:37 AM
Ok, good to know, unfortunately I don't know a lot off html  :-\ so maybe I can't help...
Today I can work on the 'EGSL' pdf, I've noticed that there are a few shortcuts (mailed you about that) in the IDE
that are undocumented.
Title: Re: Welcome to the new board for Pulsar2D
Post by: Osgeld on November 26, 2013, 12:16:05 AM
Quote
de 'EGSL' pdf, I've noticed that there are a few chortcuts (mailed you about that) in de IDE

I can't wait to attempt to read that   ;)
Title: Re: Welcome to the new board for Pulsar2D
Post by: GEEK on November 26, 2013, 08:30:54 AM
woops ;D haha, I was tired,
my native language is Dutch, so I apologize for any grammatical mistakes,
I'm going to spellcheck "THE" pdf if i'm done no worries (;
Title: Re: Welcome to the new board for Pulsar2D
Post by: Cybermonkey on November 26, 2013, 04:28:39 PM
There is no miracle with those shortcuts, just as found in any editor. CTRL + Z,Y,X,C,V - standard shortcuts in the SynEditor Component.

Now a small update about Pulsar2D:
Now I need to test P2D and I'll make a kind of Astorocks HD. Since everything goes into fullscreen I will let the user choose at the beginning her/his best resolution with a small requester I just finished. Just see the attached images and, yes, it's sort of multilingual.

EDIT: I forgot to mention that I implemented a line collision and a circle to rectangle collision. That's quite handy since we do not have a pixel perfect collision anymore.
Title: Re: Welcome to the new board for Pulsar2D
Post by: Cybermonkey on November 26, 2013, 05:29:12 PM
I made the Parallax demo in Lua with the requester for Windows (32). So have fun with different resolutions. Because of size I used 7zip to compress.
Title: Re: Welcome to the new board for Pulsar2D
Post by: piradyne on November 26, 2013, 06:08:03 PM
NICE! Code on bro!
Title: Re: Welcome to the new board for Pulsar2D
Post by: Osgeld on November 27, 2013, 12:21:24 AM
 I cant wait till this comes out!
Title: Re: Welcome to the new board for Pulsar2D
Post by: Cybermonkey on November 30, 2013, 05:17:59 PM
Starting now the documentation. Yeah, I learned by my EGSL failures. So expect a beta release when its documentation is finished ... but it's really motivating using MarkDown language. Especially with pandoc it's possible to have a lot of output possibilities: HTML, DOCX, ODT, PDF and even ePUB.
Title: Re: Welcome to the new board for Pulsar2D
Post by: GEEK on December 01, 2013, 08:04:07 PM
almost done with EGSL documentation to...
Title: Re: Welcome to the new board for Pulsar2D
Post by: Cybermonkey on December 04, 2013, 08:39:00 PM
Something new for Pulsar2D... since I thought it's rather easy to extract a bound script, I implemented a string encryption. At the moment it's a command line program with which you have to encrypt your lua script which is then bound with makeexe and can be executed. It's then decrypted on the fly from Pulsar2D. (Maybe I should call the interpreter "PulsarLua"?).
Anyway, of course it is possible to decrypt the bound script but it makes it more complicated to "steal" ones source.
Here's an example I made with CLScript (yes, it's my testing interpreter again):
Code: [Select]
color (14,1)
cls()
color (1,14)
locate (14,1)
print ("************ G U E S S   T H E   N U M B E R ************")
color (14,1)
print ("")
mylog=open ("log.txt","w")
fprint (mylog, "A simple log for Guess the Number")
close (mylog)

anzahl=int(input("What shall be the highest number? "))

number= (int(rnd()*anzahl)+1) --that's a classic; directly taken from the Commodore 64 ...
try=0
newlog=open("log.txt","a")
repeat
trial = val(input ("Please enter a number between 1 and "..anzahl.." : "))
if trial==0 then
  os.exit()
end
if trial < number then
print ("The number was too low.")
end
if trial > number then
print ("The number was too high.")
end
try=try+1
fprint (newlog, try..". "..trial)
until trial == number
close (newlog)
print ("")
print ("Congratulations! You only needed "..try.." tries!")
print ("")
Now the result looks like (depending on the encryption key):
Code: [Select]
W0Wgn5Nteo7u69vi
W42zvqC
W0Wgn5Nteo7oNXnk
ZIgFNCpEmLFoqc1mLA
F4zrQTvz7utfFfhOWZ+b/VkhWCDxBiaD1zwQMi8l7plFE5fidB7O8072HrN60fJNjmy1cuYsoOvuBTx3txpnfg+CRB
W0Wgn5Nteo7u69vi
F4zrQTvz7utdSB
Ycu7TW7O/DoxxqQ1AD4hQLOvC+ZgTgX66sI
TYuweT2b1YKgEfo41Y47+4SNncKk76R+A8IBQ+aEu/4ESzfNidh09MIQ2gB6S2VHUIWx
W420y2bBfRC4B3dCKA

UsQygjRq8sFa+oDqiHtdpiGzdrHq3gWYdRoEQcgXT0JOip8hz+5vsL9OwcDGqgf7xsnB0m5y2B

b8HGKwnGwmwMDYYZZ6hFFVkK5LUYg31SOFhBcRc/J6I112aBB8h4zNMz9vEP1wNYDt75d+q387qnsyWdRfIGJwo/DHHHY1X4jdpzAUKkypNaph+pG41cgqan
BEG7qEP
b8W+DRp6TRnTu2AB6qdFhF5z3W39OQ6yjmM
HwIkh8kN
8VTOLkwUYcL3G9K08yWZ9MQRKwOcsuVvBruVNcQGn3CNZAMqKD+86vaIihhJ+uNCuNcOMZ5/mkC5xiKgob12vEcCKgJ5qpBNA49c
8hit2R3MdpsVDgmBWFWF6QE
8Fm5D4cDZ2v0IoQ8
8RC+BB
8hit2R3MdpsVecSNgfMloCLUeaNAMgM
8hU7PWYmCu1V8G2y0gbERuKBKYwl6xG9OBxryc6cWKkNuBC
8RC+BB
8hit2R3MdpsVeUCW8zpEYc9p3z9CN1J
8hU7PWYmCu1V8G2y0gbERuKBKYwl6xG9OBxryc6dapFXCocU
8RC+BB
8VTObIH52E3qbA
8dScqFhO2IpD64htKHYhcugce3OVwktC5WaEYmrJMicgslK
Aoi1YmMx+g95bJOl8ved9XiuAbdx
W420y2bBfdSYj5W9mfB
F4zrQTvz7utdSB
F4zrQTvz7u9FOq6Z3EZNAcnN/qbJGZj88mDMXEQLOE+hYWpSIQVLCNFOQUzKCm0bJu9fCuOrqGk3bqJ
F4zrQTvz7utdSB
Nice, isn't it?  ;D
Title: Re: Welcome to the new board for Pulsar2D
Post by: cvirus on December 04, 2013, 09:22:40 PM
It's cool.  8)
Title: Re: Welcome to the new board for Pulsar2D
Post by: piradyne on December 04, 2013, 09:23:31 PM
+1
Title: Re: Welcome to the new board for Pulsar2D
Post by: Cybermonkey on December 12, 2013, 09:31:22 PM
Okay guys, now the last version of my demo. It has three parts and is very old school with raster bars and such ... Since the file is now about 4 MB I uploaded to retrogamecoding. That's the file: http://egsl.retrogamecoding.org/media/pulsardemo/PulsarDemo.7z

And a few impressions:
(http://egsl.retrogamecoding.org/media/pulsardemo/requester.png)

(http://egsl.retrogamecoding.org/media/pulsardemo/part1.png)
This part is already known by you. I changed the Parallax logo with the Pulsar2D logo.

(http://egsl.retrogamecoding.org/media/pulsardemo/part2.png)
This is pretty much the same as you can find in PlayBasic: rotating sprites. (All sprites have different sizes and speed and rotation speed! Even if you choose 5000)

(http://egsl.retrogamecoding.org/media/pulsardemo/part3.png)
Another scroller with raster/copper bars. They are just one image ...
Title: Re: Welcome to the new board for Pulsar2D
Post by: Cybermonkey on December 16, 2013, 03:41:39 PM
Sorry, I am still offline at home but at the moment I am working on AstroRocksHD which will be a complete demo game for Pulsar2D. (It's actually fast paced like none I've seen before ...)
Title: Re: Welcome to the new board for Pulsar2D
Post by: Osgeld on December 17, 2013, 01:35:59 AM
cool demo, cant wait to play the game, and am giddy about the release (soon? ;D)
Title: Re: Welcome to the new board for Pulsar2D
Post by: Osgeld on January 18, 2014, 01:32:27 AM
I know we all have real lives, and busy schedules, hell I am the worst about that kind of stuff getting into my "fun time" so Im not pressuring or anything, just looking to see whats up in the world of pulsar!

Thanks
Title: Re: Welcome to the new board for Pulsar2D
Post by: Cybermonkey on January 23, 2014, 10:00:14 PM
Sorry for the delay. A beta version will be released soon on this forum. A "full" version will be released when I am finished with the documentation and the web site.
Title: Re: Welcome to the new board for Pulsar2D
Post by: Osgeld on January 24, 2014, 01:05:20 AM
we dont need documentation, just write something that tells us what everything does  ;D

good news, looking forward to beta
Title: Re: Welcome to the new board for Pulsar2D
Post by: Tomaaz on January 24, 2014, 10:22:06 AM
we dont need documentation...

I don't know who's "we", but I'm pretty sure that majority of users do need a documentation.
Title: Re: Welcome to the new board for Pulsar2D
Post by: Osgeld on January 27, 2014, 04:34:18 AM
(https://i.chzbgr.com/maxW500/5067670016/h2593AF2F/)
Title: Re: Welcome to the new board for Pulsar2D
Post by: GEEK on January 28, 2014, 01:12:47 AM
He just want to say that (and I am one of them) for a lot of people documentation can be a lot of help!
if you start to learn programming its like flying an airplane without knowing the function of each button,
maybe you can guess a little but if you want to fly without problems and questions you have to study ;)
Title: Re: Welcome to the new board for Pulsar2D
Post by: Tomaaz on January 28, 2014, 10:23:31 AM
Well, Pulsar2D is addressed to beginners and hobbyists and it obviously should come with a good documentation. In the past I tried to push some beginners to use EGSL. They liked the examples, but lack of documentation was a big problem. I'm not saying that with a good Pulsar2D documentation this place will soon have hundreds of active users. It didn't happen for NaaLaa, but Pulsar2D is based on Lua which is well known in game industry, so... One is for sure - without a documentation it's not gonna go anywhere.
Title: Re: Welcome to the new board for Pulsar2D
Post by: Cosmo on January 28, 2014, 01:44:00 PM
Yes, a good documentation is always welcome, especially for beginners.
But more important are snippets or bigger examples, this is what teaches.

A documentation describes only the instruction set and is for advanced a good help,
of course, for beginner too. 

But advanced  programmer want know what  the parameters are, and how must they deal with it.  This is what teaches a documentation.

Beginner are thinking  a documentation teaches programming. I guess.
Title: Re: Welcome to the new board for Pulsar2D
Post by: Tomaaz on January 28, 2014, 04:06:09 PM
A documentation describes only the instruction set... 

??? I think what you mean is a manual or language reference. "Documentation" means everything - manuals, reference, tutorials, books, code examples etc.
Title: Re: Welcome to the new board for Pulsar2D
Post by: Rick3137 on March 10, 2014, 05:38:32 PM


 I am having a little problem with getting pulsar to work with .lua files.
My Windows7 still thinks that they run with EGSL. and it will not let me change it.
 The only way that I can run pulsar2d is with a copy of cmd.exe put into the folder that
contains pulsarlua.exe and sample.lua,  along with all the DLL files.
 Is there an easy way to fix this?
Title: Re: Welcome to the new board for Pulsar2D
Post by: Cybermonkey on March 10, 2014, 07:06:00 PM
I am having a little problem with getting pulsar to work with .lua files.
My Windows7 still thinks that they run with EGSL. and it will not let me change it.
 The only way that I can run pulsar2d is with a copy of cmd.exe put into the folder that
contains pulsarlua.exe and sample.lua,  along with all the DLL files.
 Is there an easy way to fix this?
Ok, that's more of a Windows problem.  Since Pulsar2D isn't installed as a regular program, a work-around would be to drag and drop the Lua file onto the pulsarlua.exe. Or click with your right mouse button upon a Lua file and choose "open with ..." or something like that. Maybe you can choose p2d. Or install Geany, and change the execute path of the Lua interpreter to the pulsarlua executable.
Title: Re: Welcome to the new board for Pulsar2D
Post by: Rick3137 on March 10, 2014, 09:21:44 PM
  Drag and drop worked just fine. Thanks for the tip.

  For people who get confused as easy  as I do, here's a slight improvement on this method:

 I unzipped the files to a safe out of the way spot and right clicked on pulsarlua.exe and selected the  option - make shortcut.
Then I put this shortcut in the folder where I keep my .lua text files. I can now drag and drop any .lua file into the
shortcut and it will run. No need for a set up program.
Title: Re: Welcome to the new board for Pulsar2D
Post by: Luposian on March 01, 2015, 02:41:10 AM
Let's refresh this thread, shall we?  First post in months and months!  Let's get this party rockin' again!

Ok, I'm learning a few things... Cybermonkey is coding Pulsar2D.  Apparently he also coded EGSL.  Marcus Mangold may or may not be Cybermonkey.  And... drumroll please... PulsarLua is actually Pulsar2D.  Or... is PulsarLua the main program within Pulsar2D?

Speak to me, ye from the depths and recesses and shadows of past posts!  I command ye... A R I S E  FROM  THY  ANCIENT  SLUMBER!!! :-D
Title: Re: Welcome to the new board for Pulsar2D
Post by: Cybermonkey on March 01, 2015, 09:11:42 AM
The game engine is called Pulsar2D. PulsaLua is the Lua interpreter which uses the game engine. Of course you can use Pulsar2D with FreePascal, too.
And yes, I am Markus.  ;)
Quote
FIRST WITCH
When shall we three meet again?
In thunder, lightning, or in rain?

SECOND WITCH
When the hurly-burly's done,
When the battle's lost and won.

THIRD WITCH
That will be ere the set of sun.
Title: Re: Welcome to the new board for Pulsar2D
Post by: Cybermonkey on March 01, 2015, 09:20:17 AM
The game engine is called Pulsar2D. PulsaLua is the Lua interpreter which uses the game engine. Of course you can use Pulsar2D with FreePascal, too.
And yes, I am Markus.  ;)

You can try an old school demo made with PulsarLua for Windows: http://egsl.retrogamecoding.org/media/pulsardemo/PulsarDemo.7z

Quote
FIRST WITCH
When shall we three meet again?
In thunder, lightning, or in rain?

SECOND WITCH
When the hurly-burly's done,
When the battle's lost and won.

THIRD WITCH
That will be ere the set of sun.
Title: Re: Welcome to the new board for Pulsar2D
Post by: Luposian on March 01, 2015, 03:34:41 PM
I really enjoyed the Pulsar Demo.  Reminds me a little of The Cuddley Bear Demos, on the Atari ST... ah ,the memories!

Now, how soon will Pulsar2D be available for Windows, MacOS X, Linux, and/or Haiku OS?  This new version has been being talked about for YEARS (since 2012, I think)!

Title: Re: Welcome to the new board for Pulsar2D
Post by: Luposian on March 01, 2015, 03:47:12 PM
The game engine is called Pulsar2D. PulsaLua is the Lua interpreter which uses the game engine. Of course you can use Pulsar2D with FreePascal, too.
And yes, I am Markus.  ;)

Thanks for the clarification.  Seems you're quite the one-man show, 'round these parts.  But, given that, could ye spare a few processor cycles to help me learn more about programming in EGSL (since Pulsar2D isn't quite out yet)?  I'm having tons of fun, but it's a real pain having to figure it out all by myself.  I won't post more here, but if you could hop over to the EGSL threads, I'd really appreciate it.