SoupOrWorm's Recent Forum Activity

  • > Interesting idea. That sounds more feasible, but I still need to figure out: 1. How to avoid bombarding the player with download requests, 2. Performance, and 3. How to stitch together the recordings. I'll see what I can do.

    I don't think you need to bombard the player - I was thinking that you might be able to use the AJAX plugin to read the recorded video via its URL. From that plugin's page:

    > Binary data

    > The AJAX object can receive resources as binary, and also post binary data, using the Binary Data object. This is also useful to fetch local resources like canvas snapshot URLs or video recording URLs, and load them in to a Binary Data object to do something else with them, like save it to storage or upload it to a server.

    So:

    1. Create an array with 30 entries
    2. Record 1 second
    3. Store its URL in the array
    4. Delete the last entry (i.e. the 31st) every time a new video is logged
    5. Player clicks the download button
    6. Loop through the 30 entries in the array
    7. Use the AJAX plugin to retrieve each clip via its URL
    8. Some magic here to stitch all the clips together (might need raw JavaScript)
    9. Serve the resulting 30 clip to the user as a download

    That might solve the problem of not wanting to prompt the user to download every video, but you might have a similar problem requesting permission to start the recording. This is from the Video Recorder manual:

    > For security reasons, browsers will prompt the user before the recording starts. To avoid the prompt annoying users, this action may only be allowed in a user input trigger, e.g. On button clicked, On touch start etc.

    And I'm not exactly sure what that implies!

    >

    Thanks for the feedback. I used the list to make a system in a test project that downloads all of the last 30 second clips, but it keeps giving "check internet access" errors, and I still need a way to stich them together (both issues may be related, as the constant downloads may be causing the error while only downloading one file may not).

    I've looked around a bit and I think your best bet is to go the javascript route. It might not be as hard as it seems at first.

    Use the mediarecorder api, which I assume is what the plugin also uses under the hood

    https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder

    Specifically note this part

    > MediaRecorder.start()

    > Begins recording media; this method can optionally be passed a timeslice argument with a value in milliseconds. If this is specified, the media will be captured in separate chunks of that duration, rather than the default behavior of recording the media in a single large chunk.

    So you can specifiy to automatically record chunks of 1 second. Every second from then on will fire the dataavailable event.

    Within this event you can store the created data chunks however you please (e.g. an array of 30 for 30 seconds of recording)

    Then when the user requests the highlight you can combine them like so (and I think this should generate a blob url that you can then invoke a download on)

    > function play() {
    var superBuffer = new Blob(recordedChunks);
    }

    It's basically what citron2010 suggested but handling it in js is going to be much easier than doing some roundabout way in events.

    EDIT: It should also avoid the issue with requesting permission. This should only request permission once, when the recording starts. After that it's just a continous recording, that you can tap in at any given moment to extract the last 30 seconds from.

    Yeah I feared that the use of JS may be inevitable. I have very little experience with text-based coding, but I suppose I can try. I think that if I can use both event sheets (for the main code) and JS (for stitching the files together) I may be able to make it work.

    If anyone wants to see what I have or try a solution themselves here is the sample file: drive.google.com/file/d/1q1x6LwLyEeOzNXZGZTuas6cDnQT5RUMS/view

  • I’m wondering whether you could record in 1 second chunks, delete any older than 30 seconds, then stitch together the last 30 when the user makes the request. No idea if it’s possible though!

    Interesting idea. That sounds more feasible, but I still need to figure out: 1. How to avoid bombarding the player with download requests, 2. Performance, and 3. How to stitch together the recordings. I'll see what I can do.

  • This may be a bit hard to explain so bear with me.

    I want to add a system to my game where if you press a button on the keyboard, it downloads a video clip of the last 30 seconds of gameplay, similar to if you hold the snapshot button on the nintendo switch for a second.

    My idea for how this could work is by using the Video Recorder plugin, I continuously record footage of the game and continuously delte everything 30 seconds or earlier from the present time (or maybe delete it just when you save the video), and then have a button download the 30 second clip. The problem is that I don't know how to delete certain parts of the video.

    So far I have this basic recording system:

    Any ideas?

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey there. For about 2 years now I've been working on an aquatic metroidvania called 5 Star Fishy. It is about a tiny pink fishy venturing down to the bottom of the ocean on a quest to find the sunken nuclear silo and get revenge on the world for it's neglect.

    Along the way you must rampage through various machines, hazards, and the ocean's wildlife. In doing so you will unlock abilities, meet various creatures, and face off against bosses.

    If that sounds intresting, or you want to support my first commerical game project, be sure to wishlist it on Steam: https://store.steampowered.com/app/2371040/5_Star_Fishy/

    Thanks for reading!

  • Another update: It works now! I have no idea what I changed to make it work, but it works!

  • Update: After manually editing the contents of the file it seems to load correctly, so I think it is an issue with saving it.

  • Yes, or at least a screenshot showing their parent events and event numbers.

    That may be the issue because that is all of the code that directly uses the options-saving system in the whole project (none of the events I've shown have any other condition or action, and using debug layout I know that the options works for setting the dictionary to what it should be, and that the game uses the dictionary to apply the settings properly, so it is 100% an issue with the .json save load system).

    Am I missing something in the system?

  • Did you check if the file is being created?

    I hope the events on your first screenshot (Main Menu) are sub-events under some trigger. Because otherwise they will be running on every tick, constantly reading and overwriting the file, which may explain why it's empty.

    Can you make a bigger screenshot showing all these events at once? It's impossible to tell what can be wrong by those fragments.

    Do you mean the full event sheets? I'm a bit confused with what you are asking.

  • When stuck, check the manual:

    https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/nw-js

    You can't read files like that. Use NWJS.ReadFile expression:

    Dictionary load from JSON string NWJS.ReadFile(path_to_the_file)

    But first you probably need to check if the file exists using NWJS Path Exists condition.

    And definitely don't do this on every tick!

    Thanks for the response. Using your feedback I've changed the code to this:

    (Main Menu)

    (Options)

    (Game)

    However, it still isnt working as I hoped. Looking at Debug Layout shows that the dictionary adds/changes the keys sucessfully, but the json file itself looks like this and isnt working to save/load the options:

    Also, I am uploading to Steam if that changes anything. The dictionary doesnt even seem to work at all in steam, and the json file still doesnt update.

  • Ready to hear the DUMB thing I did? I had the choose X option set to 1100 right?

    My layout is 1024 wide.

    I thought I had it set to 1280. DOH!

    Couple that with a "destroy outside layout" behavior, and yeah, my right-side baddies were nowhere to be found.

    All fixed now, and working exactly as intended.

    Wops. Alls well that ends well I guess, good luck on the project!

  • I am using trying to use .json files to save and load the settings for my game but it simply doesnt seem to work. I am saving it to the user folder. Here is my code for saving the settings:

    And here is the code for loading it:

    Tagged:

  • > I beleive what you are looking for is the random function. In your case, random(100-1100).

    >

    > Choose only puts it at one of the set values, not a range.

    No, I need it to be at 100 or at 1100 specifically. Nowhere in between.

    My bad, I misread it.

    The image looks fine. Are you sure that there are no other factors that can affect this (e.x. an action that makes the sprite invisable being triggered at the wrong times)? You can try using Debug Layout to check if it is invisable when it spawns in or if it just isnt spawning.

SoupOrWorm's avatar

SoupOrWorm

Member since 7 May, 2021

None one is following SoupOrWorm yet!

Trophy Case

  • 3-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

6/44
How to earn trophies