R0J0hound's Forum Posts

  • They can’t be both simultaneously with the physics behavior. Since events run top down it will have framerate independent set.

    Unfortunately you can’t do what you’re after with the physics behavior. With a fixed step the simulation will be consistent yet the speed will vary with the frame rate, and the other setting makes the speed appear the same yet the simulation won’t be consistent.

    The underlying issue is in construct the events and behaviors run at the same rate as the screen refresh rate. We cannot limit the fps in construct either.

    A possible solution is to run the physics simulation at one rate, and interpolate the positions so it can be displayed at the screen refresh rate. It’s easier said than done though. You couldn’t utilize the physics behavior to do that, instead you’d need to use a physics library via JavaScript or roll your own physics with events. That is mainly so you can control when the physics is updated.

    The interpolation part will require you to have x,y,angle for the current frame and the next one for each object.

    Overall that’s all fairly low level. Construct isn’t currently designed to make something like that easy. General thought is to just use frame rate independent mode and just tolerate inconsistencies in the simulation. If you need more accurate simulation you’d need to do something else more complex unfortunately.

  • Cool. That answered most of my questions. I was going to ask what happens with the rest of the memory if the nes only has 2k of memory but found an nes memory map and that answered that.

    Bitwise operations are pretty low level and really I can count on one hand the number of times I might find them useful in construct. Same with hex values. You really only run into that sort of thing if you’re doing low level bit fiddling. So construct doesn’t have them because they haven’t been needed.

    There probably is a plugin that has them or you can use a bit of js to access it.

    The bitset/get expression treats the number as a 32 bit integer so you’ll be fine with that use.

    You probably should stop saying you don’t know JavaScript. If you run through a quick tutorial you’ll see you already know more of it than you thought. The expressions are very similar and there’s ifs and loops. You don’t have to know a language in its entirety to use it. No need to know about prototypes, classes, or other stuff like that. The scripting api is just a bunch of functions to interact with construct from js. No one knows that. You just get used to looking up the functions you need.

  • Cool tests. I think we are very much cpu bound with that much text.

    I wanted to see if using a tilemap to display text could be viable so here’s the results of my tests.

    4096 characters, all random per frame

    Single spritefont (no bbcode) 
    60fps, 35-45% cpu, 3% gpu
    
    Tilemap
    60fps, 30-40% cpu, 3% gpu

    I probably should smooth out the percentages but in general tilemap used 5% less cpu than spritefont, but spritefont actually seemed to be more stable with the % used.

    I must be using too low of a resolution but even with a small font I was hard pressed to get that many characters to fit on screen. If you made the memory view scrollable you could get a nice speed boost by only setting visible the text of visible memory.

    Do you mind some questions about the emulator?

    2048 is only 8 pages of memory and the cpu can access up to 256 pages. Do most programs work with less pages like that? I’m guessing most systems didn’t have all 64k of memory.

    For your display of 256x240 is that memory mapped at 8bits per pixel or are you going to go for a tile based renderer like the nes or maybe something else?

    Do most programs start execution at a specific point in memory or is that specified per program usually? I see there’s a specific memory location to specify the starting location but I was curious if most programs start the pc on page two or something.

    Do you just implement the documented opcodes, or do you implement the illegal ones too? When making it did you first make all the instructions or did you just make enough to test? What’s the behavior if an illegal opcode is encountered?

    How did you end up implementing the bitwise operators since construct doesn’t have any by default? Manually bit by bit with a loop and the bitset/bitget expressions, or a third party plug-in, or maybe a table lookup?

    Have you tried benchmarking your emulator to see how many instructions per second it can do?

    Do you have it disassemble the instructions as you go? What was the trickiest part of the cpu to emulate? How many events does your emulator have so far? Are you emulating the clock cycle timings of instructions too or just run stuff as fast as possible?

    It sounds like an interesting project to make an emulator like that. To make it fast you’ll likely want to drop down to js or lower since events are rather slow. To learn it’s great and the ideas transfer should you redo it later in something else.

    I wonder how much of an emulator could be possible in the free version without js. Guess more than 25 events would be needed.

  • Apologies, I missed that this was a question for c2 plugins. There is no way to make custom interfaces in the editor with that, and they aren’t working on c2 anymore so there’s no possibility of doing that in the future.

    You could make a separate program that modifies capx files, but you’d have to close the project in c2 first so that workflow isn’t ideal.

    Another idea is to have an editor at runtime. You could do whatever you want there. probably pause the game, and draw your editor on a div on top of the game canvas. The only annoyance there is to get the changes back into your capx you’d need to either have it download a file that you’d need to manually reload into your project or maybe copy a text of the data and manually paste that into c2 somewhere.

    Either isn’t super useful.

    In c3 like I said you could create a div, add it to the body, set its position to absolute and make it cover the screen, and set its z index to be higher than 10000 or so so other editor elements aren’t clickable through it.

  • Best you can do is to open a pop up windows with a link. Basically create a div covering the entire screen and making your own interface there.

    There is no documented sdk feature to make something more integrated into the c3 editor.

    Officially they are opposed to bypassing the sdk to access undocumented internals. So probably you could make a feature request to add to the sdk.

  • You could use a tilemap to do text too. That would let you only update the characters you wanted.

  • You’d have to implement your own on value changed scheme. Maybe store the old values in a separate array.

  • So slower?

    Apart from changing between text,spritefont or html element to draw text ( they all work the same with a set text action), you could use js instead of events to update the text. Or maybe use multiple instances vs one big one.

    That’s mostly what you have control over in construct.

    In general JavaScript will be much faster than events if you don’t mind using it. Personally I don’t mind using js but I find it very unpleasant using js within construct.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The event system has nothing to do with JavaScript. That’s just what it’s implemented in and actually events do not have a direct correspondence with js.

    If it helps being able to use ors between groups of and’d events has been suggested at least a few times before.

    I think one roadblock is that conditions aren’t just logical, they also deal with picking which leads to some quirky situations.

    Anyways you can largely do what you want to do is just with the system compare or evaluate condition and the and/or expressions (“&”,”|”). But that mostly depends on there being a single instances of the objects you’re comparing and if there’s an expression equivalent to the conditions.

  • I second the idea to use spritefont instead of the text object. Or you could even try setting the text of an html element.

    If rendering all the text is still what’s making it slow you could make the memory view scrollable and only draw on screen text.

    If the rendering isn’t the bottleneck then you could try doing the update over multiple ticks to spread the load. There is an overhead with events over doing it in straight js but it varies. Generally it doesn’t matter but even a small overhead adds up when you do a lot at once.

  • How are you placing the cubes?

    If you are placing the cubes from isometric coordinates (ix,iy,iz) the diagonal would just be iy.

    As an example here is the math to project an isometric position (ix,iy,iz) to the screen (x,y):

    X=ix-iy

    Y=(ix+iy)/2-iz

    If instead you only have the xy positions of the cubes you can reverse the formulas above to get the iso position. But the iz value can be anything per cube.

    ix=y+x/2+iz

    iy=Y-x/2+iz

    Possibly you can look at the zorder and relative position of overlapping cubes to calculate the iso position too. But you’ll often have ambiguous solutions. For example if there isn’t a cube at the center intersection then it out guess four iy layers instead of three.

  • Typo on my part. It should be mid(a,loopindex,1). I wrote i instead of 1

  • One way could be to find individual letters in the first string in the second. Anytime a letter is found you’d remove that letter from the second. It would mess up the second string so you’d want to copy it first. Should be pretty doable in a function:

    function findMatches(a, b)
    -- var match=""
    -- var letter=""
    -- var i=0
    -- repeat len(a) times
    -- -- set letter to mid(a,loopindex,i)
    -- -- set i to find(b, letter)
    -- -- compare: i>-1
    -- -- -- add letter to match
    -- -- -- set b to left(b,i)&right(b, len(b)-1-i)
    -- -- -- set return value to match
  • Had another go at it so now the logic is a bit more understandable and fits within 25 events.

    When you click on a tile it does a search for valid moves from that tile to other matching tiles. the path from one tile to another can only bend twice and the path has to go through an empty space first.

    Then when you click on a matching tile it destroys the tiles and draws the path.

    If you want to see the pathfinding in action make the marker sprite initially visible in the editor.

    It's trivial to change the number of unique tiles, but just be sure there are enough tiles on the board so there can be pairs.

    dropbox.com/scl/fi/gpd6ss46cm1a7vfb469ev/onet2.capx

  • Is it the same thing?

    That example was after me plating an Onet game just long enough to infer some rules. Best I could tell matches consisted of adjacent tiles or tiles connected with a path with at most two bends. There are probably simpler and more understandable ways to do it.

    I know the common way to make games now a days is to find a tutorial or find/buy a template. But usually you can get pretty far just by making a list of the rules of a game and figuring out how to do each of those.