SHUFFLE PUCK "3D"

A forum to share your demonstrations stacks, fun stacks, games, etc.
Post Reply
User avatar
tperry2x
Posts: 1537
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

SHUFFLE PUCK "3D"

Post by tperry2x »

game-ideas-01 video

I can always find some ideas of things we can adapt or xtalk-ify. (Even if I lack the maths skills to do them myself).

[EDIT by -- xAction] --- changed name of this thread to match our game development action.
xAction
Posts: 285
Joined: Thu Sep 16, 2021 1:40 pm
Contact:

Re: Game ideas 1

Post by xAction »

Just get the basics in place, and then fudge the math later, fake it til you can make it.
Take that "3D" shufflepuck game for instance, that's not even 3D. it's just 2D pong, but the sprite gets shrunk as the Y location changes. Everything is just -1 or 1 (or 2 or -2, something like that)
3DShufflepuckaroo.oxtStack
(6.54 KiB) Downloaded 15 times
3DShufflePuckaroo.gif
3DShufflePuckaroo.gif (158.85 KiB) Viewed 333 times
You get prototype together and then you say "Hey internet/chatGPT/Bing Copilot how do I make X do Y?" and you get 10 wrong answers and get frustrated and solve it on your own. :D
Or have a nap and wake up and try something new and then ten years later you pick up the project and all of a sudden you know how to do it, right up until you hit some other roadblock.
User avatar
tperry2x
Posts: 1537
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

Re: Game ideas 1

Post by tperry2x »

Love this. Excellent work.
I think I'll experiment in making this a more graphical version, so just to let you know - in case you have more work you are doing on it.
Without ripping off Shufflepuck Cafe, I'll create my own character to play against and have a dabble.

Before I do though, just made some little changes:
Screenshot at 2024-03-05 11-15-37.png
Screenshot at 2024-03-05 11-15-37.png (12.71 KiB) Viewed 311 times
Changed the angle of the walls. I changed the behaviour slightly, so that the game continues if the mouse leaves the confines of the stack. The Puck cannot travel beyond the left/right confines of the stack window. To start the game, you click the "Start Game" button. (This will change and probably be a menu in the final one). Also, you stop the game by choosing the "Pointer" tool, but I'll have this stop when the escape key is pressed too.
3DShufflepuckaroo_v2.oxtstack
(7.82 KiB) Downloaded 17 times
One thing I'd like to add is the ability to also move the "Paddle" of the player up and down the play area slightly. To give extra inertia (more oomph) to the return / serving speed of the puck.
xAction
Posts: 285
Joined: Thu Sep 16, 2021 1:40 pm
Contact:

Re: Game ideas 1

Post by xAction »

Excellent! I'm working on a Game Template Stack so we don't have to reinvent the wheel for every example.

That's shufflepuckery is some dumb fun.

Since mousedown isn't used in the game (unless you make it a shooter! pew pew) you can just have a mouseDown in the card or stack script to start a game.

Since the final window size is variable you'll need some math to get to the corners of the screen.
I was over due for sleep making that first demo so I just slapped in whatever numbers seemed appropriate.

Here's the calculation of SLOPE you need for that
function Math.calculate_slope x1, y1, x2, y2
put (y2 - y1) / (x2 - x1) into slope
return slope
end Math.calculate_slope
And here's a stack to demonstrate how it is used.
SLOPE_TO_PERSPECTIVE_v1.oxtStack
(5.17 KiB) Downloaded 12 times
Slope_to_perspective_v1.gif
Slope_to_perspective_v1.gif (221.71 KiB) Viewed 305 times
Left wall adds to X (left of the card =0 ) every step of the slope
and Right wall subtracts from X (width of the card= whatever) every step of the slope

Keep the function handy, it'll be the same function used when you want to shoot at something that isn't in cardinal directions. The bullet will re-use the slope to arrive at the location targeted when it was released.
I had this function in my bag of tricks but forgot about it, and so asked BING, and ...the eye searing mathematical expressions it used to explain things made my blood pressure shoot through the roof.

Nvidia CEO:"Kids don't need to learn to code. The AI will do the coding."
Microsoft CEO:" Everyone passed calculus II, right? Right?"
User avatar
tperry2x
Posts: 1537
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

Re: Game ideas 1

Post by tperry2x »

I have to admit, I cheated.
I just resized the graphics, which replots the points.
(I didn't pass 'calculus') :lol:

Version 3 has a bit of force added, and you can now hit it past the ends of the table (at which point the game stops).
I've tried to comment throughout, so it makes sense (at least to me, but hopefully everyone else too)
3DShufflepuckaroo_v3.oxtstack
(10.15 KiB) Downloaded 13 times
FourthWorld
Posts: 281
Joined: Sat Sep 11, 2021 4:37 pm
Contact:

Re: Game ideas 1

Post by FourthWorld »

Is the Server engine part of the OXT mix? Might be nice to demonstrate relay servers with a turn-based game.
xAction
Posts: 285
Joined: Thu Sep 16, 2021 1:40 pm
Contact:

Re: Game ideas 1

Post by xAction »

3DShufflepuckaroo_v3_PaddleImpartDir.oxtStack
(8.39 KiB) Downloaded 11 times
@tperry2X : lookin' good try this

I updated it where there is no longer a random direction for just hitting the paddle
the lastPaddleX is stored every 10 game loops
if item 1 of the mouseLoc is less than the stored position, then puckDirX = -1 else puckDirX = 1
10 loops gives you enough time to move just before the puck hits, that could maybe be fine tuned

Also when the puck is initialized it gets a random direction

Also I adjusted it so that when the puck collides with the paddle, screen is locked and the puck is placed 1 pixel above the paddle so that it can't get stuck and jitter inside of the paddle.
FourthWorld wrote: Tue Mar 05, 2024 4:01 pm Is the Server engine part of the OXT mix? Might be nice to demonstrate relay servers with a turn-based game.
Was just thinking of network stuff a minute before returning to the forums and reading that.
Remember the old revChat? i got so little done because of it, but learned a bunch from being there.
User avatar
tperry2x
Posts: 1537
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

Re: SHUFFLE PUCK "3D"

Post by tperry2x »

I like it, and I've used some of your suggested code. I have tweaked it a little though:

Code: Select all

-- puck "hit by player"
if the bottom of graphic "puck" > the bottom of graphic "paddle" then set the bottom of graphic "PUCK" to the top of graphic "Paddle"-1 -- stops it getting stuck

-- instead of using "randomVector() into puckDirX" -- random left / right bounce direction
-- I'm using this instead:

-- bat the puck to the left
if the left of graphic "puck" +20 < item 1 of the loc of graphic "paddle" then put -1 into puckDirX

-- bat the puck to the right
if the right of graphic "puck" -20 > item 1 of the loc of graphic "paddle" then put 1 into puckDirX
This is so that if you hit the puck with the left or right edge of the paddle, it'll bounce in the direction you'd expect
puck-demo.gif
puck-demo.gif (384.8 KiB) Viewed 273 times
3DShufflepuckaroo_v4.oxtstack
(12.17 KiB) Downloaded 14 times
xAction
Posts: 285
Joined: Thu Sep 16, 2021 1:40 pm
Contact:

Re: SHUFFLE PUCK "3D"

Post by xAction »

Hell ya, that's working out great!

You can set the markerDrawn of those lines to false now that we know collision detection is working well.
xAction
Posts: 285
Joined: Thu Sep 16, 2021 1:40 pm
Contact:

Re: SHUFFLE PUCK "3D"

Post by xAction »

Can't help myself, Must make changes!
3DShufflepuckaroo_v5_NeonArcade.oxtStack
(14.01 KiB) Downloaded 10 times
ShufflePuckNeonArcade.gif
ShufflePuckNeonArcade.gif (262.94 KiB) Viewed 266 times
outerGlow["size"] & outerGlow["spread"] & innerGlow["size"] & innerGlow["spread"]
Applied to almost everything , with subtle changes made when the puck collides
Every Game.Loop UI.ResetGlowSpread is sent
a new global...GlowCounter increments by 1 and says "Nope, gonna glow" until it hits 20
Er...now that I think about it, it's always counting to 20 so the de-glow is not actually evenly timed, derp.
Well it looks good for the moment.

I shrunk the player paddle height a little.

Oh also added object "PuckReflection" it's offset a tiny bit from the puck and blended in.
I tried the same on the player but did not like the effect there.

Oh here's some scripts you might care to use.
add a global bShowMouseCursor
add this and include in init.App

it makes a tiny 1 pixel image to use as a cursor ID ,ie, invisible cursor
on init.InvisibleMouseCursor
put 0,0,1,1 into TinyRectangle
set the rect of the templateImage to TinyRectangle
set the showBorder of the templateImage to false
set the name of the templateImage to "InvisibleCursor"
if there is an image "InvisibleCursor" then delete image "InvisibleCursor"
create image
export snapshot from rect (rect of image "InvisibleCursor") to image "InvisibleCursor" as PNG
end init.InvisibleMouseCursor
Then Toggle.MouseCursor when game starts and toggle it back when it resets
on Toggle.MouseCursor tBool
put not bShowMouseCursor into bShowMouseCursor
if tBool is not empty then put tBool into bShowMouseCursor
if bShowMouseCursor is true then
reset cursors
set the defaultcursor to arrow
set the cursor to arrow
else
set the defaultcursor to the ID of image "InvisibleCursor"
end if
end Toggle.MouseCursor
Oh it probably makes sense to have these too
--- if something is turned on/off or true/false use a Toggle. prefix to identify it
on Toggle.Playing tBool
if tBool is not empty then
put tBool into bPlaying
else
put not bPlaying into bPlaying
end if
Toggle.MouseCursor (not bPlaying)
end Toggle.Playing

--- if we left the window then pause, maybe something awful is happening with script
--- if we return to window, play the game
on mouseEnter
if bPlaying is false then
choose browse tool
Toggle.Playing
Game.Continue
end if
end mouseEnter
User avatar
tperry2x
Posts: 1537
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

Re: SHUFFLE PUCK "3D"

Post by tperry2x »

I like your version too.
I've decided to leave mine at this point, as it illustrates the concepts to anyone and goes as far as I need to go with it.
screenshot-v5.png
screenshot-v5.png (419.24 KiB) Viewed 252 times
Feel free to carry on with your version as I like the Tron-esque appearance.
3DShufflepuckaroo_v5-tp.oxtstack
(443.07 KiB) Downloaded 15 times
xAction
Posts: 285
Joined: Thu Sep 16, 2021 1:40 pm
Contact:

Re: SHUFFLE PUCK "3D"

Post by xAction »

Great!. Looks so professional. And right, it's good to hit a stopping point for someone to come along and learn from it. Start adding menu screens and options and it's a lot more code to break by accident.
User avatar
OpenXTalkPaul
Posts: 1574
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: SHUFFLE PUCK "3D"

Post by OpenXTalkPaul »

Wow awesome, I loved me some Shufflepuck back in the day.
Just needs some funny looking Aliens characters to play against.
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests