Results 1 to 19 of 19

[Release] Turn!it

This is a discussion on [Release] Turn!it within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Hey guys, maybe you wanna try out my new game called "Turn!t" (Pronounced: Turn It ) About the game: First ...

  
  1. #1
    QJ Gamer Blue
    Points: 2,319, Level: 29
    Level completed: 13%, Points required for next Level: 131
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Join Date
    Jul 2009
    Location
    Germany
    Posts
    22
    QJ Pts
    2,319
    Level
    29
    Downloads
    0
    Uploads
    0

    Default [Release] Turn!it

    Hey guys,

    maybe you wanna try out my new game called "Turn!t" (Pronounced: Turn It )

    About the game:

    First of all, this is open source, so you can mod/ expand/ destroy it at your will. The goal of the game is simple as this: Don't lose
    On the screen there's a picture rotating all the time. Your task is, to turn your PSP to keep the picture horizontally. Because only then you can read the "hidden" hint telling you what button to press in order to proceed and to not get a "Fail". You just have one second to press the right button, otherwise you get the already mentioned fail. After 5 fails you are game over. Who's straining himself a bit is able to read the hint though without turning the PSP, but that's not the real sense, is it ;)

    Additional info:

    I created this game just as an exemplar explaining the task for some coding contest i made on www dot pspking dot de
    so this game was never really ment to be completely perfect!

    Download here:

    www dot mediafire dot com / download dot php ? eexmyyymtyv



  2. #2
    Lua guy
    Points: 11,690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Join Date
    Jan 2008
    Location
    Wales, cardiff
    Posts
    1,442
    QJ Pts
    11,690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Default

    Turn!t by Preyker.zip

    Sounds nice

  3. #3
    Local Tech
    Points: 9,044, Level: 63
    Level completed: 98%, Points required for next Level: 6
    Overall activity: 27.0%

    Join Date
    Oct 2007
    Location
    home
    Posts
    1,821
    QJ Pts
    9,044
    Level
    63
    Downloads
    1
    Uploads
    0

    Default

    wow
    cool
    this is pretty creative!
    Thank you

  4. #4
    QJ Gamer Gold
    Points: 13,372, Level: 75
    Level completed: 31%, Points required for next Level: 278
    Overall activity: 0%

    Join Date
    Nov 2008
    Location
    CAD
    Posts
    693
    QJ Pts
    13,372
    Level
    75
    Downloads
    19
    Uploads
    4

    Default

    Maybe some screenshots ?
    That epic dude.

  5. #5
    QJ Gamer Blue
    Points: 2,319, Level: 29
    Level completed: 13%, Points required for next Level: 131
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Join Date
    Jul 2009
    Location
    Germany
    Posts
    22
    QJ Pts
    2,319
    Level
    29
    Downloads
    0
    Uploads
    0

    Default

    Sry, i cant post any screenshots:

    To be able to post links or images your post count must be 10 or greater. You currently have 5 posts.

    Please remove links from your message, then you will be able to submit your post.

    this sucks...

  6. #6
    QJ Gamer Green
    Points: 3,411, Level: 36
    Level completed: 41%, Points required for next Level: 89
    Overall activity: 63.0%

    Join Date
    Jan 2009
    Posts
    362
    QJ Pts
    3,411
    Level
    36
    My Mood
    Psychedelic
    Downloads
    15
    Uploads
    0

    Default

    great game man, keep up the good work!

  7. #7
    Points: 2,089, Level: 27
    Level completed: 60%, Points required for next Level: 61
    Overall activity: 0%

    Join Date
    Feb 2009
    Location
    Duisburg, Germany
    Posts
    20
    QJ Pts
    2,089
    Level
    27
    Downloads
    0
    Uploads
    0

    Default







    I think it's a well done game, but the picture spins a bit too fast, you can't read the Button clearly.

  8. #8
    QJ Gamer Blue
    Points: 2,319, Level: 29
    Level completed: 13%, Points required for next Level: 131
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Join Date
    Jul 2009
    Location
    Germany
    Posts
    22
    QJ Pts
    2,319
    Level
    29
    Downloads
    0
    Uploads
    0

    Default

    thank you all, and thanks dreiundachzig for posting the screenshots ;)

    ---
    EDIT:

    Ok, just finished doing some minor performance improvements, designing the eboot and lowering the rotation speed a little
    so there you go: version 1.1

    www DOT mediafire DOT com / ?jqmky0nbwnd

    Might be too easy now, but you can simply adjust the rotation speed in the code on line 71 where it says:

    "bg_rotation = bg_rotation + 0.025"

    the number at the end is the speed. in version 1.0 this was 0.05
    so 0.05 is fast and 0.025 is slow. you will have to figure it out on your own which speed is best for you.
    Last edited by Preyker; 08-10-2009 at 06:26 PM.

  9. #9
    QJ Gamer Bronze
    Points: 6,204, Level: 51
    Level completed: 27%, Points required for next Level: 146
    Overall activity: 25.0%

    Join Date
    Nov 2006
    Posts
    57
    QJ Pts
    6,204
    Level
    51
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by Preyker View Post
    the number at the end is the speed. in version 1.0 this was 0.05
    so 0.05 is fast and 0.025 is slow. you will have to figure it out on your own which speed is best for you.
    Maybe 0,375?

  10. #10
    Developer and Tutor.
    Points: 8,736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Join Date
    Jul 2007
    Location
    Widnes, England
    Posts
    1,649
    QJ Pts
    8,736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Default

    you could implement a menu that allows you to change this difficulty in the game, for example easy, medium, hard and insane.
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  11. #11
    QJ Gamer Silver
    Points: 12,453, Level: 73
    Level completed: 1%, Points required for next Level: 397
    Overall activity: 80.0%

    Join Date
    Mar 2007
    Posts
    1,129
    QJ Pts
    12,453
    Level
    73
    Downloads
    0
    Uploads
    0

    Default

    I've never used PGE but I'm very experienced with Lua (see TruFlow, TruPhoto, Let's Roll!, etc). I'm going to suggest some optimizations seeing as PGE was based off Lua and looks very easy to understand.

    First off, take a look at this block of code which seems to be repeated 8 times for each button.
    Code:
    	if keynumber == 1 then
    	timetopress = timetopress + 1
    	links:activate()
    	links:draweasy(x, 0, bg_rotation)
    	
    		if timetopress <= 100 and pge.controls.pressed(PGE_CTRL_LEFT) then
    		keynumber = pge.math.randint(1, 8)
    		keynumber = pge.math.randint(1, 8)
    		timetopress = 0
    		end
    		
    		if timetopress > 100 then
    		mis_score = mis_score + 1
    		keynumber = pge.math.randint(1, 8)
    		keynumber = pge.math.randint(1, 8)
    		timetopress = 0
    		end
    		
    	end
    Now, the only difference I see in each of these blocks is 'keynumber' variable, the picture being drawn, and the button to be detected.

    The first thing I see you can do, seeing as 'keynumber' is always defined and always 1-8, is move
    Code:
    timetopress = timetopress + 1
    outside the block, so you only need one. You can actually do the same with
    Code:
    		if timetopress > 100 then
    		mis_score = mis_score + 1
    		keynumber = pge.math.randint(1, 8)
    		keynumber = pge.math.randint(1, 8)
    		timetopress = 0
    		end
    seeing as it has no key specific code. Another thing I was curious about is why you have it get a random number twice. Was once not sufficient?

    Another thing I noticed was that you have a picture for each button. Not only does this consume memory and add clutter, but seeing as you are already using fonts, a quick modification would clean up the code as well. I'm not familiar with PGE's limitations, but as long as you can print font to a picture, then this should work fine. The idea is to create two images rather than nine. One is the original background, then the second will be modified throughout the game to display different buttons.

    Start by loading your background as usual. Then create a new function which will render the other images as needed. It works by first making a copy of the original background, generating a new 'keynumber', then drawing the text on the image based on 'keynumber'. You also can reset your timer here as you always reset it when loading a new button. Here's an idea of what it would look like.
    Code:
    function newbutton()
    	buttonpic = backgpic
    	timetopress = 0
    	keynumber = pge.math.randint(1, 8)
    	if keynumber = 1 then
    		--print text to buttonpic
    	end
    	if keynumber = 2
    	--etc etc
    end
    Then, whenever you needed a new 'keynumber', rather than calling
    Code:
    keynumber = pge.math.randint(1, 8)
    just call 'newbutton()'. In addition, you do not need to print the background and button image separately now, just change
    Code:
    	backgpic:activate()
    	backgpic:draweasy(x, 0, bg_rotation)
    to
    Code:
    	buttonpic:activate()
    	buttonpic:draweasy(x, 0, bg_rotation)
    This also allows you to remove all instances of individual button pictures and renderings.

    Because of this, the only thing left inside your 'keynumber' blocks of code should be
    Code:
    	if keynumber == 1 then
    		if timetopress <= 100 and pge.controls.pressed(PGE_CTRL_LEFT) then
    		newbutton()
    		end
    	end
    You can rearrange this, but it is by no means necessary. One move is to combine the two if statements
    Code:
    if keynumber == 1 and pge.controls.pressed(PGE_CTRL_LEFT) then
    and then put all of the 'keynumber' blocks inside
    Code:
    if timetopress <= 100
    Instead of setting it up with a series of 'if's, you could casade 'if' 'elseif' ... 'else'. This would easily allow you to add a function in the case that the user pushes the wrong button, say play a sound or add a fail.

    Finally, a couple small optimizations
    Code:
    	verdana18:print(350, 5, green, "Fails: ")
    	verdana18:print(400, 5, green, mis_score)
    	verdana18:print(420, 5, green, "/5")
    could be simplified to
    Code:
    verdana18:print(350, 5, green, "Fails: "..mis_score.."/5")
    making use of string concatenation.

    In functions start() and gameover(),
    Code:
    	pge.gfx.enddrawing()
    	pge.gfx.swapbuffers()
    should be moved to directly after the draw, so that they are written before another function can be called. Similar situation with
    Code:
    	if mis_score >= 5 then
    	pge.delay(1000000)
    	pge.delay(1000000)
    	gameover()
    	end
    in game(), you should move that to the end of the function, past the drawing code. And you only need one delay, perhaps 'pge.delay(2000000)' would work? That seems like a long time, is delay not in milliseconds anymore?

    Another issue exists, but I won't go into it too much as it would require a bigger fix. You call functions from functions, never ending the first, so eventually you could end up running with something to the effect of
    Code:
    start(game(gameover(start(game(gameover())))))
    And that's only after two complete games. Imagine if someone were playing for hours, the PSP's memory would be filled to the brim. I can help you fix this problem as well, but I going to take a break. If you would like any help, as you can see, I am more than happy to provide my advice at no additional charge. :icon_bigg

  12. #12
    QJ Gamer Blue
    Points: 2,319, Level: 29
    Level completed: 13%, Points required for next Level: 131
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Join Date
    Jul 2009
    Location
    Germany
    Posts
    22
    QJ Pts
    2,319
    Level
    29
    Downloads
    0
    Uploads
    0

    Default

    Yh, i see, the code could be way smaller, you're right, thanks.
    So what I yet didnt know: you have to end functions manually? i always thought, just calling another would override the current one and thats it...
    so pls tell me how to end functions. this could also be the reason why my new game i'm currently working on always chrashes after a few functions.

  13. #13
    QJ Gamer Silver
    Points: 12,453, Level: 73
    Level completed: 1%, Points required for next Level: 397
    Overall activity: 80.0%

    Join Date
    Mar 2007
    Posts
    1,129
    QJ Pts
    12,453
    Level
    73
    Downloads
    0
    Uploads
    0

    Default

    You don't need to end them manually. Once they reach the last 'end' the function stops running. What you did in this script was call another function inside of another. If you let the function end first, then call the next function, it will prevent them from stacking up.

    For instance, I will show you how you can fix this in this script. Right now you have:
    Code:
    while pge.running() do
    	start()
    end
    which jumps to
    Code:
    function start()
    	while pge.running() do
    	--code
    	game()
    	--code
    	end
    end
    which jumps to
    Code:
    function game()
    	while pge.running() do
    	--code
    	gameover()
    	--code
    	end
    end
    which jumps to
    Code:
    function gameover()
    	while pge.running() do
    	--code
    	start()
    	--code
    	end
    end
    Catch my drift? Since you know you will always loop start() then game() then gameover(), you can just break; out of each while loop, subsequently ending the function. The new code would resemble
    Code:
    function start()
    	while pge.running() do
    	--code
    	break
    	--code
    	end
    end
    
    function game()
    	while pge.running() do
    	--code
    	break
    	--code
    	end
    end
    
    function gameover()
    	while pge.running() do
    	--code
    	break
    	--code
    	end
    end
    
    while pge.running() do
    	start()
    	game()
    	gameover()
    end
    It all has to do with program flow, so each program may have a different solution. If would like my help and don't want to discuss it out in the open, just PM me.

  14. #14
    QJ Gamer Green
    Points: 3,596, Level: 37
    Level completed: 64%, Points required for next Level: 54
    Overall activity: 0%

    Join Date
    May 2008
    Posts
    291
    QJ Pts
    3,596
    Level
    37
    Downloads
    0
    Uploads
    0

    Default

    Cool Da_MerV made his return.
    Currently open for Testing. PM me. QJ letter limit is retarded.

  15. #15
    QJ Gamer Blue
    Points: 2,319, Level: 29
    Level completed: 13%, Points required for next Level: 131
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Join Date
    Jul 2009
    Location
    Germany
    Posts
    22
    QJ Pts
    2,319
    Level
    29
    Downloads
    0
    Uploads
    0

    Default

    Thx a lot Da_MerV ! How could i forget the "break"... when i started programming in pge i actually even used the "break" var very often. dunno how i got to forget this nice little word...
    However i talked to Bumuckl (do u now him in the us?) as well and told me something like this, which i find impressive to get on this idea:

    Code:
    -- An example:
    
    whichfunction = 1
    
    function 1()
       do this...
       do that...
       ...
       if pge.controls.pressed(PGE_CTRL_CROSS) then
       whichfunction = 2
       end
    end
    
    function whatever()
       do this again...
       and that again...
       ...
       if pge.controls.pressed(PGE_CTRL_CROSS) then
       whichfunction = 1
       end
    end
    
    while pge.running() do
       if whichfunction == 1 then
       1()
       elseif whichfunction == 2 then
       whatever()
       end
    end
    Nice, huh? That would never have occurred to me... and this should work as well, shouldnt it?

  16. #16
    Points: 7,208, Level: 56
    Level completed: 29%, Points required for next Level: 142
    Overall activity: 0%

    Join Date
    Dec 2007
    Location
    Toronto
    Posts
    0
    QJ Pts
    7,208
    Level
    56
    Downloads
    0
    Uploads
    0

    Default

    Looks nice is this your first game?

  17. #17
    QJ Gamer Silver
    Points: 12,453, Level: 73
    Level completed: 1%, Points required for next Level: 397
    Overall activity: 80.0%

    Join Date
    Mar 2007
    Posts
    1,129
    QJ Pts
    12,453
    Level
    73
    Downloads
    0
    Uploads
    0

    Default

    This is a method I have used before. However, I try to avoid this as its 'messy'. I guess its more of a matter of preference. As I said, its program flow, so it should be taken on a case by case basis. The method I described is indeed the most efficient seeing as you know ahead of time which functions will be called and in what order.

    I'm sorry but I'm not familiar with the user "Bumuckl". The US has approximately 300 million people, its a stretch that I would have run into him. I have seen some of his work however, and I can see he is a dedicated worker and is on his way to programming expertise.

  18. #18
    QJ Gamer Blue
    Points: 2,319, Level: 29
    Level completed: 13%, Points required for next Level: 131
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Join Date
    Jul 2009
    Location
    Germany
    Posts
    22
    QJ Pts
    2,319
    Level
    29
    Downloads
    0
    Uploads
    0

    Default

    @nick48:

    nope, i did "psp copter" before

    @Da_MerV:

    thx, but there's one more thing confusing me in your code:

    Code:
    while pge.running() do
    	start()
    	game()
    	gameover()
    end
    doesnt this call all functions at once? i only want one function to be ran at a time...

  19. #19
    QJ Gamer Silver
    Points: 12,453, Level: 73
    Level completed: 1%, Points required for next Level: 397
    Overall activity: 80.0%

    Join Date
    Mar 2007
    Posts
    1,129
    QJ Pts
    12,453
    Level
    73
    Downloads
    0
    Uploads
    0

    Default

    No, Lua, like most programming languages, is linear. It finishes each command successively so it will not start game() until it finishes with start() and gameover() won't run until game() returns.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





All times are GMT -8. The time now is 02:35 AM.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .