R0J0hound's Forum Posts

  • Easiest would be to only use obj files with uvs. If I was still working on the plugin I would just add 0,0 for missing uvs and improve the obj loader to give more understandable errors.

    Currently the plugin is on the back burner indefinitely. It is in need of a rewrite and the event system makes things more complicated than they need to be. And finally time and interest isn’t really there at the moment.

  • I see, like I said I’ve no idea about that game. Guess you could make the player move through the doorway when they hit it, delete those doors and seal up that way. But that’s something to fiddle with another day.

    In general it’s possible to do anything. You just have to break the problem up into multiple simpler doable steps.

  • You should be able to treat the 2d array as a 1d one. If 0 means empty do:

    on function “shiftArray”
    Repeat 16*16-1 times
    Array: at (loopindex%16, int(loopindex/16)) =0
    — array: set at (loopindex%16, int(loopindex/16)) to Array.at((loopindex+1)%16, int((loopindex+1)/16))
    — array: set at ((loopindex+1)%16, int((loopindex+1)/16)) to 0

    So the process would be to 1st set the array location to 0 that you’d want to delete and then run that to shift. It only shifts by one space so if you delete multiple then you have to run that the same number of times.

    I’m assuming the array starts fully shifted but if it isn’t there is a way to modify it to do that. Or a brute force way to do it is to just run the function 256 times.

  • The top one has to do with the order things are drawn. In 2d it just uses zorder to draw back to front. In 3d there are some 3d layer settings that might help I suppose, like there is a setting to draw by zorder or by distance to screen. I could be remembering it wrong.

    The goal is to draw the 3d objects first, then draw the stuff with transparency far from the camera to close. That would work well if the billboard sprites face the camera, but when the quads are at many different angles there isn't any way to perfectly sort them in some cases with just changing draw order. Anyways just some ideas to fiddle with, or maybe what construct does automatically makes that less feasible. idk

  • Never played that game and probably never will. Guess its just a bunch of rooms connected by doors? And you don't see the new rooms till you enter the door?

    Easiest would be to just make all the rooms manually, and just reveal new rooms as you open doors.

    Tilemaps and sprites are just tools, I'd be more concerned at making something that works before making something that's super efficient.

    Random generation can get rather involved. One general idea with your rooms is to have each room fit within a grid with the doors on the edges. With the prefab rooms you should be able to hide that it is a grid. Then there's the matter of making all the rooms connect. One idea could be to utilize something like WFC (waveform function collapse) to let you generate the rooms on the fly. Basically start with a random room, then for each door place a room that has matching doors with the surrounding rooms, and if there are any sides with no rooms it can randomly have a door or not.

    Here's a test of the room linking idea where it generates more as it goes with a wfc like algo. I got bored before doing rooms over it.

    dropbox.com/scl/fi/z5uzt5vf20t0hiccp6keu/maze_expand.capx

    Another idea involves just defining each room, and saving it to some kind of text format to be able to load again on the fly. This literally just picks the next room at random at the doorway and removes the previous when leaving. Side effect is if you try backtracking the rooms will be different behind you, although I suppose this could be made persistent. Only supports a door per side of the room but with some tweaks you could support multiple doors per side.

    dropbox.com/scl/fi/6olz5ar4dk5ma7l2jtz81/crazyPathFromRooms.capx

    Anyways, all this is just to give ideas and was me trying some things out. You can probably find other similar examples. Maybe search for binding of issac examples. Those generate maps from room templates.

  • Do you mean something like this?

    1 2 3
    4 5 6
    7 8 9

    Say you remove the 2.

    1 0 3
    4 5 6
    7 8 9

    Then it shifts like this?

    1 3 4
    5 6 7
    8 9 0
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • An event that isn’t a sub event of anything.

  • Maybe another way to look at it is the new objects are added to the instance list as the last step of a top level event. Functions are run in place so their new objects aren't added till the end of the caller top level event.

    It's the single most annoying quirk of the picking system, it's hard to explain, and hard to understand, but hard to not run into. With most of the events I write I do my best to work around having to deal with it.

    Anyways, I was merely pointing out it's possible to pick new objects sooner than the end of the tick if needed. It's just another tool, but if you have a different approach that's good too.

  • You can pick newly created instances sooner than just the end of a tick. The next top level event is enough.

  • I can never seem to open google drive links. It always asks me to login. So I have no input on your events.

    As far as the physics stepping mode:

    Variable will be frame rate independent but according to the box2d docs a fixed timestep is better since it makes things more consistent with the simulation. Realistically a variable timestep would only affect constraints such as joints and contacts. Can’t imagine it would be bad for simply moving objects and applying forces.

    Fixed will make the simulation more consistent but defaults to a timestep of 1/60. That means if you have a faster screen refresh rate the sim will run faster.

    A solution would be to set the timestep to match the screen refresh rate. But I forget if the physics behavior even lets you change the timestep. If it doesn’t then never mind what else I have to say. That’s kind of a blocker.

    Browsers don’t provide a way to get the screen’s refresh rate but you can guess it from the frame dt. A better guess would be to average multiple frame dts, maybe over one second. Ideally you’d want the game to be running with a low cpu/gpu load when sampling the frames so there is minimal frame skipping which would throw the average off. But it should be possible to statistically figure out that bigger dts refer to skipped frames but I digress.

  • Not really.

    If the level data is in a grid then presumably you could load it into construct as a tilemap, otherwise as sprites. Tilemap is problematic if you can’t load a different image at runtime in construct. So probably you’d have to create tilemaps and sprites with the relevant textures first then parse the level data from JSON.

    Layers? You’d need to someone match up construct features with LDTK features. Construct is limited with what you can create or modify at runtime. Guess you could create a construct layer for every layer but that would be up to you.

    Atlases? Construct does its own atlases and you can’t really replace them at runtime. That’s why I said first create objects with the relevant textures then parse the json. Alternately you could load the texture atlas into a sprite and use distort maps to select sub textures. TiledBackground is another option but replacing texture at runtime is per instance with that.

    You could use events or JavaScript. Js is only an advantage if you make your own plugin here to be better tailored for LDTK features.

    If someone hasn’t posted a converter before it probably hasn’t been done.

    Even Tiled doesn’t have a full loader. Construct only lets you load a small subset of tiled features that match with tilemap features.

    In general getting the info out of the LDTK json should be straightforward enough once you start doing it. It’s the visual aspect that would require some creativity to do in construct imo.

  • Loops are actually easy. Algorithms can be harder, especially when making them from scratch.

    So what are you trying to do exactly? Do you want to know all the tiles connected to a certain tile? You can do that with a flood fill algorithm. That could help narrow your search for how people solved that kind of thing before.

    I get lost though when you mention other things you’re trying to do and I’m not seeing a lot of connection. It probably is because I’ve never played the game you’re replicating.

  • If it freezes it’s a logic error somewhere in your loop events where they never end so it becomes an infinite loop.

    To debug where the error is I usually write it a bit at a time and make sure it works for the simpler stuff before adding more to it. That way it’s easier to track when you introduce the error.

    Another idea is to try to use the debugger to step through the events. Although I haven’t really used it and I’m not sure how detailed it’s able to step through your events.

    You could also use “repeat” or “for” instead of “while” for your loops. With those a logic error would just not work instead of freezing. Also tweaking your logic to use those loop conditions instead may help fix the logic anyways.

    Once you get it not to freeze you could log values to the console or editbox as your events run. And that could be a tool to see what is happening and maybe help you spot where to look for the error.

    Just reading the events and running them in your mind sometimes works too. But breaking things down to simpler steps helps more.

    Anyways, those are some strategies I use.

    I used to be better at debugging others code but lack the time and patience lately.

    What you’re running into with using all those while loops is there are many more places for the code to fail so it’s too tall an order to debug from a screenshot. A minimal example to download is better for other users to fiddle with if they get the urge to give debugging a go.

    There could be some action or condition that’s not working as you expected. For that I often find it useful to do small tests with them to better understand what they are doing.

  • He means the programming language scratch where all coding is done with blocks that that can be dragged and snapped together kind of like legos.

    en.m.wikipedia.org/wiki/Scratch_(programming_language)

    Or maybe blocky which is basically the same. But it’s not clear how that library could be cobbled into construct.

    en.m.wikipedia.org/wiki/Blockly

    Anyways like anything the trick to doing it is to break it down into simpler doable steps.

    Start by having blocks you can drag and drop. Next have locations that the blocks will snap to when close enough. Next is to keep track of how everything is connected, and where to insert stuff and moving stuff to make everything fit. You could either just highlight the drop points or preview the resulting layout as you drag, but that’s objectively more involved.

    Probably best to try something simpler first. Like just a vertical list of sprites you can drag to reorder.

    Another exercise could be to just work on the visuals on how everything should be positioned. Like positioning everything via events.

    Anyways good luck.

  • Do you want the small tilemaps merged into a third tilemap just big enough to combine the two? Or do you want to just draw them onto the main tilemap that covers the layout?

    What is the array you mention for? Tilemaps can already be thought of an array of tiles so using an array too seems redundant and overcomplicate things.