Main Menu

Pooyan complete game

Started by micky4fun, July 09, 2011, 07:24:24 PM

Previous topic - Next topic

kevin

#90
    Dropped in the resolution selection last night, of course in order to pick a resolution  the app needs to run through systems available screen modes and sort them, so that was bit of messing around.    The selections works fine, but getting the game to restart could be problematic.   The gui stuff is just some sprites plonked on the scene.  All except the window itself, which is drawn using a temp sprite through the function bellow.   Which allows you to draw  an image with a TINT applied (and anything else you care to add).

  This is where it gets kind of interesting, as when the game restarts all images and sprites are deleted. So when a restart occurs the start up code allocates/loads setup the sprites/images it needs all over again.    If you look carefully at this routine, you'll notice it's using the static behavior of Psubs to cache TempSprite value, so the function can avoid constantly creating and destroying the sprite it's using for output.   This works fine when started from a clean start, but when the game is restarted,  the sprite TempSprite was using as it's own, now no longer exists.

  So it'd either pop a runtime where the sprite doesn't exist (if your lucky) or it runs without error.. Since the restart might have actually allocated the sprite index to another sprite that tempsprite is previously and still set to.    So when you open the dialog and then the play the game,  the shared sprite in the scene has it's properties altered..  In this case the message banner would often appear in the wrong colours..  Leading one on a wild goose chase.   Simple to solve once you wrap your mind around the problem, but finding such logical issues is always a bit of fun.   Seems to be working as expected now.    


PlayBASIC Code: [Select]
Psub DrawTintedImage(Thisimage,xpos,ypos,Scale#,TintColour,DrawMode,AutoCenter=true)

if TempSprite=0
TempSprite=NewSprite(xpos,ypos,ThisImage)
Spritedrawmode TempSprite,2
endif

SpriteVisible TEmpSprite,on

PositionSprite TempSprite,Xpos,Ypos
SpriteImage TempSprite,ThisImage

Transparent =(DrawMode &1)>0
; Filter =(DrawMode &8)>0

SpriteTint TempSprite,TintColour
SpriteTransparent TempSprite,Transparent

; if Filter
; SpriteFilter TempSprite,true
; if Transparent=off
; SpriteMaskColourCompression TempSprite, Off
; endif
; endif

if AutoCenter=true
centerspritehandle TempSprite
else
spritehandle TempSprite,0,0
endif

ScaleSprite TempSprite,Scale#
DrawSprite Tempsprite

SpriteVisible TEmpSprite,off

EndPSub








Mick,

   everything 'new' was  cut'n'pasted from examples on the source code board...


     * Rounded Box
     * Selective Tile Map Refreshing
     * GetSpriteRect Example (Dirty Rectangles / Selective Map Refreshing)





kevin

#91
    Still fiddling with the game on and off really,  ended up changing how the program was drawing the window dialog to a sprite so it's inline with the other parts of it.    Since they're all sprites, the dirty rectangles sprite routine (on the previous page) handles the backdrop refresh.  Just fits better with how it all works.    There was a logical issue with some of the sprites being drawn twice also,  not a big deal, but worth a 30 second fix.

   The only thing left to do now is tweak the mouse input for when in windowed mode.  Haven't tried it as yet, but think rather than connect Pooyan to the mouses Y coordinate,  it'd might be better disconnect the position from raw mouse position and curve it towards that position.   So it's tracking the ideal position and it's interpolated coordinate.  


PlayBASIC Code: [Select]
   setfps 61.7
PooyanIdealY#=GetScreenHeight()/2

oldmousey=PooyanIdealY#
PooyanY#=PooyanIdealY#


Do
cls

MY=Mousey()

PooyanIdealY#+=(MY-OldMousey)

PooyanIdealY#=cliprange(PooyanIdealY#,50,500)
PooyanY#=curvevalue(PooyanIdealY#,PooyanY#,10)

circle 400,PooyanY#,10,true

OldMouseY=My

Sync
loop






      Been playing it a bit more though, you know play testing ...erm.. ;) High score is getting bigger.   Could do with a something to make it more aggressive the longer the game goes...  



Pooyan V1.04

      Changed the input code this morning and it seems to work ok in windowed mode now.   It feels a little bit different, almost like there's some weigh to the basket but not too much.  Another problem had been displaying a mouse pointer for the menu dialog in scene.   Figured I'd just turn that into a sprite inside the dialog, only to run into a couple of chicken before the egg problems.    The dialog is literally just stuck into the main loop after the game is done,  it's part sprites and text overlaps, since it's a sprite the text is draw over it, which is not ideal.  

      Another issue occurs because of the order of rendering events,  where the dirty rect caching is refreshing the last known position of the mouse, when it's potentially being positioned and drawn some place else.  Leaving the odd snail trails behind.   Ended up having to lift the mouse out of the dialog and give it's own sprite globally.   Since the sprite is positioned prior to drawing scene the snail trail problem goes away,  but the text would still  overlap it.  So in the dialog routine just draws the mouse a second time..  It's a bit of a mess really (that's what you get from cut'n'paste generally), but the result seems to look ok.

      Only thing left might be some more little tweaks...


Pooyan V1.04b

      The last thing I want to add to the game is an abort dialog for when you hit ESC to quit the current game.    So when your playing hitting ESCape doesn't just end the program  completely.    It'll end the program in the title screen, but not during play.    The 'do you wanna'  dialog is a variation of the pause screen.  So play stops, while it asks you the question.    Getting it to actually restart the demo mode has been a trickier than expected,  there doesn't seem to be way to actually restart the game cleanly, since it seems to assume the state of many things.  Get all sorts of funny things happening  

      The dialogs and buttons are made from Bordered Boxes (login required)



kevin

#92
Pooyan V1.04

     So here's the current state of Pooyan,  it's not really that different from the V1.03 version. There's a few effects tacked on the side of it in the form of some  transitions, but the only real changes would be window support and the addition of the various dialogs.  


About
     


    Pooyan is a single player remake of classic 1980's video game.
The players aim is to protect Pooyan from a collection of pesky bad
guys, ranging from those ever-so-nasty fire breathing foxes, pesky
spiders through to falling rocks. Who all want to knock Pooyan from
his safety cage. Pooyans no push over though and is packing from
pretty mean crossbow fire power, but you'll have to be fast on the
mouse button to keep him safe.

     This remake is developed by Micky4Fun, who got the inspiration
for it from the original software's cover art. You see, back in the
early 80's games often has beautiful game play cover illustrations,
which rarely looked anything like the actual game. So Mick decided
to convert the illustrations into a playable game graphics and
Pooyan is what he came up with.


 ----------
 Controlls:
 ----------

         ESC/ Q  = Quit Game

         P       = Pause Game

         F1      = Settings

        Space    = Start Game


        Mouse    = Move pooyan up/down and left mouse button to fire
   

 

  http://www.micky4fun.co.uk
  http://www.playbasic.com
  http://www.underwaredesign.com




Download

   removed, newer donwload bellow.


Sigtrygg

Very nice, round and good looking game!  :)


micky4fun

Hi all

Thanks for adding extra features to the game , all works fine on my full hd monitor , nice work

mick :)

kevin

#95
Pooyan V1.05

     This is about the end of the road for this update, this edition includes Vsync detection/optional support,  changed pause screen to 'standard' dialog and swap the timing to use managed timer.  As pausing the game could break some logic.   There's a bit of issue with the 'quit' dialog that need looking at, apart from that it's about done.  


About
     


    Pooyan is a single player remake of classic 1980's video game.
The players aim is to protect Pooyan from a collection of pesky bad
guys, ranging from those ever-so-nasty fire breathing foxes, pesky
spiders through to falling rocks. Who all want to knock Pooyan from
his safety cage. Pooyans no push over though and is packing from
pretty mean crossbow fire power, but you'll have to be fast on the
mouse button to keep him safe.

     This remake is developed by Micky4Fun, who got the inspiration
for it from the original software's cover art. You see, back in the
early 80's games often has beautiful game play cover illustrations,
which rarely looked anything like the actual game. So Mick decided
to convert the illustrations into a playable game graphics and
Pooyan is what he came up with.


 ----------
 Controlls:
 ----------

         ESC/ Q  = Quit Game

         P       = Pause Game

         F1      = Settings

        Space    = Start Game


        Mouse    = Move pooyan up/down and left mouse button to fire
   

 

  http://www.micky4fun.co.uk
  http://www.playbasic.com
  http://www.underwaredesign.com



Video

   




Download

    Download Pooyan V1.05 homepage



BlinkOk

i thought mick might appreciate this (origional pooyan artwork);

larger image https://twitter.com/woodpunk/status/408717771682246656/photo/1/large

micky4fun

Hi all

Yep thanks blink ok . Great piece of artwork

Mick