loneDreamer's Forum Posts

  • 11 posts
  • loneDreamer

    Hey how are you?

    Do you have maybe an idea on how we can make the borderless windowed mode to be persistent?

    What I mean is that with this code on any mouse click or on clicking the windows button on keyboard, the fullscreen mode breaks and then it is never fullscreen again and reacts like it is on kiosk mode.

    Is there any change we can set this to be always on windowed fullscreen even if a user hits the windows button?

    No sorry, can't help, I cannot replicate the issue by mouse clicking or using common keyboard keys.

    You should also know that it is not true full-screen, everything is still rendered behind the window, there's nothing we can do that I know of that can change it.

    As for the windows key, as far as I know you cannot stop windows from breaking full screen.

  • Credit is due elsewhere, the code is not mine. I'm glad everything work out.

  • I am very much stuck I think.. I downloaded Node.js and then exported my construct project with NW.js.

    But after that I feel helpless because I am a noob with these software Node.js.

    I open the Node.js and all I have is a black command screen.

    I don't know how to use it with my NW.js export and where to find index.html in order to use your code.

    It is such a shame that NW.js does not allow us to change the resolution in-game and I think that this is a feature that any game engine should have. I am making a game with resolution 1920x1080 and trying to give opportunity for example 1366x768 resolutions to play my game. This is essential and if someone wants to publish a game on Steam (like me for example) it becomes a frustration.

    So I started searching for solutions, I think maybe this is possible by using "windowed fullscreen" because regarding my tests I get these resolution change results if I resize my game in a window. So maybe this is a workaround if we can have this result in a borderless windowed fullscreen.

    Ashley should as well come-in this topic and explain us how we can publish on Steam without having this essential option to change the resolution for desktop users like any game engine does.

    Thank you for replying loneDreamer and I would like to ask you if you can explain me how to add your code like you would explain it to a 10 years old. I am not familiar with software like Node.js and need help with this.

    Take note, I'm on Windows so if you are on another operating system such as Mac the instructions may differ slightly.

    1: Open your project (your created game) within Construct, test it to see if your game is working by previewing it, if you have a black-screen you should search through the other posts related to your issue as there is probably someone that has the same issue and has had it solved, if not, lodge a post asking for help in the forums if you cannot solve it yourself, ..also I sometimes get a black screen during previews but after restarting it resolves itself

    2: Ensure you have the "NWjs" object added to your project in the project pane on the right under the Objects folder, if not, go to one of your layouts right click > add object > NWjs, save your project, test and save

    3: Click on Menu at the top of the screen within Construct, then Project > Export, "Desktop (NW.js)" should appear, click it then next, choose your options, on the next page take note of whether-or-not you tick "Package Assets" and then continue through the export process, save the file to your desktop

    4: Extract your game from the exported zip (if zipped) to your desktop and open the folder. If you chose to package the assets, you will see "package.nw" in your exported game folder, explore (open) it with an archive program (7z) and then edit index.html by right clicking > edit with notepad--Otherwise if you chose not to package the assets, simply edit index.html and forget package.nw

    5: Within the Body /Body tags of the html code, create the tags Script and /Script, within the script tags, add the code in my previous post, then save the index.html document, your archiver will detect that package.nw has made changes and will ask you to update the changes once you close index.html

    6: Running your game should open it in full-screen mode and through the assigned key in the code I posted earlier you can press "F10" to toggle between full and windowed-mode.

    I don't know if you can change the window width/height (other than canvas) through Constructs events, however, I think it might be possible through Node.js Chromium as the arguments are on NW.js Documentation page under Docs » References » Window. Javascript might also work which can be added through the scripting area of the index.html or possibly in the scripting area in the events area within Construct but you'll need to test it yourself

    Good Luck

  • Are you trying to set your game into windowed fullscreen? If yes, this is something that I want to achieve as well. The code you shared here, where exactly do you add it? You add it after the export or before?? and where?

    After exporting via Node.js, add the code to the scripting area of index.html, reply if you get stuck, I'll upload the file somewhere for you to download

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • // Set window to fullscreen on startup
    var ngui = require('nw.gui');
    var nwin = ngui.Window.get();
    
    nwin.enterFullscreen();
    //END
    
    
    //Toggle Fullscreen--Borderless Window-Mode
    nw.App.registerGlobalHotKey(new nw.Shortcut({
    key: "F10",
    
    active: function () {
    nw.Window.get().toggleFullscreen();
    }}));
    //END
    
  • So I found the solution that allows me to use full-screen in NW.js exports and allows me to toggle between full-screen and windowed-mode. The complete code for anyone else looking is at the bottom of this post:

    You should know that changing the key to F11 like in browsers does not work, I've concluded that is possibly due to Chromium reserving it for their function and thus if the user hasn't initiated input, won't allow it to work? ..but who knows, could be wrong.

    Other keys are also reserved such as F12 for NW.js debugger, it--the debugger--must be disabled with the --disable-devtools argument inside the Package.json file inside the chromium-args area "chromium-args": "--disable-devtools", before it can be assigned otherwise the debugger initiates first and doesn't allow the window-mode toggle.

    From here, I'll be looking to add the Alt + Enter combination into the script.

  • The only method to get get fullscreen on launch via nw.js that is working for me was to add the following code to the scripting area of the index.html file after export ..excluding adding the Kiosk argument to the window area of Package.json or --start-fullscreen via chromium-args in the same file:

    Now it seems like that code is making the window like Kiosk mode where I can't use the Browser object to change to a windowed-mode again:

    I'm now looking to find a way to implement hotkeys within the same scripting area of index.html as a work-around but haven't found much yet, has anyone come across ..or.. know of a way to have both full-screen on launch and hotkeys to change from full-screen to windowed-mode working?

  • So for question one, your method is basically saying, for every 20 instances, put them in a group that acts as one (collision-wise). Since this is true, imagine if each group of 20 was spread out in a small area which would show as if they were not overlapping. Then, would another group of 20 individual instances (called group 2), individually collide with the first groups instances individually. Or in other words, would any one instance within group 1 collide with any one instance within group 2, that is if I then told them to move away from each other on overlap (similar effect to a solid behavior). If it does, your solution will work for my game.

    Well, each instance is controllable individually, if the instances within a group are overlapping, the player cannot specifically and individually select an instance within a group to give it a command.

    I accidentally overlooked a part of the code you implemented "currentGroup>=int(BoxFamily.Count/groupSize) ? 0 : currentGroup+1", sorry!

  • 1.) Those changes are very helpful and have increased performance dramatically, thank you. However, on overlapping rather than behaving as solid, when I change the units to divide their distance equally within their group, is that going to stop other units in other groups from crossing individual units within the first group?

    2.) The collsion checks don't need to be checked for every instance on the map, providing collision isn't an impassable (cliff/building) and would prevent pathfinding to detect it which would cause units to either go over/through it (with overlapping) or go to it and then need to recalculate pathfinding to go around it, which would look horrible and be inefficient.

    3.) Although your solution works well, is my original method feasable? And if it is, I'm sure it could combind it with your solution.

    How did you learn about the skipping unnecessary checks?

  • I was unsure on how to attach a file via a post and so I have uploaded it to dropbox: "https://www.dropbox.com/s/32sne694ovk6cvg/Collision%20Detect.capx?dl=0"

    To use, Middle click to spawn units. Right-Click to tell units to pathfind to the current mouse location. Up, Down, Left, Right for camera, Middle-Scroll Up/Down to increase/decrease timer for collision checking.

    When spawning more than 400, I start to see an FPS drop when pathfinding.

  • I think I have come up with a way to increase performance with collision checks, but need some help to implement it OR if it works only by checking all instances simultaneouly, I would like to know that as well anyway.

    So, what I want to acheive is, check collisions per instance (unit/object) against all other map objects/instances but, add a specified time (variable) between checking collisons for each instance.

    For example: tick 1; instance 1 checks for collisions. tick 2; instance 2 checks for collsions. tick 3; instance 3 checks for collisions.. reapeat X amount of times, X = amount of instances on map. Currently I beleive the collision checks happen for all instances per tick or per X seconds (if set).

    Once the above is implemented, I'll then add this: If the amount of instances is greater than (variable) OR alternatively the total time required to check for collsions (variable) has passed variable amount, then add next instance to tick 1/first collision check.

    For example: instance no. 25 is set to check on tick 25, however, instance 26 is then set to check on tick 1, repeat until no more new instances are available to check.

    Currently the amount of instances on the map (> 400) reduces fps considerably, I hope to get it up to 2000.

  • 11 posts