Anyone willing and able to help with a weird collision issue?

jimbob15515jimbob15515 Posts: 3Member
edited August 3 in Programming

TLDR: I'm having an issue with my game that does not always occur and I can't seem to fix it. Hoping somebody can take a look at it for me to see what I'm doing wrong.

Longer Version:
In the 2D game I'm making, the player flies around collecting orbs of light (up to 10 at a time in the most recent iteration) and depositing them at a designated area or areas where suns should go. If the player deposits the correct number of orbs of the correct color (or pattern of colors), they win. As the game advances, there will be traps and optional enemies to make the game more challenging.

Currently, about 75% of the time, everything works correctly and the game "scores" all of the orbs properly as the sun absorbs them. The other 25% of the time though, the game does not score the orbs properly, and all of the orbs past a certain point simply disappear all at once without counting down the number of orbs required on the UI, or triggering the sun to increase in size or intensity.

The issue can sometimes be hard to recreate, but here's two video examples (sorry for potato quality):

Incase it isn't clear, in the above video, I pick up the max of 12 orbs, but the game only scores half of them. It's much more obvious in the second video.

It does usually work as intended, but when it glitches, it can be game breaking.

I am new to coding, so I've gone through twice now with the guidance of a reddit user and cleaned up my code significantly both visually and by refactoring a great deal, but I still can't seem to figure out the heart of the issue.

Would anyone be willing to download the project file and take a look and see if they can figure out what is going on? If so, let me know and I can send you a link to it.

EDIT: I was going to PM the link to people willing to look , but here it is: https://drive.google.com/open?id=1SAoH13ivxpGmR2zyw7ovAAPjP2eserbT

The relevant files are located under the RevisedScripts folder and are Orb_Rev3, Player_Rev3, and Sun_Rev3.

I'd greatly appreciate it as I'm pulling my hair out trying various things to figure this out to no avail.


Tags :

Comments

  • MegalomaniakMegalomaniak Posts: 1,585Admin
    edited August 3

    @jimbob15515 said:

    Would anyone be willing to download the project file and take a look and see if they can figure out what is going on? If so, let me know and I can send you a link to it.

    I'd greatly appreciate it as I'm pulling my hair out trying various things to figure this out to no avail.

    It would probably help towards that if you provided a link toward said project file(s).

  • jimbob15515jimbob15515 Posts: 3Member

    Yeah, I was more intending to private message the file to people if they were interested in taking a look, but here you go: https://drive.google.com/open?id=1SAoH13ivxpGmR2zyw7ovAAPjP2eserbT

  • MegalomaniakMegalomaniak Posts: 1,585Admin

    Ah, yeah, sorry. I had just woken up and was somehow misreading it, but now that I reread I can clearly see it in my own quote there.

  • MegalomaniakMegalomaniak Posts: 1,585Admin
    edited August 3

    So far that I can see nothing abnormal is actually going on, sometimes the orbs can just 'fall in' to the star within a game cycle I think. If you want them to be consumed in an order, one by one, you might simply have to implement some additional logic to effectively have a 'congestion' of the orbs, if that makes sense.

    edit: or maybe the issue is that I don't see the UI. I did see all of the orbs past first 3 or 4 suddenly disappear all at once on the very first try though.

  • MegalomaniakMegalomaniak Posts: 1,585Admin
    edited August 3

    I have found a more critical issue though. If you fly by the created sun with the next batch of orbs and suddenly turn around so the orbs reorient behind you and get suddenly thrown inside the bounds of the star they aren't properly cleared, and while they wont be visible, the 'slots' on the player are still effectively 'filled' such that you can't pick up new orbs in their place. Only the end of the tail can be filled with about 4 or so.

    Was difficult to get a screen-grab of it, since the end of the tail is outside the view bounds. On reflection, should have just changed the size of the window from project settings or something.

    edit: looking at your videos, it might actually be the same underlying issue.
    Attempt to call function 'set_follow_player' in base 'previously freed instance' on a null instance.

    The issue lies with your orb clearance, I guess it's a problem when multiple orbs are cleared within the same cycle. So my suggestion to implement orb congestion might actually help solve it.

  • jimbob15515jimbob15515 Posts: 3Member

    Yes, that's exactly the issue that I was worried about. Previously had an orb 'drop' feature implemented where you could drop the last orb, and obviously since they weren't properly clearing out, it would crash the game.

    Thank you for taking a look. When I get home tonight I'll see if I can set up some kind of queue for the orbs like you suggested.

  • MegalomaniakMegalomaniak Posts: 1,585Admin
    edited August 3

    Even if implementing a queue doesn't directly fix the issue, it does have the benefit of enabling you to make the orb depositing (edit: visually) more interesting, and it might become easier to debug the individual orb depositing since they will happen in a more orderly fashion.

  • MegalomaniakMegalomaniak Posts: 1,585Admin

    Heya, just to follow up, did you get it solved? :)

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file