Giter Site home page Giter Site logo

Reworking wieldables about cogito HOT 16 CLOSED

phazorknight avatar phazorknight commented on August 25, 2024
Reworking wieldables

from cogito.

Comments (16)

Phazorknight avatar Phazorknight commented on August 25, 2024 1

Hey, sorry for the radio silence.

This has progressed, just need to clean up a bit more and do a proper documentation.
But here's the summary so you can start working on your own wieldable.
This is also how they're set up in the current latest version 202401.15:

  • the pickup of your wieldable can/should be a regular pickup
  • the item resource of your wieldable should be assigned to the slot of your pickup.

Now the trickier part:

  • Your wieldable model/mesh and their logic need to be attached/a child to a Node under Player/Neck/Head/Wieldables/
  • The node needs to have the same name as the string name of your wieldable item resource.
  • The node also needs to be added to the Wieldables node array of the PlayerInteractionComponent

Finally your wieldable logic needs to contain at least these two functions:
action_primary(_camera_collision:Vector3, _passed_item_reference:InventoryItemPD)
action_secondary(_is_released: bool)

_camera_collision is used for spawning projectiles if needed. _passed_item_reference is used to update your item resource.
_is_released is used to create behaviour that reacts if the input for action_secondary is being let go (used for aim-down-sights for example)

The Wieldable_Flashlight.gd and WieldablePistol.gd are set up with these, so I can recommend just looking/copying those when you want to setup your own.

from cogito.

Phazorknight avatar Phazorknight commented on August 25, 2024 1

Hey, no, haven't really changed anything else as I was working on the Quest system.

If you wanna take another look at it be my quest, I would be keen how to set something like this asset up with Cogito's system to see if there's more stuff to improve: https://levraicoincoin.itch.io/animated-fps-pistol

from cogito.

grgp avatar grgp commented on August 25, 2024 1

@Phazorknight Hey thanks for the constant updates! I haven't seen this being suggested yet, but are you also planning to do a melee wieldables? A simple baton or a crowbar would be cool.

I found a reference to melee on the wieldable settings on the readme, but I couldn't find anything on the demo scene. Changing the Wieldable Range and Wieldable Damage to a non-zero value also didn't seem to do anything.

I think for starters, just a simple click -> play one animation -> hit would be pretty good already. And then later do something more complex like sword swinging right-to-left-to-right animations, blocks, parries, power attacks. Some of that might be out of scope for this template, though.

I like how Gloomwood does it, it looks pretty old-school. And here are also some Godot examples.

from cogito.

Phazorknight avatar Phazorknight commented on August 25, 2024 1

Holy smokes that Soulslike template is mighty impressive.

And yes, I'm planning to add a simple melee wieldable soon.
My idea would be something like a crowbar that moves a damage area around in front of the player when swung and applies damage to objects inside of it.

And then later do something more complex like sword swinging right-to-left-to-right animations, blocks, parries, power attacks. Some of that might be out of scope for this template, though.

As this is very game-specific design, I'm not planning on examples for that, but the wieldables are set up in a way that custom behaviour like this should not be too hard to implement. The basic framework to create stuff like blocking or charge attacks is in place.

from cogito.

Phazorknight avatar Phazorknight commented on August 25, 2024 1

I've just added a new melee wieldable: a Pickaxe.
It uses an Area3D, which has it's monitoring property switched OFF per default.
When swinging, the swing animation turns the monitoring propery ON, thus detecting if it hits any objects with a HitboxComponent. If it does, damage based on the WieldableItem damage is applied.

You can test this by hitting the TargetDestructables in the scene.
Using an Area3D this way should allow pretty good customization about shape and timing.

The pickaxe has currently no secondary option, but if anyone wants to try implementing a block or charged swing or whatever, that's a great spot to experiment.

from cogito.

grgp avatar grgp commented on August 25, 2024 1

Nice!!! Wow that was quick, thank you so much!

from cogito.

Phazorknight avatar Phazorknight commented on August 25, 2024

Basics of new Wieldable system are in place.
A couple more todos:

  • Clean/restructure up how the Wieldables are placed in the Player scene for animation handling.
  • Add Reload functionality.
  • Polish Wieldable Info HUD area in screen bottom right.

from cogito.

Phazorknight avatar Phazorknight commented on August 25, 2024

Just to update this here:

  • Reload functionality is done.
  • Still need to clean up Player scene wieldables a bit / make it clearer on how they're setup.

from cogito.

paperclipmaximizer avatar paperclipmaximizer commented on August 25, 2024

What's the progress here? I've been working on implementing a key 'wieldable' and would like to see your changes before I submit a PR

from cogito.

Phazorknight avatar Phazorknight commented on August 25, 2024

Hey everyone,
Wanted to give an update that I'll try to improve this more, so if you're working on your own wieldables, be aware that some changes are coming.

  • Wieldable Nodes that are part of the Player tscn will also be turned into tscn's to allow better modularity and maybe even instancing.
  • Will try to move Wieldable animations inside of them.
  • Making the wieldable actions be controlled by signals to improve decoupling that currently causes bugs and crashes.

from cogito.

Phazorknight avatar Phazorknight commented on August 25, 2024

First bigger steps toward this are now out in update BETA 202402.10.

In regards to using signals, I'm currently not sure how useful this is in practice as the player interaction component has to handle any wieldables pretty directly and usually ever only one at a time.

from cogito.

ac-arcana avatar ac-arcana commented on August 25, 2024

Perhaps as an alternative to signals you could utilize a base class with a class name like Wieldable that had the necessary functions defined in it.
Then to make a new wieldable we can extend Wieldable and implement our own function logic.

from cogito.

ac-arcana avatar ac-arcana commented on August 25, 2024

@Phazorknight, are you still planning more changes to wieldables? I think everything you've listed here is pretty much complete now.

from cogito.

Phazorknight avatar Phazorknight commented on August 25, 2024

Another update, mostly related to wieldable handling, not too much to the wieldables themselves.
This should reduce unexpected behaviour when swapping/reloading wieldables, as there are now checks in place to stop other actions when swapping or reloading takes place.

from cogito.

grgp avatar grgp commented on August 25, 2024

Awesome! Looking forward to it.

And yeah that Soulslike template is crazy. If you go to the author's YouTube channel, he probably has the most detailed guide and devlog for any Godot template ever.

from cogito.

Phazorknight avatar Phazorknight commented on August 25, 2024

Closing this as the Wieldables have been fully redone since I first opened this issue.

from cogito.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.