RetroBASIC
Retrogamecoding(.org) => Pulsar2D => Topic started 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:
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:
-- 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.
-
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)?
-
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).
-
looks great ;D
-
Thanks.
On Windows the messageboxes have a native look btw:
-
so when's beta going to be out? :D
-
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)
-
Looking good man. Keep coding!
Respect!
-
Thanks Jarrod. By the way, it came to my mind that my game engine should work theoretically with Game Pascal once both are finished ... ;)
-
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.
-
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 ;)
-
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
-
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.
-
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 ;)
-
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 (;
-
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:
- animation system is finished
- particle system is finished
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.
-
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.
-
NICE! Code on bro!
-
I cant wait till this comes out!
-
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.
-
almost done with EGSL documentation to...
-
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):
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):
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
-
It's cool. 8)
-
+1
-
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 ...
-
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 ...)
-
cool demo, cant wait to play the game, and am giddy about the release (soon? ;D)
-
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
-
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.
-
we dont need documentation, just write something that tells us what everything does ;D
good news, looking forward to beta
-
we dont need documentation...
I don't know who's "we", but I'm pretty sure that majority of users do need a documentation.
-
(https://i.chzbgr.com/maxW500/5067670016/h2593AF2F/)
-
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 ;)
-
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.
-
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.
-
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.
-
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?
-
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.
-
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.
-
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
-
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. ;)
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.
-
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
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.
-
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)!
-
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.