Client progress

Most people who want to remake Graal want to also give it the exact same feeling as the game they’re cloning. That’s not nearly as possible with premade packs as it is if you write the code from scratch.

your opinions on coding are always great because i know they come from experience

You can probably get a Zelda Link to the Past physics engine online fairly easily.

I do not consider it a false hope… I’m always glad to see stuff being made by users of this forum, may it never end up finished and polished, whatever it is shows creative energy and it’s the best energy.

I’ve pushed through the more annoying part of the system variables/functions code. I’m hoping there won’t be too many surprises with the remainder of it. No major plans this weekend, so I’m going to try to stay focused on it. The script engine is so absurdly close to completion that it’s driving me crazy.

Reading through the DirectX 11 documentation has given me a lot of motivation to get this going again. It’s so much nicer than DirectX 9 was. I can see a lot of opportunities for really interesting graphical effects even in a 2D world.

More false hope?

Time will tell!

Oh oh directx. I hope this runs well under wine or else ur leaving me behind.

Sent from my SM-N920R7 using Tapatalk

Cross-platform support might as well be last on the priority list. Make that every list.

I made a good chunk of progress this morning. Built-in variables/functions are working. In the process, I ran into a new issue that I’m not sure how I want to proceed with.

A sleep function. Graal has this, and it’s always been considered “bad to use”. I’m starting to see why when looking into implement it myself. It’s going to have a slight impact on overall performance and memory consumption by scripts. Further, the ideal way to implement it leaves it in a situation where the duration of the sleep may not be exactly honored due to another script executing in the meantime. An alternative to that is to simply halt all script processing during the sleep, which feels like a terrible idea. At this point, I’m considering not adding it at all.

What is everyone’s thoughts on it? Do you use it that often in Graal?

Is there no threading? I can see it not honoring sleep time with only 1 cpu core.

But when i use sleeps im not relying on its precision.

There won’t be any support for extra threads initially. Even in the future, I can only see limited threading options being possible. Doing it in a way that affects the entire script engine means that all shared variables have to be thread-safe, which is a performance nightmare.

I remember striking this problem when developing a client. My solution was to split the script where the sleep is then place a schedule event in the top half and after x seconds invokes the bottom half.

Because that might sound pretty gross and could lead to a billion and one implicit functions being generated I honestly wouldn’t care if sleep was excluded so long as you provided a decent substitute. I.e.

function main() {
  messsage("0 seconds");
  scheduleEvent("timeout",1,args....);//invoke "OnEvent_timeout" in 1 second
}

function OnEvent_timeout(args...) {
  message("1 second");
}

There will definitely be timers of some sort, so that’s not something to worry about. Sleep is easy for new programmers to understand, which is a good thing with a project like this. As was evident on Graal all the time, you generally had people very new to programming in general trying to make scripts. I should probably just stop thinking about it and do it. It could always be removed later if it’s really that much of a hindrance.

My thoughts are that I never use sleep unless my script is too intensive and it’s the only way it will keep it from crashing (which is often). I use variable timeout times or some var that increases at every cycle and use a modulo on it, so when it equals zero something extra happens during that cycle; stuff like that.

For the Oil Factory game I developed, I use something I call jiffy (because I heard Monkey Island 2 developers refer to something alike as “min jiffy” or something like it).

 * Created by Dom on 2016-04-14.
 */
public class Jiffy {

    private static float updateIterations;
    private static float myFps;
    private int entityIterations;

    Jiffy(){
        resetEntity();
    }

    public static void update(){
        //myFps = BaseActivity.fpsCounter.getFPS();
        //The whole renovation was done with that value so let's keep it
        myFps = 30;

        updateIterations++;
    }

    public static boolean jiffMe(float rate){
        return (updateIterations % (int)(myFps/rate) == 0);
    }

    public void resetEntity(){
        entityIterations = 0;
    }

    public boolean manageEntity(float rate){
        entityIterations++;
        if (entityIterations % (int)(myFps/rate) == 0) {
            resetEntity();
            return true;
        } else return false;
    }

    public static void reset(){
        updateIterations = 0;
    }

}

Old stuff… jiffMe is for the mainActivity and manageEntity is pretty much the same but for objects. Not sure why. seemed logical back then; I was proud of my jiffy class.

EDIT:
It seems to be because some stuff happened on different timings.

EDIT:
No, ok… I see now. jiffMe was used for events synched globally with the game. manageEntity was for events that had a specific duration. jiffMe = “countup”; manageEntity = “countdown”. Something like that. I appear to name my stuff very badly.

and you’re right… it’s easier for new scripters… until they learn to use timeout or loops… it was until then that I used sleep.

Yall need more semaphores in yalls life

Sent from my SM-N920R7 using Tapatalk

Isn’t that what jiffy essentially is?

Thanks for the feedback. I decided to skip it entirely. It’s not worth the extra delays when there are alternatives. I want to get past this damn script engine and get onto the good stuff.