Coder Social home page Coder Social logo

Frames are skipping about cleo-redux HOT 11 CLOSED

cleolibrary avatar cleolibrary commented on July 20, 2024
Frames are skipping

from cleo-redux.

Comments (11)

JuniorDjjr avatar JuniorDjjr commented on July 20, 2024 1

It works correctly on main.scm, the movement is smooth.
Using this stripped from Zaz:

DEFINE OBJECTS  1
DEFINE OBJECT (dummyobject) // This is an unused object. You can put anything here.

DEFINE MISSIONS  0

DEFINE EXTERNAL_SCRIPTS  -1

DEFINE UNKNOWN_EMPTY_SEGMENT  0

DEFINE UNKNOWN_THREADS_MEMORY  0

//-------------MAIN---------------


:MAIN_1
03A4: name_thread 'MAIN'
016A: fade  0 (in)  0 ms
042C: set_total_missions_to  0
030D: set_total_mission_points_to  0
01F0: set_max_wanted_level_to  6
0111: set_wasted_busted_check_to  0 (disabled)
00C0: set_current_time  23  0

04E4: unknown_refresh_game_renderer_at  2494.5 -1668.5
03CB: set_camera  2494.5 -1668.5 13.4
0053: $PLAYER_CHAR = create_player #NULL at  2494.5 -1668.5 13.4
07AF: $PLAYER_GROUP = player $PLAYER_CHAR group
01F5: $PLAYER_ACTOR = create_emulated_actor_from_player $PLAYER_CHAR
0173: set_actor $PLAYER_ACTOR z_angle_to  7.0
0373: set_camera_directly_behind_player
070D: $PLAYER_CHAR
0629: change_stat  181 (islands unlocked) to  4  // integer see statdisp.dat
01B6: set_weather  1
04BB: select_interior  0  // select render area
01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)
01B7: release_weather
016C: restart_if_wasted at  2494.5 -1668.5 13.4 angle  180.0 unknown  0
016D: restart_if_busted at  2494.5 -1668.5 13.4 angle  180.0 unknown  0
016A: fade  1 (out)  1000 ms
0001: wait  100 ms
03E6: remove_text_box
0180: set_on_mission_flag_to $ONMISSION // Note: your missions have to use the variable defined here

:MAIN_3
0001: wait 0 ms

0@ = 0
while 0@ < 100
    0@ += 1
    0099: 1@ = random_int_in_ranges_0_to_32767 // just to make it slower
end

04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset 0.0 10.0 0.0
00A1: put_actor $PLAYER_ACTOR at 11@ 12@ 13@

        
0002: jump @MAIN_3

from cleo-redux.

JuniorDjjr avatar JuniorDjjr commented on July 20, 2024 1

It's working perfectly now, I was able to create a free camera mod without any problems.

Taking the advantage, a minor issue: 007B: in Sanny Builder for "SA Mobile" is written = instead of +=

from cleo-redux.

x87 avatar x87 commented on July 20, 2024

Does it happen when you run the same script in main.scm?

(note that 0C00 won't work in main.scm, but you can use widget keys for testing)

from cleo-redux.

JuniorDjjr avatar JuniorDjjr commented on July 20, 2024

I haven't tested it, but now I better understand the cause of the problem.

Try making 100 copies of this line:
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset 0.0 1.0 0.0
And hold Y.
The script will be slower to process, as a result, it takes around 3 seconds to process the loop and take effect.

It's like a lazy processing, I don't know. The longer the script, the longer it takes to process. Quickly takes a matter of seconds.

from cleo-redux.

x87 avatar x87 commented on July 20, 2024

this is expected, no? the game runs scripts in the main loop, which means while it executes opcodes it can't render a new frame. this is why we have wait command to put the script on hold and let the game finish rendering the frame. the more opcodes you add in between wait commands, the slower things are.

from cleo-redux.

JuniorDjjr avatar JuniorDjjr commented on July 20, 2024

But that's not how script execution works, just when "wait" is read the next game frame is executed.
You can loop 10,000 commands, the game will never skip frames.

This is for PC:

{$cleo}
0000:

while true
    wait 0
    
    if 0AB0:   is_key_pressed 89 //y, PC opcode
    then
        0@ = 0
        while 0@ < 10000
            0@ += 1
            0099: 1@ = random_int_in_ranges_0_to_32767 // just to make it slower
        end
        04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset 0.0 -10.0 0.0
        00A1: put_actor $PLAYER_ACTOR at 11@ 12@ 13@
    end
    
end

I lowered this script to only 1,000 iterations, tested it on SA:DE, pressed Y and the game ran for over 1 minute until it took effect. One possibility is that each command read, is executed 1 "wait 0" (roughly saying, to understand it). This script above would take more than 10 minutes to take effect in SA:DE.

from cleo-redux.

x87 avatar x87 commented on July 20, 2024

Can you test the same on pure main.scm?

from cleo-redux.

x87 avatar x87 commented on July 20, 2024

I can confirm the player movement is smooth on main.scm and jerking on cleo. I will look into what may cause it

from cleo-redux.

XMDS avatar XMDS commented on July 20, 2024

Remove wait 0 and it will become faster. I mentioned this problem before, but there is no time to study in these two days.

from cleo-redux.

x87 avatar x87 commented on July 20, 2024

@XMDS Loops must have wait command. It's actually a CLEO bug and a critical one, I must say.

@JuniorDjjr thanks for providing a test script and hinting the main.scm behavior. I was able to identify and fix the problem. Check the new dev build on discord.

from cleo-redux.

x87 avatar x87 commented on July 20, 2024

fixed in 0.8.3

from cleo-redux.

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.