UnderwareDESIGN

PlayBASIC => Show Case => Topic started by: monkeybot on December 16, 2009, 03:23:17 PM

Title: Asteroids
Post by: monkeybot on December 16, 2009, 03:23:17 PM
Asteroids complete.



left cursor
right cursor
shift=thrust
z=shoot
ctrl hyperspace


updated 29-4-12
Get  FINAL  of Asteroids->Download (http://www.underwaredesign.com/forums/index.php?topic=3301.msg25375#msg25375)
Title: Re: ARSETEROIDS WIP
Post by: micky4fun on December 16, 2009, 03:53:59 PM
Hi monkeybot ,

yep nice example , like the expolsions , plays very nicly , hope you find the time to finish this game soon

mick :)
Title: Re: ARSETEROIDS WIP
Post by: kevin on December 16, 2009, 06:54:03 PM
 Nice, even looks familiar.. :)   it must be asteroids season...
Title: Re: ARSETEROIDS WIP
Post by: monkeybot on December 17, 2009, 01:10:16 PM
Thanks  Mick.

Yes Kevin it must be asteroid season,freaky eh!
Title: Re: ARSETEROIDS WIP
Post by: monkeybot on May 02, 2010, 04:41:56 PM
Asteroids Public Test.

This is pretty much finished.
However ... if possible i would like some feedback as to how it performs on various peoples systems and if there are any bugs etc.
when it works properly i will release the code(if anyone is interested).

Thanks for your time.



Title: Re: ARSETEROIDS WIP
Post by: LBFN on May 02, 2010, 11:15:21 PM
Very nice game!  No issues with gameplay.  The explosions were nice.  I wished the ship would rotate faster, but then again, I did in the original too.  :)  Nice work so far.

Title: Re: ARSETEROIDS WIP
Post by: kevin on May 04, 2010, 12:33:26 PM
 MB,

 
Quoteif possible i would like some feedback as to how it performs on various peoples systems and if there are any bugs etc.

       Well done, Game play wise it seems to play pretty well.  There's a few differences with the ships behavior and controls, although it seems to be running a bit slow here on my system. 


 
Quotewhen it works properly i will release the code(if anyone is interested).

     Yeah, i'd like a look at it. 



Title: Re: ARSETEROIDS WIP
Post by: monkeybot on May 04, 2010, 02:13:47 PM
i need to do some serious tidying up if you are looking at it Kevin!
Title: Re: ARSETEROIDS WIP
Post by: kevin on May 06, 2010, 01:49:38 AM
Quote from: monkeybot on May 04, 2010, 02:13:47 PM
i need to do some serious tidying up if you are looking at it Kevin!

ah, ya chicken ..  :)

Title: Re: ARSETEROIDS WIP
Post by: Vee on May 06, 2010, 06:13:39 PM
nice work!
i like the colours and the effects. the exploding text is a nice touch!
i wonder why the frames are so low, it's kinda lagging. And why can the asteroids warp from one side to the other and i can't :(
other than that awesome clone
Title: Re: ARSETEROIDS WIP
Post by: monkeybot on May 10, 2010, 01:26:04 PM
it is running at 30fps,i will crank it up for the release.

Thanks
Title: Re: ARSETEROIDS WIP
Post by: monkeybot on November 01, 2010, 05:19:22 PM
UPDATE

Asteroids is now finished
Please let me know how it plays.

Thanks
Title: Re: ARSETEROIDS WIP
Post by: BlinkOk on November 02, 2010, 03:00:34 PM
superb! great work
the ship rotates wayyyyyyy to fast for me
Title: Re: ARSETEROIDS WIP
Post by: micky4fun on November 02, 2010, 05:39:11 PM
yep plays very nice indeed , nice n smooth great explosions , very faithfull to the orignal
good work monkeybot
Title: Re: ARSETEROIDS WIP
Post by: monkeybot on November 03, 2010, 02:12:32 AM
shucks thanks guys.. :-)
Title: Re: Asteroids
Post by: OldNESJunkie on November 03, 2010, 03:42:22 PM
I like the way this plays as well, but I have to agree with Kevin. The ship seems to rotate too fast. Also noticed you seem to have friction that slows down the ship after you thrust, seems to slow down WAY too fast as well. Other than those two things though (minor), nothing I can see that isn't great. Also noticed one bug with some asteroids the vector line on one side is longer than the side of the asteroid. Happens on one asteroid on every level I've played so far, again minor.........


  -
/  \
|  |
\  /
----
Title: Re: Asteroids
Post by: monkeybot on November 03, 2010, 07:19:13 PM
thats great,thanks for the feedback.
i will tweak and re-post.

Cheers
Title: Re: Asteroids
Post by: kevin on December 08, 2010, 02:49:59 PM

monkeybot,

   can you put some screenies up.. So i've something to link to :)
Title: Re: Asteroids
Post by: OldNESJunkie on December 08, 2010, 10:11:19 PM
monkeybot,

just tried the 11-1-2010 version & the in-game speed is WAY too fast totally uncontrollable ship asteroids too fast to even hit like it's running at 500 FPS, but the death animation plays at the correct speed, also on the title screen, the select start level is too far up, covers the bottom high score.
Title: Re: Asteroids
Post by: monkeybot on December 09, 2010, 07:12:52 AM
Could you give me details of your system/OS/screen resolution etc... etc...
Title: Re: Asteroids
Post by: OldNESJunkie on December 09, 2010, 04:49:44 PM
Sure,

Windows 7 HP 64-bit
Nvidia GeForce 9800M GTS 1 GB
1440x900 Resolution
4GB DDR3 RAM


It may be an Nvidia vsync setting, let me check that before I forget again & I'll edit this post.

Edit:

Well, that didn't make any difference, tried several settings, same issue.
Title: Re: Asteroids
Post by: monkeybot on December 10, 2010, 04:13:51 AM
The death anim and title page uses setfps,the game loop uses a timer and vsync.I wonder if anyone else has had this problem.
Title: Re: Asteroids
Post by: BlinkOk on December 11, 2010, 02:46:40 PM
yes i have the same problem. i mentioned it in my last post. i have a fast machine as well
Title: Re: Asteroids
Post by: monkeybot on December 13, 2010, 01:23:15 PM
ok thanks.I will look into it asap.
Title: Re: Asteroids
Post by: kevin on December 13, 2010, 06:46:11 PM

I suggest mocking up your game loop and posting it so we can have a look at what you're doing.   
Title: Re: Asteroids
Post by: monkeybot on December 19, 2010, 11:37:02 AM
function gameloop()

   local gametimer2=timer()
   Constant gamespeed=50 ; 50fps
   Repeat

      If timer()>=gametimer2
           gametimer2=(Timer()+(1000/gamespeed))
        ....run game code
   ....
     
      endif
     
   Until   player=dead
endFunction

i implemented this system so it will enable slower machines to run the game as fast as
possible.
Title: Re: Asteroids
Post by: kevin on December 19, 2010, 07:11:47 PM

  Thanks, but care to post something people can run ? - Help us, help you..   
Title: Re: Asteroids
Post by: monkeybot on December 20, 2010, 02:29:55 PM
shall i just email you the source kevin?
Title: Re: Asteroids
Post by: kevin on December 20, 2010, 05:42:41 PM

You can if you like,  but I just think it'd be better if there was some small bit code the people having problem could run. 
Title: Re: Asteroids
Post by: monkeybot on December 21, 2010, 12:06:58 PM
; PROJECT : ast frag2
; AUTHOR  : Microsoft
; CREATED : 16/01/2010
; EDITED  : 21/12/2010
; ---------------------------------------------------------------------
ScreenVsync on
gametimer2=timer()

gameloop()
end

Constant gamespeed=20 ;fps


function gameloop()
  local x
  Repeat
     Cls 0
;
     If timer()>=gametimer2
;         gametimer2=(Timer()+(1000/gamespeed));gamespeed)
    gametimer2=(Timer()+20);gamespeed)
        circle x,100,5,1
        x=x+1
        sync
  EndIf
  ; sync
  Until   false
endFunction


by my calculations This should run at 50 fps ..ish

1000/20=50
Title: Re: Asteroids
Post by: monkeybot on December 21, 2010, 12:54:45 PM
weird............after compiling it is now running wayyyyyy too fast on my machine.!!!???!?!?!

gonna rip my Proprietary timer code out and run on setfps().

it is strange this has just started to happen,seemingly all of a sudden.

PB 1-64M
Editor119b3.exe
Title: Re: Asteroids
Post by: kevin on December 21, 2010, 06:09:46 PM

; PROJECT : ast frag2
; AUTHOR  : Microsoft
; CREATED : 16/01/2010
; EDITED  : 21/12/2010
; ---------------------------------------------------------------------
ScreenVsync on
gametimer2=timer()

gameloop()
end

Constant gamespeed=20 ;fps


function gameloop()
   local x
    Repeat
      Cls 0
;
      If timer()>=gametimer2
;        gametimer2=(Timer()+(1000/gamespeed));gamespeed)
      gametimer2=(Timer()+20);gamespeed)
        circle x,100,5,1
        x=x+1
        sync
    EndIf
    ; sync
  Until   false
endFunction



  The logic of the loop is broken, rather than redraw completely at 20 MS intervals it's drawing the circle + syncing, but clearing the graphics buffer every iteration.  



ScreenVsync on

Constant gamespeed=50 ;fps

gameloop()

end



function gameloop()
  local x
gametimer2=timer()

  Repeat
;
CurrentTime=Timer()
     If CurrentTime>=gametimer2
    gametimer2=(CurrentTime+(1000/GameSpeed))

; redraw frame only when at least 20 milliseconds have pasted
RenderGame()    

  EndIf
  ; sync
  Until spacekey()
endFunction



Psub RenderGame()

     Cls
        circle x,100,5,1
        x=mod(x+1,800)
        sync

EndPsub




  This approach is basically what SetFPS does anyway, with one exception, setting fps means that when syncing on computers that can run the loop faster than required (Less than 20, when that's the target), than it gives the free time given back to windows.   This is not he case in this loop however, as this loop is a hogging all the cpu since it's constantly waiting for the next frame to occur.
 

 This can be dropped in a bit like this,



ScreenVsync on
Constant gamespeed=50 ;fps

gameloop()

end



function gameloop()
  local x
gametimer2=timer()

  Repeat

;
CurrentTime=Timer()

TimeToNextFrame=gametimer2-CurrentTime

     If TimeToNextFrame<1

      gametimer2=(CurrentTime+(1000/GameSpeed))

; redraw frame only when at least 20 milliseconds have pasted
RenderGame()    

else

; CHeck if there's a more then 5 milliseonds to go
if TimeToNextFrame>=5
wait 4
endif

  EndIf
  ; sync
  Until spacekey()
endFunction



Psub RenderGame()

     Cls
        circle x,100,5,1
        x=mod(x+1,800)
        sync

EndPsub




Title: Re: Asteroids
Post by: monkeybot on December 22, 2010, 01:53:38 PM
oh yeah thanks yet again kevin.

p.s. i am love with PB again after empty sorted the IDE. woohoo.

Cheers.
Title: Re: Asteroids
Post by: monkeybot on April 29, 2012, 02:31:27 PM
I have been meaning to post the source for asteroids for a while,it is fairly long in the tooth and has a few bugs,but i wont spend any more time on it.
Title: Re: Asteroids
Post by: ATLUS on April 29, 2012, 02:58:28 PM
monkeybot, Great Work!!!  ;)
Title: Re: Asteroids
Post by: monkeybot on May 03, 2012, 12:58:50 PM
Thanks Atlus.
Title: Re: Asteroids
Post by: Sigtrygg on May 03, 2012, 02:07:36 PM
Hello monkeybot!

I have tried to start your Asteroids, but an error massage appeared:

Error String: Variable 'inputlibrary_version' is Not defined in Scope declaration.

I use PlayBasic Vers. 1.64N

Can you tell me, what I have to do?

Greetings by

Sigtrygg
Title: Re: Asteroids
Post by: monkeybot on May 04, 2012, 02:10:19 PM
i assume the source?

um...did you decompress the archive properly?
do you have the input lib in PB installed correctly?
Title: Re: Asteroids
Post by: kevin on May 04, 2012, 02:19:59 PM

  I had a look at this the other day (thanks for posting btw), and had much the same issue, it seemed that one of the sources wasn't included in the project file so I had to add it again.  After that it was fine. 
Title: Re: Asteroids
Post by: monkeybot on May 04, 2012, 02:27:17 PM
oops
i better sort that out.