UnderwareDESIGN

PlayBASIC => Show Case => Topic started by: Sigtrygg on January 11, 2013, 03:13:59 PM

Title: Happy Diver 2.0
Post by: Sigtrygg on January 11, 2013, 03:13:59 PM
Hello Community!

I have been working at Happy Diver 2.0 since November 2012.
I am not ready with the game, but I hope I still will finish it in January.
Here you can see some screenpictures of the game.
I am going to publish it complete with sourcecode and media again.

Bye,

Sigtrygg


Title: Re: Happy Diver 2.0
Post by: ATLUS on January 11, 2013, 03:25:00 PM
Looks better than first version. Good Luck!
Title: Re: Happy Diver 2.0
Post by: BlinkOk on January 11, 2013, 04:22:49 PM
very nice mate. looking forward to playing it
Title: Re: Happy Diver 2.0
Post by: bmorris on January 12, 2013, 09:56:33 AM
Quote from: BlinkOk on January 11, 2013, 04:22:49 PM
very nice mate. looking forward to playing it
+1.

Does it play like an underwater Mario level?
Title: Re: Happy Diver 2.0
Post by: micky4fun on January 12, 2013, 05:52:34 PM
Hi All

Looking good Sigtrygg , keep the good work up
QuoteDoes it play like an underwater Mario level?
that would be cool

mick :)
Title: Re: Happy Diver 2.0
Post by: kevin on January 13, 2013, 10:20:42 AM

it's looking like a nice progression from the original. 
Title: Re: Happy Diver 2.0
Post by: Sigtrygg on January 13, 2013, 01:59:11 PM
Thank you all for your comments!
It's pitty that I don't know Mario's underwater level.
But try of your own.
At the moment I have still the problem that sometimes
some fishes stick at the wall. Maybe I still haven't found
the right collision mode. I use LineHitSpritePixels and
this works good. For some fihes I use SpriteHitMap and
there it happens that sometimes fishes get sticked at the
wall. But I try further...
Untill soon,

Sigtrygg
Title: Re: Happy Diver 2.0
Post by: micky4fun on January 13, 2013, 03:09:45 PM
Hi all

QuoteIt's pitty that I don't know Mario's underwater level.
here is a video , underwater part 40seconds onwards
http://www.youtube.com/watch?v=dZhlUPSxxRM
just adding some bubbles will give this effect

Quotesome fishes stick at the wall. Maybe I still haven't found
the right collision mode.
would not worry to much about that , when you have a demo up someone will sort that part out

mick :)
Title: Re: Happy Diver 2.0
Post by: Sigtrygg on January 14, 2013, 01:33:45 PM
Now I have seen, Mario's underwater world. But it seems that there exist more than
one version of it. In the newer version they used a very nice background and I like
the implementation of watereffects. I know a game named Nemo for the child-console
VTech http://www.youtube.com/watch?v=5asFwPw7_8Q (http://www.youtube.com/watch?v=5asFwPw7_8Q)
They realized the watereffect by moving one row with the other. I don't know how
to realize it with PlayBasic, bu maybe it is possible.
I found now a possibility to get rid of sticking fishes. I used position set off, if sprite
reaches the difined border.
But you will see it soon. Maybe the community has a better solution for it.

Bye

Sigtrygg
Title: Re: Happy Diver 2.0
Post by: kevin on January 17, 2013, 12:41:31 PM

most old school games use sinus wave for water.. Thesius XIII (http://www.underwaredesign.com/forums/index.php?topic=1896.0)
Title: Re: Happy Diver 2.0
Post by: Sigtrygg on January 17, 2013, 01:59:45 PM
Sinus wave for water? O.K., I have to take a look at Thesius, soon.
Now, first I post Happy Diver as it is.
You have to try which resolution work with your system.
Please let me know, if you find any bugs.  ;)
Of course, I don't want you as Beta-Tester, but although I played
through the game I guess there will be some bugs exist.
But first have fun!!  I have got it by writing that game with PlayBasic  :)

Sigtrygg

http://rghost.net/43112953 (http://rghost.net/43112953)

Title: Re: Happy Diver 2.0
Post by: monkeybot on January 17, 2013, 02:00:52 PM
Kevin,
is it more efficient to write the wave once to an image and move it or to  re-plot the wave each time?

Thanks

MB

Title: Re: Happy Diver 2.0
Post by: micky4fun on January 17, 2013, 05:15:38 PM
Hi all

nice work Sigtrygg , seems to play fine , could av some bubbles coming from diver , i have a small gfx's glitch as shown in picture , some  bits here and there
another thing you might want to do is when controlling with space key to move once its released rather than diver just stop , let him come to a slow halt , just a bit more relistic i think

a lot of hard work going into this from what i can see , keep it all going

mick :)

ps haaah, the glitch is on 1.64N2 so proberly ok on latest version
Title: Re: Happy Diver 2.0
Post by: kevin on January 18, 2013, 11:37:27 AM

Sigtrygg,

     This has come a long way.. but sadly there does seem to be a few similar faults to the previous editions.    The most serious would be OpenScreen usage.  Never... ever.... load media then change resolution.  It might work some people, but it'll completely fail for others..   What you should do, is have the user select the resolution before any in game media is loaded.   Or If the resolution is changed in game, then you'd have it reload all the media.   Since the change of resolution destroys the surfaces.   


monkeybot ,

Quoteis it more efficient to write the wave once to an image and move it or to  re-plot the wave each time?

   Whatever copies the least amount of memory.

Title: Re: Happy Diver 2.0
Post by: bmorris on January 19, 2013, 09:01:26 AM
I've just been playing it. Visually, I like the simple-ish gfx, although I think the water looks too plain compared to the textured land; maybe the water could have a wee bit of texture too (not necessarily dynamic). In terms of diver movement, my main thing to say is that it felt too slow to me, and it makes me wonder if you could include speed-ups. And I sympathise with Micky's comment about the sudden stopping, although I must admit I liked the ease with which a chest of gold can be nabbed this way!

I presume the objective is to collect all the gold? And that new objects/features will come in in subsequent levels?

All in all, it's a good, playable game, very PlayBasic.
Title: Re: Happy Diver 2.0
Post by: Sigtrygg on January 19, 2013, 02:15:13 PM
Hello  community!

Thank you for comments and impoving examples.
I will try your suggestions, Mick! Thanks!
@Kevin: OK! I do understand: Never ever....  ;)
To change this, can't be very difficult, I think.
First setting resolution. Then loading media...
@bmorris: Yes! I agree with you, that the water should
be more living, but I didn't find any underwater-backgrounds
and I can't draw it by myself, because I am not an artist.
It would be fine, if I could use "Kevin's" Sinus-waves, but
I think I have to spent a lot of time to understand and
implement it.
I think to get the right media for your game is one of the
most great problems. I used some free gifs and splitted them
by "Gif-splitter", so I could use them for spriteimages.
Some of the fishes I drew by myself and you can see it!  ;)
Nevertheless I had a lot of fun when I made the game
and I will work further at HappyDiver and HellEagle.

Have a nice weekend!

Sigtrygg



Title: Re: Happy Diver 2.0
Post by: Sigtrygg on January 21, 2013, 11:38:13 AM
I am working to implement moving the diver a liitle bit further when leaving Space-key
and that some breathing bubbles come from diver.

I will post one version with resolution 1024x768. I hope so, that anybody can play
that game without system-crash because of loaded media and changing resolution.

On my systems and the PCs of my friends changing resolution doesn't any matter,
but then you can choose which version is better to play.

Untill soon!

Sigtrygg
Title: Re: Happy Diver 2.0
Post by: stevmjon on January 21, 2013, 05:12:37 PM
hey sigtrygg

  try making a menu screen to be loaded first, let the user choose the screen resolution, then load game graphics.

  stevmjon
Title: Re: Happy Diver 2.0
Post by: Sigtrygg on January 22, 2013, 12:45:59 PM
Hello Stevmjon and all of community!

I tried it, but I would have had to reconifg a lot of code, because I am loading
media at different places.

So I post now a version with common resolution 1024x768.

I guess, now everybody can play that game.

I added diveracceleration and some bubbles. Good idea of Mick!

Please let me know, if this version run without chrashes.

Bye,

Sigtrygg

http://rghost.net/43238597 (http://rghost.net/43238597)
Title: Re: Happy Diver 2.0
Post by: BlinkOk on January 22, 2013, 04:10:28 PM
luv it siggy dude. runs fine here.
nice work on the diver dude. i like the way he pops into nothing when he hits something.
for me i think i would prefer the up arrow to go forward rather than the space. but maybe that's just me
Title: Re: Happy Diver 2.0
Post by: kevin on January 22, 2013, 06:42:36 PM
Sigtrygg,

    Haven't downloaded the update, but looking at the files in the previous version there does seem to be a lot of redundant media floating around.    In the level folder for example, you've got the original PNGs and the block map bmps.   The user doesn't need to be downloading the originals, so there's probably 4 or 5 meg saving off the bat.   Same with the music files, which seem to be encoded in higher bit rate than is needed.   Just re encoding them an OGG files at 128 will probably half the disc size and chop another 4 or 5 meg off the download size. 
Title: Re: Happy Diver 2.0
Post by: BlinkOk on January 22, 2013, 06:53:16 PM
for mine i don't mind the size and i would also like the original images just in case i want to work with them
Title: Re: Happy Diver 2.0
Post by: Sigtrygg on January 23, 2013, 01:08:39 PM
Hello community!

I have been thinking about the suggestion of Stevmjon to make a resolution menu
first and I have done it now.
Thank you Kevin for the hint with ogg-files. I didn't use them untill now.
Indeed I have left the pictures of the levels for further changing by anyone who wants.
In Version 2.2. I have deleted them now. As BlinkOk it doesn't matter for me, if such games
have much megbytes.
@BlinkOk: Good idea to use up-key instead of space-key. Then you have the second hand
free for a coup of coffee or a beer :)
If you like, you can download the version 2.2 now.
I think I have to implement some improvements for HappyDiver into HellEagle too.

Thanks and bye,

Sigtrygg

http://rghost.net/43263003 (http://rghost.net/43263003)
Title: Re: Happy Diver 2.0
Post by: kevin on January 29, 2013, 09:41:55 PM
Converting the blocks map back to pictures is pretty straight forward.  Load the blocks, load the level, make an image of the required size, draw it the level and save it..

[pbcode]

   #include "maps"
   #include "savebitmap"   

       // Obviously this is my local path, users would need to modify this to work..     
   path$="E:\Downloads\HappyDiver_2.0\Media\Levels\Level_0001\"

   print "Loading..."
   Sync
      
   Map=NewMap(1)
   LoadMapGFx  Path$+"Underwaterworld_Blocks.Bmp",Map,32,32,$00ff00ff,2
   LoadLevel Path$+"Underwaterworld_Level.Map",Map,1

   
   print "Render..."
   Sync

   ; get the size of this level in pixels
   AbsWidth   =GetLevelAbsWidth(Map,1)
   AbsHeight=GetLevelAbsHeight(Map,1)
   
   ; make an image this zie
   img=NewImage(AbsWidth,AbsHeight,2)
   
   ; draw the map to the image
   rendertoimage Img
   drawmap Map,1,0,0

   ;
   rendertoscreen

   print "Saving..."
   Sync

   SaveBitmap "C:\PIcture.bmp",img
   print "DONE"   
   
   Sync
   waitkey
      
   
[/pbcode]



 Only quickly browsed the code but there's  seems to be many places where the logic can be simplified.

 A loop like this,

[pbcode]
Do
   DataNumber=DataNumber+1   ;amount of data
   lowerfishesData(DataNumber)=ReadData()
   If lowerfishesData(DataNumber)=10000 Then Exit
Loop
[/pbcode]

 can be expressed as either an Repeat / UNtil or a conditional Do/Loop

[pbcode]
repeat
   DataNumber=DataNumber+1   ;amount of data
   lowerfishesData(DataNumber)=ReadData()
until lowerfishesData(DataNumber)=10000
[/pbcode]

  or

[pbcode]
do
   DataNumber++
   lowerfishesData(DataNumber)=ReadData()
loop lowerfishesData(DataNumber)=10000
[/pbcode]



   The pause code throws the program into a dead lock state.  Where the runtime is constantly polling the keyboard for a responce that doesn't even need to be 10 millisecond intervals let alone thousands of times per millisecond.  

 so this

[pbcode]
   If KeyState(25)=1; press "P" Key for pause and spacekey for resume

               ; this create a app dead lock. don't do it !
      Repeat
      Until SpaceKey()
   EndIf      
[/pbcode]


     A much more system friendly solution is to wait between iterations of the loop. So the process doesn't hog the system cpu.  

[pbcode]
   If KeyState(25)=1; press "P" Key for pause and spacekey for resume

               ; this create a app dead lock. don't do it !
      Repeat
                      ; suspend execution for at least 10 milliseconds. Which means the state of the space key is being checked approximately 100 times per second.  The interval could really be as low as 50 milliseconds..
                      wait 10
      Until SpaceKey()
   EndIf      
[/pbcode]



      Perhaps the most pressing issue is there seems to be Media leaks when changing levels..   In the load_World function for example, if we call this function twice, the previous map index will be overwritten by the next map index.    Overwriting the field doesn't delete the media, it's an integer not a reference to the map.  So the previous map is still sitting in memory.

      For example

[pbcode]

    ; create image that's 100 by 200 pixels and store it's index in the Integer variable IMAGE
      Image=NewImage(100,200)

     ; create another image and store it's index in the Integer variable IMAGE..
     ; This overwrites the previous index and we've now lost that index.     
      Image=NewImage(256,256)

   ; run through the image list and see how many images exist.
      For lp=1 to GetIMageQuantity()
            if getimagestatus(lp)

               print " IMage #"+str$(lp)
               print " Width #"+Str$(GetIMageWidth(lp))            
               print "Height #"+Str$(GetIMageHeight(lp))            
               print ""
            endif
      next


   ; print the IMAGE index
   
      print "Current Index in IMAGE ="+Str$(image)      

      Sync
      waitkey
      
[/pbcode]

     
    So ideally, when changing levels it's a good idea to explicitly flush your media out of your structures.

[pbcode]

//>>>>>>>>>>>>>>>>>>>>>>>>>>> LOAD WORLD >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function load_world(level)

      Path.Currentblocks=Path.blocks+"Level_"+Digits$(Level,4)+"/"+"underwaterworld_blocks.bmp"
      Path.CurrentLevel=Path.Levels+"Level_"+Digits$(Level,4)+"/"+"underwaterworld_level.map"

; Like here you could check if this map already exists, then either delete it, or reuse the index.
    if GetMapSTatus(gamemap(level).index)
         DeleteMap gamemap(level).index
    endif

      gamemap(level).index=NewMap(10)
   
      LoadMapGFX  Path.Currentblocks,gamemap(level).index,32,32,RGB(255,0,255),2;$00ff00ff
      
      gamemap(level).levelindex=GetFreeMapLevel(gamemap(level).index)

      LoadLevel Path.CurrentLevel,gamemap(level).index,gamemap(level).levelindex

      LevelTransparent gamemap(level).index,gamemap(level).levelindex,RGB(255,0,255)

EndFunction

[/pbcode]





Title: Re: Happy Diver 2.0
Post by: Sigtrygg on January 30, 2013, 02:09:17 PM
Thank you very much for hints and improvements, Kevin!  :)
I try to imlement your hints for the next issue of Happy Diver.
At the moment I try to implement a harpoon shoot for stage 2
after you have managed level 5. Maybe it's a little bit more exiting
then to play the 5 levels again with the harpoon.

Until soon!

Sigtrygg
Title: Re: Happy Diver 2.0
Post by: Sigtrygg on February 21, 2013, 02:27:12 PM
Hello community!

I have changed HappyDiver now. If you managed all five levels,
you get now into level 1, stage 2 where you get a harpoon to
shoot the fishes. But it takes some time to reload harpoon-arrow.
I played the game and everything works fine, so I hope that there
is no bug anymore.
Here you can download the game together with media and source
code.

http://rghost.net/43982110 (http://rghost.net/43982110)

Bye  :D

Sigtrygg

Title: Re: Happy Diver 2.0
Post by: BlinkOk on February 21, 2013, 02:54:23 PM
that sigtrygg dude must be pretty awesome. he OWNS the high score table ;-)
i prolly get to stage 2 in about a month
nice work
Title: Re: Happy Diver 2.0
Post by: micky4fun on February 21, 2013, 06:23:33 PM
Hi all

yep very nice Sigtrygg , when i get some spare time will give a good play
keep up the good work

mick :)
Title: Re: Happy Diver 2.0
Post by: Sigtrygg on February 22, 2013, 02:42:52 PM
Thank you for feedback, Mick and BlinkOk!

Well, I have to admit that I have played the game more than one time  ;)
But you can delete the highscore. It will be written as new file.
Have a nice weekend!

Sigtrygg