Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Tail Smash! - Arcade driving game  (Read 3847 times)

0 Members and 1 Guest are viewing this topic.

TobBot2

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Tail Smash! - Arcade driving game
« on: March 02, 2024, 09:23:20 pm »
Hey! I've been working on this game over the course of a bit over a month.
Check it out on itch - https://tobbot2.itch.io/tail-smash

Source code is available GitHub here if you're interested (it's not pretty though) https://github.com/TobBot2/TailSmash




Let me know if you've got any questions on development whether it be technical or conceptual :)

« Last Edit: May 28, 2024, 10:53:48 pm by TobBot2 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Tail Smash! - Arcade driving game
« Reply #1 on: March 04, 2024, 12:39:47 pm »
That's a pretty cool mechanic! :)

Without having to dig through the code, what math did you use for the tail physics?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

TobBot2

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: Tail Smash! - Arcade driving game
« Reply #2 on: March 05, 2024, 06:09:22 am »
Just some inverse kinematics based off of a coding train video I saw a while back. The main logic was coded while I was in a plane (my brother challenged me to an in-flight game jam, which kicked off the project), so I couldn't look it up at the time lol but I guess I remembered enough to have it function convincingly enough.

For those unfamiliar with inverse kinematics, (or at least how I implemented it)... Basically, at the start of each update, it just moves the first node to the car's position, then it moves the next node so its distance to the first node is constrained to the chain segment's set length. Then it repeats that move + distance constraint for all subsequent nodes.

Here's a some pseudo-code of the the function Player::updateChains() in Player.cpp
for all chain nodes (starting from the car, iterating until the ball):
        node.position += node.velocity
        node.velocity += frictionForce
       
        if distance(node.position, node.parent.position) > chainSegmentLength:
                // segment := vector pointing from parent to node, with length set to chainSegmentLength
                Vector2 segment = (node.position - node.parent.position).setLength(chainSegmentLength)
               
                // node.velocity = new position - old position
                node.velocity = node.parent.position + segment - node.position
               
                node.position = node.parent.position + segment
 

As I write this, I'm realizing I'm not applying delta time correctly... Yeah, I kind of took the mentality of "There are two types of code. Good code, and production code."

But it works well enough! I might come back to this project later when I've got more time to rewrite all the code and implement some of the features I withheld to combat scope creep.

TobBot2

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: Tail Smash! - Arcade driving game
« Reply #3 on: May 28, 2024, 10:51:17 pm »
Hey! I wrote up a project report for the game cuz I thought it'd be fun and also be a great way to remind myself of my mistakes/what I would do differently. Finishing a game completely showed me a lot about aspects I never dived into (i.e. menus, levels, sound, shaders). So if you're curious on some high-level issues I ran into and what to avoid, for sure check out whichever section of the report interests you. It's organized pretty well, so it should be quick to read the information you're interested in.

Report is on a shared onedrive link cuz the file is ~1.3 MB (bigger than the attachment size for this forum).
https://1drv.ms/b/s!Akl3r7IgGzmfgbs4TvCixLDftutxsg?e=7lEqho

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Tail Smash! - Arcade driving game
« Reply #4 on: May 29, 2024, 11:32:24 pm »
That's a pretty cool write up! I especially liked the diagrams :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything