skymen's Recent Forum Activity

  • I really recommend you use C3_IDE to make C3 plugins:

    github.com/armandoalonso/c3IDE

    It does SO much for you. It can open c2addons and c3addons and auto generate the project from them (most of the time)

    It generates all the JSON for you, it auto generates common code, it allows you to setup ACEs in only a few seconds, and most of all, it comes with an integrated web server that will allow you to easily host developer mode addons for very fast testing.

    It works for plugins, behaviors AND effects btw.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here it is a behavior "Destroy inside layout by Sailer" (C2Runtime & C3Runtime versions, I ported the behavior to the C3Runtime) and demo to it: drive.google.com/file/d/1jf86vgcke5S071MFccMiSrAtlr0dz2Px/view

    Thanks!

    Can you add it to the list here?

    docs.google.com/spreadsheets/d/1oxbmtXqXcW64IAU_4noZchLMxVrPeA4jD_rqTw35H2w/edit

    I'll make sure to confirm your contribution asap.

    (This basically works like the website's database)

  • I ported the addon to C3 and I updated the C2 addon (I fixed a bug that I noticed when porting the addon lol)

    Here is the new C3 addon:

    construct.net/en/make-games/addons/436/greenworksredraw

    And please download the new version of the C2 addon if you happen to have the older one.

    construct.net/en/construct-2/addons/435/greenworksredraw

    There you go Fib :)

    I ported this and didn't test it (since the code is pretty simple).

    If for some reason anyone does encounter any issue, I'll get my dumb ass to fix it and actually test this time.

    EDIT: Ended up testing it, it was unsurprisingly broken, and had 2 bugs in it lmao. Good times. Haven't tested the Steam export yet, cause I don't have a Steam project setup for C3 at the moment.

    (Update is up on the addon exchange)

  • Hey,

    After speaking a bit with Dannyyy, I cleaned up the updated ForceRedraw addon I made.

    construct.net/construct-2/addons/435/greenworksredraw

    From my tests, this worked flawlessly. I can't really speak for performance but realistically there should be no issue.

    Just in case, I added actions to manually start and stop a constant redraw, and a param that gives you control over how many frames to skip before the next redraw occurs.

    If anyone gets issues using this, tag me here, or DM me on Discord via the CC discord server. I'll try to take a look and see what's wrong.

    EDIT: If anyone needs this to be ported to C3, also do tag me, or I'll just eventually port it one day when I have some time.

  • Well, I did a ton of testing, and it turns out that changing the CSS doesn't always update instantly the browser. Some optimisation seems to make it very inconsistant.

    I did end up finding a way around that though: Instead of using a timeout, using requestAnimationFrame seems to force the update to instantly update on the next frame.

    Here is a new addon that uses that technique.

    mega.nz/file/Z4cBwABC

    I also went back to updating the body instead of html, and I forced both to cover the whole window.

    One issue I had with only updating for a short while was that the timer (that was partially outside) would start tearing as soon as the plugin stopped the forced rendering to occur. And when closing the overlay, sometimes, there would be residual overlays until i moved, resized, or unfocused the game window.

    What ended up working great however was refreshing every 3 ticks: imgur.com/a/ki77Wi0

    Also, I'd like to mention this issue on github about the windows 10 title bar:

    github.com/nwjs/nw.js/issues/7362

    So people here know: this flag only worked for me when I put it at the very start of the chromium args list.

    Between this and the new forceredraw addon and some other flags shenanigans, we now have a fully working overlay inside NW.js v 0.46.0!

    Here are my chromium args:

    "chromium-args": "--disable-windows10-custom-titlebar --disable-plugins --disable-internal-flash --disable-popup-blocking --enable-gamepad --enable-html5-camera --allow-file-access-from-files --ignore-gpu-blacklist --limit-fps=60 --disable-devtools --in-process-gpu --disable-direct-composition"

  • Hi, I noticed that sometimes the ForceRedraw plugin failed to redraw the whole window.

    That's because the addon changes the CSS values of the <body> tag, but sometimes, <body> doesn't span on the entire window, and so, on Letterbox Integer scale, the bottom part of the window would not get redrawn, and it would cause some tearing effect where the overlay properly redraws up until the bottom of the canvas, and not the black bar under it.

    I fixed it by making it change the css value of <html> instead, and by forcing <html> to cover the entire window at all times.

    Here is the fixed plugin: mega.nz/file/gllGna5D

    Also, even with --disable-windows10-custom-titlebar, the overlay sometimes renders above the title bar (but less often) and when it doesn't, the top part is just cut from the overlay entirely, so the timer and the tip on how to exit the overlay are partially missing.

    Edit: This was all tested with v0.46.0 with the following chromium args:

    "chromium-args": "--disable-plugins --disable-internal-flash --disable-popup-blocking --enable-gamepad --enable-html5-camera --allow-file-access-from-files --ignore-gpu-blacklist --disable-gpu-vsync --limit-fps=60 --disable-devtools --in-process-gpu --disable-direct-composition --disable-windows10-custom-titlebar"
    

    Edit2: I still get tearing with my solution (but a bit less). Not entirely sure why though :/

    I found that by forcing the window to resize by a pixel every frame, or the background color to update every frame, I could get the overlay to work properly, but then, the overlay would slightly flicker in the parts outside the game.

  • Yeah, 20%CPU could probably have been improved in my latest implementation. Also note that CPU % varies a lot between computers, so maybe you have worse perf because you're previewing on browser vs NW.js or because you have a lower end laptop, I don't know.

    As an effect, trail isn't possible as far as I know. C3's effect system doesn't allow us to define effects that get applied over multiple frames, and to work you'd need to specify a lot of parameters and it'd be too much work for an end result that wouldn't be insane.

    As a behavior however, there is a point to be made, but the main limitation would be drawing on screen, and behaviors can't do that on their own.

    The best solution IMO would be an object type with a ton of parameters that draws a trail over its last positions, and you'd just move it to wherever you want, and it'd draw a trail on its own. It'd be even more useful with the new Scene graph that's coming to C3, because then adding a trail would just be inserting the object as a child of another one.

    However, IMO to get a great trail object, C3 would need two new object parameters: Graph param and color gradients.

  • Hey!

    I indeed used the drawing canvas to make the effect. There is a lot of trickery going on to achieve the effect. I wrote that trail for Rhythmy initially: rhythmygame.com

    I can probably try to find the C3P or the code within Rhythmy and share it/make a tutorial about it :)

    EDIT: found an old version of the trail I made (the one in the video actually) :

    drive.google.com/file/d/1gJkYq2HEh9qrTjmAkCQELI5engDpG6aO/view

    But I'm pretty sure I made a better one that was a bit more efficient, better looking and that didn't break as much for Rhythmy. If I find it, I'll make a tutorial.

  • Yeah I didn't mean open source as in you can use it, but open source as in it's there and you can read it. Tbh the fact that I was able to read the code helped me understand the engine a lot more and make weird tests with what I understood from it.

    But yeah, this meant that the door was open for addons entirely based on hacks, or on copies of vanilla addons that cause users to ask for support when they should seek the 3rd party dev.

    It really is a shame but it did bring a ton of really cool addons as long as you knew their use cases and their limits.

  • I've checked game dev comparison websites and such, and I can't find a comparable product to C3, one that ticks the three boxes that caused my concern when combined:

    • Is subscription based only
    • Is Web based only
    • Creates a file format that is designed to run in one application (yes its a zip file technically, no you cannot easily view or edit it by extracting it if C3 was closed, minus assets)

    Dropping in to give my two cents:

    Subscription means it can keep getting maintained for years to come as long as the company doesn't explode.

    Web based means that the tool is easier to develop. HTML and JS are by far the most productive languages. A lot of other languages are moving towards what web has had for years in terms of productivity.

    Web also means cross platform so it will work anywhere as long as you have V8 (or any future version for that matter) which is maintained by a company that is litterally stronger than half the countries on this earth.

    Web also means it will NEVER stop working because of an OS/Web engine update. The whole reason you can still look at 1980s websites on the wayback machine is because JS tries to never ever break anything.

    Zip is standard on every OS known to man. Any data that isn't asset is JSON which is also now standard on pretty much any modern language known to man. JSON is arguably the most efficient way to store data by being both efficient, and human readable. Also parsing JSON is B R A I N D E A D easy, ESPECIALLY in JS. In MOST languages it's a single line of code to go from JSON to usable variables in code.

    All of your points actually prove that C3 is way less likely to randomly stop working than C2.

    C2 can break from any windows OS. Heck it's already falling apart for no reason on windows 10. C2 is only compatible on Windows. C2 is pretty much impossible to maintain as a community member because it has proprietary code, and needs really technical skills to be able to decompile. And even if you do, you'll have to deal with whatever the code you get actually looks like. Ashley, with full access to the source code and who wrote it all finds it difficult to work with, I doubt anyone will be able to make any meaningful step towards maintaining C2 if it fails to work.

    And while capx are also zip files, most data is stored in XML, which is still very used but not as easy to use and widespread as JSON.

    C2 ticks all the boxes of "I will become abandonware in 4 years time", C3 doesn't. The only amazing thing C2 has that C3 hasn't is a completely open source, unminified runtime, and the best stab at maintaining C2 would be to completely rewrite an editor for it and use its runtime. Doesn't that ring a bell? Yeah it's C3.

  • Using worker will prevent name overlap with code on the window object, and will prevent people from accessing your code from the console, but you'll still have to be weary of name overlaps between your own functions (which is a lot more manageable indeed)

  • This is a copy from the answer I provided on the Discord server, in case it might help anybody else.

    If I understand your struggle correctly you just want to have access to runtime globally

    Just add it to the global scope

    Something like this in your code will do.

    runOnStartup(async runtime => { globalThis.g_runtime = runtime })
    

    Then from any function, using g_runtime or globalThis.g_runtime will return the runtime object

    If you do not want runtime to be globally accessible however, there are other ways which I explained here:

    construct.net/en/tutorials/js-writing-javascript-modules-2384

    In summary, you can do this:

    runOnStartup(async runtime =>
    {
     let localVar; //Defines a local variable that will still be accessible to your global functions
     runtime.globalVar; //Defines a global variable in the runtime object
     runtime.globalFunction = () => {} //Defines a global function in the runtime object
     globalThis.globalVar; //Defines a global variable in the real global scope
     globalThis.globalFunction = () => {} //Defines a global function in the real global scope
     function localFunction () {} //Defines a local function that will still be accessible by your global functions
    });
    

    I do recommend reading through the tutorial as I go through a few other methods on how to properly design JS modules that are both powerful, easy to write, have access to whatever you might need and are easy to contain to avoid overlap with other modules and prevent external people from accessing unneeded data

skymen's avatar

skymen

Member since 3 Aug, 2015

Twitter
skymen has 100 followers

Connect with skymen

Trophy Case

  • 9-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • x34
    Coach One of your tutorials has over 1,000 readers
  • x2
    Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • x7
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x2
    Lightning Draw First person to up-vote a new Construct 3 release
  • x2
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

22/44
How to earn trophies

Blogs

  • Skymen

    Sometimes I do some cool stuff in Construct. Sometimes I like to talk about it.