Debugging bullets?

3itg3itg Member, PRO Posts: 382
edited September 2012 in Working with GS (Mac)
I have a game with some ships, and some AI... they shoot at each other.
I had a problem with the game crashing, so I started removing actors from the scene to try and narrow it down.
I am now bare bones, just controls and the player on a black screen.
I am about 70% less ram (40-50mb range now) and the crash still occurs.
Firing the bullets (which is spawning an actor) makes the game crash faster.
In this slimmed down version, it is much more difficult to get the game to crash, however...

I guess this is a 2 part question.
1: does anyone have any experience with bullets? Even after turning off all rules and deleting all the actors, firing the bullets still seem to make the game crash. (not quickly, but this problem quickly compounds itself with 6-10 AI firing as well)

2: Anyone figured out a clever alternative to spawning for something like bullets?

Total MB used seems to fluctuate upwards the longer the game is played. Its much worse in the full version.
In the slimmed down version, I see "game engine" slowly but steadily tick .1 up. after about 10MB worth, suddenly it drops about 10MB but at that time the "Other" seems to jump up about 10MB.
I have used the game salad debugger, instruments to monitor resources, and console and can't seem to get any information of any use except that the type of error is a SIGSEGV

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Are you recycling bullets? That is, do you let bullets remain after they reach the edge of the scene, or do you delete them and/or move them back to their starting position when they reach the edge of the scene?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • 3itg3itg Member, PRO Posts: 382
    I have always destroyed them.
    One when self.time = 3
    And another rule to destroy if they leave the playable area.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Hmm... I would think it would be okay then. I haven't made a game with a TON of spawned actors, but the game I have published with bullets (a space invaders variation) has maybe 25 bullets on screen plus ten or so enemies and works fine. Do the bullets have fairly simple rules (e.g. a Move behavior) or are there rules/conditions, timers, constraints, or other things that could be overloading the memory?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • 3itg3itg Member, PRO Posts: 382
    edited September 2012
    (similar sleep schedules eh? Good Morning @tatiang)
    I was worried you were gonna say recycle is better and my head would explode.

    My bullets did contain rules to pass damage from actor to actor, and Move.
    then I made duplicate bullets, like AI1Bullet, AI2Bullet but made them identical otherwise. Removed everything from the Bullet except the 2 destroy conditions.
    Now when an AI or the Player runs collides with AI1Bullet it takes damage = game.AI1BulletDmg (game attribute declared by AI1).

    Long story short, bullets are almost empty now, it helped performance but the crash persists.

    Edit:
    You said you hadn't created a game with a lot of bullets before. I don't know if this is a lot of bullets either. I added counters on spawn and destroy at one point and in during combat with multiple ships, there are roughly 80 bullets "alive" at a time.
    Heres a short Video.

    In GSC my framerate is always 60fps+
    on the iPad, it stays above 50 for the most part.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Sorry, was away on a camping trip with my students. I don't have any other thoughts... maybe someone else has a suggestion? Looks like a cool game.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • 3itg3itg Member, PRO Posts: 382
    Well, I got to thinking if recycling bullets would help performance at all that I have to add it.
    after 9 hours of converting actors and bullets, testing and retesting and adding a few other tweaks I came to realize that recycling doesn't seem to help at all.
    (I started with just player and player bullets, didn't see a difference so I made changes to the AI as well). I also removed all spawning and timers for a test, didn't help.
    So with Recycled Bullets, No Timers, No Spawning and everything removed from the scene except the player character, the bullets and a button... it took 8 hours of constantly firing bullets, but it crashed. (8 hours would be fine, but its essentially an empty scene, and like I said before when I add more, the problem quickly compounds itself.)

    I built this game on the cross-platform controller template by GS.
    The bullets are the same.
  • HymloeHymloe Member Posts: 1,653
    I'm working on a similar sort of game (in that I have a player who shoots at things). :)

    And my game is crashing frequently, even though it's running smoothly.

    I'm also spawning and destroying my bullets (which I plan to make a recycling system later).

    I currently have no idea what's causing the crash. It happens sometimes even after 5 or 10 seconds when I'm just running along without much going on in the game.

    It's happening on multiple levels.

    I seem to have been experiencing these problems especially since upgrading to Game Salad 0.10.0, but I'm not really sure if that's relevant to the problem.

    Is there a way to identify what is causing a crash?

    I'm going to look into using the Debugger, and hope I can get it to tell me something...
    http://gamesalad.com/blog/question-of-the-week-using-the-debugger
  • HymloeHymloe Member Posts: 1,653
    Have you figured out what a SIGSEGV is?
  • HymloeHymloe Member Posts: 1,653
    I'm starting to wonder if it's to do with large levels.

    If the scene is too large, then maybe the calculations just break the system, for some reason?

    Did you end up solving your problem, @3itg?
  • HymloeHymloe Member Posts: 1,653
    The game doesn't crash on my Macbook Pro. It only crashes on the device.

    So can one assume that means it's memory related?

    Does the game process everything in exactly the same way when running on iPad 2 (crashing) and the Macbook Pro (running fine)?

    Should I assume it's something to do with system resources, and not game logic?
  • HymloeHymloe Member Posts: 1,653
    Just posting this to report on my status, in case it's helpful for others...

    I had a big level about 130 actors that all had a reasonable number of behaviours.

    Each one checks to see if it's within about 500 pixels of the player, and only does it's behaviours if it is.

    But it would always crash on iPad 2, and iPod Touch 4, after moving around the level a bit.

    So I've cut it back to a limit I've set for myself, of about 70 actors. Hopefully that'll see me through reliably.

    (How many actors do you have in your scene, @3itg?)
  • imjustmikeimjustmike Member Posts: 450
    Instead of having a rule in every actor that checks if it's near the player actor, why don't you have the rules in the player actor?
  • HymloeHymloe Member Posts: 1,653
    Interesting idea @imjustmike,

    How would you then send that information out to each actor to know whether it's "on" or "off"?
Sign In or Register to comment.