schwankende Spielgeschwindigkeit

  • schwankende Spielgeschwindigkeit

    In meinem spiel "challenge Islands" habe ich ein haufen objekte in einen Raum gepackt. Wenn man nun die NPCs tötet, wird das spiel plötzlich so schnell, dass man kaum noch reagieren kann. Wie krig ich das hin, dass das spiel kontinuirlich in einer Geschwindigkeit arbeitet?
    Copyraid © 2008 Quantin Danyal. All rights are reversed.
  • RE: schwankende Spielgeschwindigkeit

    Original von Danyal
    Wie krig ich das hin, dass das spiel kontinuirlich in einer Geschwindigkeit arbeitet?
    Einen effizienteren Code benutzen? Für mich die einzig logische Schlussfolgerung!
  • was hast du denn bei den NPC objecten überhaubt gemacht ohne
    zu wissen was du gemacht hast ist es schwerer für uns zu eraten ;)

    Das spiel arbeitet automatisch kontinuirlich in der von dir eingestellten Geschwindigkeit (roomspeed), normalerweise mit 30FPS.


    sonst stimme ich zu was TrunX geschrieben hat :D
    ...
  • RE: schwankende Spielgeschwindigkeit

    Original von King Andre
    Original von Danyal
    Wie krig ich das hin, dass das spiel kontinuirlich in einer Geschwindigkeit arbeitet?
    Einen effizienteren Code benutzen? Für mich die einzig logische Schlussfolgerung!


    Was für'n code?

    Egal... ich hab den room speed auf 20 und 20 Gegner
    {
    Information about object: bear

    Sprite: creatures
    Solid: true
    Visible: true
    Depth: 0
    Persistent: false
    Parent: <no parent>
    Mask: <same as sprite>

    Create Event:
    set variable hp to 5
    set variable image_single to 228
    set variable walk to 1
    set variable left to 0
    set variable up to 1
    set variable down to 0
    set variable right to 0
    set variable hit to 1

    Destroy Event:
    create instance of object blood at relative position (0,0)
    play sound kill; looping: false

    Alarm Event for alarm 0:
    snap position to a grid with cells of 32 by 32 pixels
    start moving in directions 000010000 with speed set to 0
    set variable walk to 1

    Step Event:
    if object is aligned with grid with cells of 32 by 32 pixels
    if walk is equal to 1
    if relative position (0,-32) is collision free for Only solid objects
    with a chance of 1 out of 50 do perform the next action
    set variable walk to 0
    set time line wolf_up at position 0
    set variable image_single to 228
    set variable down to 0
    set variable left to 0
    set variable right to 0
    set variable up to 1
    set Alarm 0 to 8
    start moving in directions 000000010 with speed set to 4
    if object is aligned with grid with cells of 32 by 32 pixels
    if walk is equal to 1
    with a chance of 1 out of 50 do perform the next action
    if relative position (0,32) is collision free for Only solid objects
    set variable walk to 0
    set time line wolf_down at position 0
    set variable image_single to 228+3
    set variable down to 1
    set variable up to 0
    set variable left to 0
    set variable right to 0
    set Alarm 0 to 8
    start moving in directions 010000000 with speed set to 4
    if object is aligned with grid with cells of 32 by 32 pixels
    if walk is equal to 1
    with a chance of 1 out of 50 do perform the next action
    if relative position (-32,0) is collision free for Only solid objects
    set variable walk to 0
    set time line wolf_left at position 0
    set variable image_single to 228+6
    set variable down to 0
    set variable up to 0
    set variable left to 1
    set variable right to 0
    set Alarm 0 to 8
    start moving in directions 000100000 with speed set to 4
    if object is aligned with grid with cells of 32 by 32 pixels
    if walk is equal to 1
    with a chance of 1 out of 50 do perform the next action
    if relative position (32,0) is collision free for Only solid objects
    set variable walk to 0
    set time line wolf_right at position 0
    set variable image_single to 228+9
    set variable down to 0
    set variable up to 0
    set variable left to 0
    set variable right to 1
    set Alarm 0 to 8
    start moving in directions 000001000 with speed set to 4
    if object is aligned with grid with cells of 32 by 32 pixels
    execute code:

    if distance_to_object(knight)<160
    {
    instance_change(bearK,false)
    }
    if object is aligned with grid with cells of 32 by 32 pixels
    execute code:

    if distance_to_object(mage)<160
    {
    instance_change(bearM,false)
    }
    if object is aligned with grid with cells of 32 by 32 pixels
    execute code:

    if distance_to_object(archer)<160
    {
    instance_change(bearA,false)
    }

    Collision Event with object arrow:
    for other object: destroy the instance
    if walk is equal to 1
    change the instance into object bearA, not performing events

    Collision Event with object low fire:
    if walk is equal to 1
    change the instance into object bearM, not performing events
    }

    die da rumgurken. Sonst noch Fragen?
    Copyraid © 2008 Quantin Danyal. All rights are reversed.

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von Danyal ()

  • Irgendwie drawt der nich... daran das du bei deinem code die ) vergessen hast, liegt's schonmal nich... Ich hab das ganze mal in Drag&Drop gemacht... klappt immernoch nich!
    Copyraid © 2008 Quantin Danyal. All rights are reversed.
  • GML-Quellcode

    1. draw_text(view_left[0]+2,view_top[0]+2,"FPS: "+string(fps));


    Das ist der richtige Code für den 5.3. TrunX hatte den Code für den 6er geschrieben.
    "Die Erde ist ein Irrenhaus. Dabei könnte das bis heute erreichte Wissen der Menschheit aus ihr ein Paradies machen. Dafür müsste die weltweite Gesellschaft allerdings zur Vernunft kommen."
    - Joseph Weizenbaum
  • jetzt klappts...
    fps is am anfang 19, nachdem ich 5 bären getötet habe 12 und nachdem die blutflecken verschwunden waren 20. wenn ich room speed auf 30 stelle ist er letzte wert 25.
    Copyraid © 2008 Quantin Danyal. All rights are reversed.
  • Dann scheints an den Blutflecken zu liegen... führen die irgendwas im Stepevent aus?
    Dein Spiel scheint aber allgmein nicht sehr performanceoptimiert zu sein, wenns nicht über 25FPS hinauskommt...
    Dabei deaktivierst du doch instanzen außerhalb der Views?

    Ach und inwiefern wirds jetzt plötzlich so schnell das du nicht mehr reagieren kannst? Dieser eine FPS Unterschied sollte kaum wahrnehmbar sein.
  • Die Blutflecken lösen sich in einer timeline per image_alpha auf und zerstören sich nach 100 steps selbst. 25 FPS sind zu schnell, weil man innerhalb von 7 steps nachdem sich der Bär aufrichtet die Schild-Taste drücken muss um keinen Schaden zu nehmen. Das mit dem deaktivieren kann ich nicht feststellen ob das auch wirklich klappt. Außerdem is mein pc auch nich der neuste...
    Copyraid © 2008 Quantin Danyal. All rights are reversed.

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von Danyal ()

  • Benutzer online 1

    1 Besucher