Author Topic: Pulsar2D is still alive ...  (Read 6744 times)

Cybermonkey

  • Administrator
  • Hero Member
  • *****
  • Posts: 573
    • View Profile
    • Home of EGSL
Pulsar2D is still alive ...
« on: 29. August 2015, 12:03:41 »
... and so I am.  ;)
I just wanted to let you know that I needed a time-out from programming. But now I am back and have some news for you.
Pulsar2D will be released definitely this year. What can you expect? First something you might not like: PulsarLua will not come with its own IDE, you'll have to use a third party editor like Geany or Textadept. (I will provide syntax files for them, though). Then I removed the new particle system because it slowed things down but I added the simple particles again known from EGSL.
On the other hand you will be able to make your games in three (3!) languages now: Lua, FreePascal and FreeBASIC. Yes, that's right, I just finished the port for FreeBASIC, although it needs some testing. You will also get examples for all three languages. Executables made with all three languages work fine with Windows 10.
Here comes an example, how a FreeBASIC app looks like (a simple particle example):
Code: [Select]
#include once "pulsar2d.bi"

using p2d

dim win as p2d.window
dim partsize as integer = 3
dim key as integer
dim mysprite as p2d.sprite
dim mouse as p2d.sprite

win = openwindow ("Pulsar2D in FreeBASIC",-1,-1,1366,768)
setactivewindow (win)
setvirtualsize (1366,768)
backcolor (0,0,0,255)
setframetimer (100)
hidemouse()
mysprite = loadsprite ("media/particle.png")
mouse = loadsprite ("media/bluepointer.png")

spritecolor (mysprite, 255,200,0,55)

setsimpleparticlesize (partsize,rrandom)
SetSimpleParticleImage (mysprite)
textsize (2)
do
clearwindow
key=p2d.getkey()
color (255,255,0,255)
drawtext ("Press 1-6 for particle type, press left mousbutton to draw, ESC to quit.",0,0)

if key = SDL_SCANCODE_1 then
   resetsimpleparticles()
   setsimpleparticletype(ptFillBox)
end if

if key = SDL_SCANCODE_2 then
   resetsimpleparticles()
   setsimpleparticletype(ptFillCircle)
end if

if key = SDL_SCANCODE_3 then
   resetsimpleparticles()
   setsimpleparticletype(ptBox)
end if

if key = SDL_SCANCODE_4 then
   resetsimpleparticles()
   setsimpleparticletype(ptCircle)
end if

if key = SDL_SCANCODE_5 then
   resetsimpleparticles()
   setsimpleparticletype(ptDot)
end if

if key = SDL_SCANCODE_6 then
   resetsimpleparticles()
   setsimpleparticletype(ptImage)
end if

if key= SDL_SCANCODE_F then
togglefullscreen
resizewindow (1366,768)
end if

if mousebutton()=1 then
createsimpleparticles (mousex,mousey,50,150,255,200,0,55)
end if

drawsprite (mouse,mousex,mousey,1,1,0,false,false)
updatesimpleparticles()

if mousex >= windowwidth then
warpmouse (windowwidth,mousey)  'needed for full screen
end if

if mousey >= windowheight then
warpmouse (mousex,windowheight) 'needed for full screen
end if


sync()
loop until key=SDL_SCANCODE_ESCAPE

closewindow(win)
freesprite (mysprite)
freesprite (mouse)
closeapplication()

EDIT: The new webpage will be on pulsar2d.org
« Last Edit: 29. August 2015, 12:05:14 by Cybermonkey »
Best regards,
Cybermonkey

Cybermonkey

  • Administrator
  • Hero Member
  • *****
  • Posts: 573
    • View Profile
    • Home of EGSL
Re: Pulsar2D is still alive ...
« Reply #1 on: 29. August 2015, 13:12:35 »
Oh, another thing I forgot: Pulsar2D is licensed under the zlib license. so you can use the framework for any purposes even commercial ones.
Best regards,
Cybermonkey

Bereb

  • Newcomer
  • *
  • Posts: 47
    • View Profile
Re: Pulsar2D is still alive ...
« Reply #2 on: 01. September 2015, 18:41:38 »
;D Fine! Cool!
Thanks a lot  in advance 8)
Regards, Bertrand :)
** Lubuntu 14.04 (Intel Celeron CPU 2.66GHz - 1280MiB) **

Tomaaz

  • Guest
Re: Pulsar2D is still alive ...
« Reply #3 on: 02. October 2015, 11:37:24 »
I know you're working on documentation, but could you make Pulsar available to download? The whole counting and "be patient" thing is a bit silly. You're not Apple and Pulsar isn't a new iPhone. ;)

Cybermonkey

  • Administrator
  • Hero Member
  • *****
  • Posts: 573
    • View Profile
    • Home of EGSL
Re: Pulsar2D is still alive ...
« Reply #4 on: 11. October 2015, 17:38:46 »
Ok, the site is alive and all downloads are available. I couldn't finish anything I wanted to, because I lost a lot of time for building the webpage. Yes, the on which is now online was done fast. I first installed Joomla, but I thought it is too bulky. After that I tried Websitebaker but I got a lot of php errors. So it's just an old fashioned pandoc generated website for now. A better one will follow soon also with a finished documentation.
I am sorry for any inconvenience.
Best regards,
Cybermonkey

Rick3137

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Rick's Programs
Re: Pulsar2D is still alive ...
« Reply #5 on: 13. October 2015, 15:46:17 »
   Nice work, Mark.
   Translating from EGSL can be tricky.
     The color command now has 4 numbers, instead of 3.
     If you do like I did, and make the last number a 0, you will get a blank screen.
   That Geany program is a trick to use. Some of those buttons on it needs to be set up and I am still working on it.
   The file, filetypes.lua needs to be put in the geany data folder. That gives it plenty of color.
   I don't know how, but clicking on any .lua file, runs it.
   I will try later to make an EXE

« Last Edit: 13. October 2015, 16:09:22 by Rick3137 »
http://rb23.yolasite.com  Ricks Programs
http://rb27.synthasite.com   Sight and Sound

Bereb

  • Newcomer
  • *
  • Posts: 47
    • View Profile
Re: Pulsar2D is still alive ...
« Reply #6 on: 13. October 2015, 17:01:44 »
Nice !
It was not too hard to modify some EGSL scripts, functions are nearly similar, except for few details.

@Rick3137: the 4th number in color commands corresponds to transparency (alpha channel) ; 0 is total transparency, 255 is opacity. It's very usefull.
 
There is just a little problem with the current window: after it had been reduced or overlapped, it does not refresh its content (whereas  EGSL did).
« Last Edit: 13. October 2015, 17:03:44 by Bereb »
Regards, Bertrand :)
** Lubuntu 14.04 (Intel Celeron CPU 2.66GHz - 1280MiB) **

Bereb

  • Newcomer
  • *
  • Posts: 47
    • View Profile
Re: Pulsar2D is still alive ...
« Reply #7 on: 13. October 2015, 18:09:25 »
Another remark (if it could help) : for same scripts, EGSL is a bit faster than Pulsar2D/PulsarLua ; there is a difference of 0.3 to 0.4 seconds (in favor of EGSL)
Regards, Bertrand :)
** Lubuntu 14.04 (Intel Celeron CPU 2.66GHz - 1280MiB) **

Cybermonkey

  • Administrator
  • Hero Member
  • *****
  • Posts: 573
    • View Profile
    • Home of EGSL
Re: Pulsar2D is still alive ...
« Reply #8 on: 13. October 2015, 18:41:31 »
Nice !
It was not too hard to modify some EGSL scripts, functions are nearly similar, except for few details.

@Rick3137: the 4th number in color commands corresponds to transparency (alpha channel) ; 0 is total transparency, 255 is opacity. It's very usefull.
 
There is just a little problem with the current window: after it had been reduced or overlapped, it does not refresh its content (whereas  EGSL did).

For refreshing the window you need always to do a sync().
Best regards,
Cybermonkey

Cybermonkey

  • Administrator
  • Hero Member
  • *****
  • Posts: 573
    • View Profile
    • Home of EGSL
Re: Pulsar2D is still alive ...
« Reply #9 on: 13. October 2015, 18:41:52 »
Another remark (if it could help) : for same scripts, EGSL is a bit faster than Pulsar2D/PulsarLua ; there is a difference of 0.3 to 0.4 seconds (in favor of EGSL)
Do you have an example?

EDIT: I just tested the fractals.lua; see for yourself. Pulsar2D is faster (the mentioned 0.3 seconds). Do you use a hardware accelerated graphics driver?
« Last Edit: 13. October 2015, 18:51:07 by Cybermonkey »
Best regards,
Cybermonkey

Rick3137

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Rick's Programs
Possible print problem
« Reply #10 on: 14. October 2015, 00:34:05 »
    I made a short program to draw a hexagon.
    I did a sync(), to show it. Worked fine.
    I then did a drawtext command and did another sync() to show that.
    The 2nd sync() eraised the hexagon.
    Is that normal?
Code: [Select]
   

win = openwindow ("Hexagon",-1,-1,640,480)
setactivewindow (win)

textsize(2)
backcolor (0,0,0,255)

cls()   
Pi2=6.28318
 Ang1 = Pi2/6 ; Ang = 0 ; x = 400.0 ; y = 400.0
 color (255,0,0,255)


 function RotateLeft()
      Ang = Ang + Ang1
      if Ang > Pi2 then
      Ang = Ang - Pi2
  end
 end
  function MoveSteps ( distance )

        dx = cos(Ang) * distance
        dy = sin(Ang) * distance
        x2 = x + dx
        y2 = y - dy

        line( x,y,x2,y2)
        x = x2 ; y = y2
       
   end   


color (0,0,255,255)       
         cnt = 0
          while cnt < 6
          do                 -- the pair of keywords " do " and " end " are like brackets in c-language
             MoveSteps ( 100 )
             RotateLeft()
             cnt = cnt + 1
          end
--sync()
drawtext("Press any key to exit ..",0,0)
sync()
key=inkey()
closewindow(win)             -- This ends the program.
closeapplication()





http://rb23.yolasite.com  Ricks Programs
http://rb27.synthasite.com   Sight and Sound

Bereb

  • Newcomer
  • *
  • Posts: 47
    • View Profile
Re: Pulsar2D is still alive ...
« Reply #11 on: 14. October 2015, 11:11:52 »
There is just a little problem with the current window: after it had been reduced or overlapped, it does not refresh its content (whereas  EGSL did).

For refreshing the window you need always to do a sync().

Yes, I did it: redraw() or sync(). I must express wrong (sorry for my english!)  :-[
I meant the Pulsar window does not display its content again after its status has been modified, e.g. by resizing (minimizing)  the window or when it has been hidden by another window.


Another remark (if it could help) : for same scripts, EGSL is a bit faster than Pulsar2D/PulsarLua ; there is a difference of 0.3 to 0.4 seconds (in favor of EGSL)
Do you have an example?

EDIT: I just tested the fractals.lua; see for yourself. Pulsar2D is faster (the mentioned 0.3 seconds). Do you use a hardware accelerated graphics driver?

 :-\ Sorry again, I didn't specify the scripts I used. But it was precisely this same example, and another too.
I don't think I have a hardware accelerated graphics driver in my old computer (and I don't know how I can detect it).
However, with the last release of Löve, for instance, I noticed a real improvement (speed, etc.), in relation to its previous versions − moreover I'm not very comfortable with the “programming style” of Löve.

On the other hand, I must say that animations are at least twice faster (maybe more) with Pulsar than with EGSL. My reckonings are not accurate ; I just modified all my temporizings on the run, multiplying them (or reducing the steps) by two.
« Last Edit: 14. October 2015, 11:24:19 by Bereb »
Regards, Bertrand :)
** Lubuntu 14.04 (Intel Celeron CPU 2.66GHz - 1280MiB) **

Cybermonkey

  • Administrator
  • Hero Member
  • *****
  • Posts: 573
    • View Profile
    • Home of EGSL
Re: Possible print problem
« Reply #12 on: 14. October 2015, 17:27:26 »
    I made a short program to draw a hexagon.
    I did a sync(), to show it. Worked fine.
    I then did a drawtext command and did another sync() to show that.
    The 2nd sync() eraised the hexagon.
    Is that normal?
Code: [Select]
   

win = openwindow ("Hexagon",-1,-1,640,480)
setactivewindow (win)

textsize(2)
backcolor (0,0,0,255)

cls()   
Pi2=6.28318
 Ang1 = Pi2/6 ; Ang = 0 ; x = 400.0 ; y = 400.0
 color (255,0,0,255)


 function RotateLeft()
      Ang = Ang + Ang1
      if Ang > Pi2 then
      Ang = Ang - Pi2
  end
 end
  function MoveSteps ( distance )

        dx = cos(Ang) * distance
        dy = sin(Ang) * distance
        x2 = x + dx
        y2 = y - dy

        line( x,y,x2,y2)
        x = x2 ; y = y2
       
   end   


color (0,0,255,255)       
         cnt = 0
          while cnt < 6
          do                 -- the pair of keywords " do " and " end " are like brackets in c-language
             MoveSteps ( 100 )
             RotateLeft()
             cnt = cnt + 1
          end
--sync()
drawtext("Press any key to exit ..",0,0)
sync()
key=inkey()
closewindow(win)             -- This ends the program.
closeapplication()
Nope, that's not normal. I tried your example with one and two syncs and it works nice here. Meaning with two syncs nothing is erased ...
Best regards,
Cybermonkey

Cybermonkey

  • Administrator
  • Hero Member
  • *****
  • Posts: 573
    • View Profile
    • Home of EGSL
Re: Pulsar2D is still alive ...
« Reply #13 on: 14. October 2015, 17:31:01 »
There is just a little problem with the current window: after it had been reduced or overlapped, it does not refresh its content (whereas  EGSL did).

For refreshing the window you need always to do a sync().

Yes, I did it: redraw() or sync(). I must express wrong (sorry for my english!)  :-[
I meant the Pulsar window does not display its content again after its status has been modified, e.g. by resizing (minimizing)  the window or when it has been hidden by another window.


Another remark (if it could help) : for same scripts, EGSL is a bit faster than Pulsar2D/PulsarLua ; there is a difference of 0.3 to 0.4 seconds (in favor of EGSL)
Do you have an example?

EDIT: I just tested the fractals.lua; see for yourself. Pulsar2D is faster (the mentioned 0.3 seconds). Do you use a hardware accelerated graphics driver?

 :-\ Sorry again, I didn't specify the scripts I used. But it was precisely this same example, and another too.
I don't think I have a hardware accelerated graphics driver in my old computer (and I don't know how I can detect it).
However, with the last release of Löve, for instance, I noticed a real improvement (speed, etc.), in relation to its previous versions − moreover I'm not very comfortable with the “programming style” of Löve.

On the other hand, I must say that animations are at least twice faster (maybe more) with Pulsar than with EGSL. My reckonings are not accurate ; I just modified all my temporizings on the run, multiplying them (or reducing the steps) by two.

Animations are using now a "real" timer, in EGSL it was just a counter...
Anyway, it shouldn't be possible to resize the windows with your mouse, at least it isn't possible on my systems (Linux Mint, Xubuntu, Windows 7 and Windows 10).
It can be if the window isn't refreshed anymore and waiting for a keypress or such that the content isn't visible anymore. This shouldn't happen using a game loop where the content is refreshed a few times per second. Is it possible for you to make a screencast video?
Best regards,
Cybermonkey

Bereb

  • Newcomer
  • *
  • Posts: 47
    • View Profile
Re: Pulsar2D is still alive ...
« Reply #14 on: 14. October 2015, 19:11:25 »
Anyway, it shouldn't be possible to resize the windows with your mouse, at least it isn't possible on my systems (Linux Mint, Xubuntu, Windows 7 and Windows 10).
I am on Lubuntu 14.04, and it is possible to reduce (minimize in the application bar)  a Pulsar window or to hide it with another one  during an animation. And of course, the Pulsar window does refresh itself thanks to the animation loop.

Quote from: Cybermonkey
It can be if the window isn't refreshed anymore and waiting for a keypress or such that the content isn't visible anymore.
Indeed, but in this case, with EGSL we could recover the window and its content nevertheless, with no need to run the script again.



Concerning the script which runs faster on EGSL than on Pulsar, here is my script (with the results at the end).
It may be that I was mistaken somewhere :
Code: [Select]
local bx,by,bw,bh
bx=0
by=0
bw=256*2
bh=256*2

local sx,sy,sw,sh
sx=-2.2
sy=-1.7
sw=3.4
sh=3.4

local clock = os.clock
local temps, t0, t1
local gx, gy, zx, zy, nzx
local col,r,v,b
local x, y, c

local fen = openwindow("Mandel simple (Pulsar2D)", 50, 50, bw,bh)
setactivewindow(fen)
backcolor(0,0,0,255)
clearwindow()
sync()

t0=clock()

for x=0,bw do
for y=0,bh do
gx=x/bw*sw+sx
gy=y/bh*sh+sy
zx=gx
zy=gy
for c=0,255 do
col = c
nzx=zx*zx - zy*zy + gx
zy=2*zx*zy+gy
zx=nzx
if zx*zx + zy*zy > 4 then
col = c
break
end 
end
r = col     
v = col*32 
b = col*64 
color(r,v,b,255)
dot(x,y)
end
end

t1=clock()
temps = (t1-t0)
text = tostring(temps).." secondes."

color(255,255,0,255)
drawtext(text, 2, 2)
sync()

inkey()
closewindow(fen)
closeapplication()

-- EGSL   : 2.978096 sec.
-- Pulsar : 3.359697 sec.
-- diff.  = 0.381601 sec.


Other information : the problem reported by Rick3137 does not happen on my computer...
« Last Edit: 14. October 2015, 19:22:23 by Bereb »
Regards, Bertrand :)
** Lubuntu 14.04 (Intel Celeron CPU 2.66GHz - 1280MiB) **