[Game] worm
[Game] worm
-- (define? (Cornflakes))
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Good stuff! Tomorrow, PacMan, perhaps?
I found that it didn't start reliable until I moved this line:
Also, I tried to change the timings to get the movement smooth but fast. It's not easy! Sometimes I got:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 18 >= 14
at java.util.Vector.elementAt(Vector.java:432)
at CanvasWidget$MyCanvas.render(CanvasWidget.java:639)
I found that it didn't start reliable until I moved this line:
Code: Select all
(while (gs:check-event 2000)
(gs:request-focus 'C)
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 18 >= 14
at java.util.Vector.elementAt(Vector.java:432)
at CanvasWidget$MyCanvas.render(CanvasWidget.java:639)
cormullion wrote:Good stuff! Tomorrow, PacMan, perhaps?
I found that it didn't start reliable until I moved this line:
Also, I tried to change the timings to get the movement smooth but fast. It's not easy! Sometimes I got:Code: Select all
(while (gs:check-event 2000) (gs:request-focus 'C)
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 18 >= 14
at java.util.Vector.elementAt(Vector.java:432)
at CanvasWidget$MyCanvas.render(CanvasWidget.java:639)
thanks for the test...I thought about packman ;-) ..
Yes the speed is perhpas an issue, though I did not find any strange
behaviour bewtween my AMD64 3200+ and my Intel Dual Core..
the check-even I have left in 10000 and put in a (sleep 1) for the official delay.
I only need to use (gs:request-focus 'C) once on windows and Linux? I dont
know if macOS needs it inside the while loop..
But there is another problem ;-) that is flickering when the tail gets bigger
than 100.. On linux it realy starts flickering on windows its a little less bad..
But that is because I need to redraw the tags.. I did not find a good way
to "Append" tags actualy without deleting...
-- (define? (Cornflakes))
First run in Linux delivers this
However, in Linux the file 'guiserver.lsp' by default resides in "/usr/share/newlisp".
So after executing "export NEWLISPDIR=/usr/share/newlisp" in a Bash shell, your game runs fine, even on my Lifebook with a 700Mhz processor :-)
Peter
If I put this variable to "/usr/bin" according to the example in the manual, I get this:peter[~]$ newlisp worm.lsp
array, list or string expected : (env "NEWLISPDIR")
peter[~]$ newlisp worm.lsp
problem accessing file : "/usr/bin/guiserver.lsp"
However, in Linux the file 'guiserver.lsp' by default resides in "/usr/share/newlisp".
So after executing "export NEWLISPDIR=/usr/share/newlisp" in a Bash shell, your game runs fine, even on my Lifebook with a 700Mhz processor :-)
Peter
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
newdep:
Then after all tag operations do a 'gs:update' or any 'gs:xxx-tag' operation without the the 'nil' flag to force a re-rendering operation. If neither 'nil' or 'true' is given in a tag operation then guiserver.lsp assumes 'true'.
pjot:
Unfortunately the not-updated documentation for 'env' also uses NEWLISPDIR in an example but puts it in /usr/bin, this is where the confusion comes from ;). Since the last development version all demo files for guiserver are coded using
and this should work on all platforms since 9.2.1
Lutz
The exception happens when Java is rendering the array of tagged objects and a tag is deleted at the same time. Try to use 'gs:hide-tag' and 'gs:show-tag' instead. Or do all 'gss:xxx-tag' operation with 'nil' as the last parameter, i.e:Also, I tried to change the timings to get the movement smooth but fast. It's not easy! Sometimes I got:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 18 >= 14
at java.util.Vector.elementAt(Vector.java:432)
at CanvasWidget$MyCanvas.render(CanvasWidget.java:639)
Code: Select all
(gs:move-tag 'mytag x y nil) ; suppress screen update
pjot:
Since version 9.2.1 NEWLISPDIR is automatically put in the environment when newlisp starts up. In /usr/share/newlisp on all UNIX and into %PROGRAMFILES%/newlisp on Win32.array, list or string expected : (env "NEWLISPDIR")
Unfortunately the not-updated documentation for 'env' also uses NEWLISPDIR in an example but puts it in /usr/bin, this is where the confusion comes from ;). Since the last development version all demo files for guiserver are coded using
Code: Select all
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
Lutz
I think its a key-event or buffer update issue.. but not 100% sure..
here is the demo ->
(load "http://www.nodep.nl/downloads/newlisp/sound.lsp")
(it includes the wav file)
when you start it... press some random keys on the keyboard
and keep you ear on the sound...
Its also happens without pressing the keyboard checked now...
PS: only happens on Linux as it seems now..
Norman.
here is the demo ->
(load "http://www.nodep.nl/downloads/newlisp/sound.lsp")
(it includes the wav file)
when you start it... press some random keys on the keyboard
and keep you ear on the sound...
Its also happens without pressing the keyboard checked now...
PS: only happens on Linux as it seems now..
Norman.
-- (define? (Cornflakes))
Perhaps a platform issue. On OS X this seems to run forever with or without keyboard input. When doing keyboard input the keyboard events are lined up, and the key doesn't display until the sound has finished. When presssing 1 to 9 in a row, they appear one by one after a plop. Sometimes the same number appears more than once, when 2 plops appear in-between serving the keyboard queue.
Lutz
Lutz
Yes could very well be a platform issue.. But i would expect Java to take
control of this..like tuning speed and threads in its VM.. But then again we have
the GS in between where we have an IO queue.. On windows its also different..odd ;-)
On linux, while NOT pressing keys its not constant a 1 second beep.. its
very random.. like a hickup in between.. then some silence..etc.. but the key-event
is here synchrone..though not inline with the beep..
well I think i have to live with it ;-)
PS: Could it behaps be related to the disk-read of the sound file? and buffering
related to that action?
control of this..like tuning speed and threads in its VM.. But then again we have
the GS in between where we have an IO queue.. On windows its also different..odd ;-)
On linux, while NOT pressing keys its not constant a 1 second beep.. its
very random.. like a hickup in between.. then some silence..etc.. but the key-event
is here synchrone..though not inline with the beep..
well I think i have to live with it ;-)
PS: Could it behaps be related to the disk-read of the sound file? and buffering
related to that action?
-- (define? (Cornflakes))
In a later release gs:play-sound could be in an extra Java thread, so other events can be served during sound playing.
The choppiness (hickups) you are observing, is Java's carbage collection kicking in and absorbing cycles. For the time beeing the only thing you can do, is to make sounds as short as possible.
The IO queue will always be something, which has to be dealt with. Thats why real-world gaming software is interrupt driven. The moment you hit the button or move the stick, it gets served as a pirority.
Lutz
The choppiness (hickups) you are observing, is Java's carbage collection kicking in and absorbing cycles. For the time beeing the only thing you can do, is to make sounds as short as possible.
The IO queue will always be something, which has to be dealt with. Thats why real-world gaming software is interrupt driven. The moment you hit the button or move the stick, it gets served as a pirority.
Lutz
Aha..yes i thought so... another java thread would be very welcom but
i think the GS should not have too many java threads running, but GS cant get around that..;-)
Is there a more direct way to communicate towards Java? I could emagine
that IPC's or pipe's are much quicker then network events for example... Or perhpas direct API calls or the whole guiserver.lsp in JAVA itself? ;-)
For now the networking speed is fine the only problem is indeed the Sync
of processes and the speed handling when building game-like applications
with GS... widgets do great and small canvas tools too..but i thing the "worm.lsp"
almost is on its limits regarding interaction of events..
Aaa its still a joy ;-)
regards, Norman.
i think the GS should not have too many java threads running, but GS cant get around that..;-)
Is there a more direct way to communicate towards Java? I could emagine
that IPC's or pipe's are much quicker then network events for example... Or perhpas direct API calls or the whole guiserver.lsp in JAVA itself? ;-)
For now the networking speed is fine the only problem is indeed the Sync
of processes and the speed handling when building game-like applications
with GS... widgets do great and small canvas tools too..but i thing the "worm.lsp"
almost is on its limits regarding interaction of events..
Aaa its still a joy ;-)
regards, Norman.
-- (define? (Cornflakes))