R0J0hound's Recent Forum Activity

  • That’s an issue if you want to use [] and bbcode.

    You could utilize the bbcode for icons. Basically draw or copy the bracket graphics to a sprite and, and replace [] with [icon=0] and [icon=1]. That’s the simplest way I’d try.

    Second would be to maybe figuring out how to do it with html. Off hand it would just be a bunch of referencing developer docs.

    Placing the same text, just colored, over other text could work but in practice it’s a bit tricky depending on how you render text. For the text object and one line of text you can use the Text.TextWidth() expression to get the offset to place text after. Basically you’d split the line into three parts. The text before highlighting, the highlighted text, and the text after. The main complexity is textwidth won’t be updated till the text is drawn so you’ll have to wait a tick before positioning stuff. Also if there is any word wrapping things will be off.

    Spritefont is a bit better since you can get the width of individual characters without waiting a tick, but word warping is still an issue.

    Beyond that you could do text a character at a time and handle the word warping directly so you have full control of the positions and look of each character. The downside is it’s a slower with the loops and

    Instances per character.

  • With the text input object hitting tab jumps between edit controls. You’ll need a bit of JavaScript to change that.

    Give the textInput object an id of “edit” in the properties bar. Then run a script like this once to change it so that so tab does nothing.

    document.getElementById("edit").addEventListener("keydown", (e)=>{if(e.key=="Tab"){e.preventDefault()}});

    From that you can make it do something else such as place four spaces or something. The easiest way would be to call a c3 function from that js to do the text modification there. Construct’s docs have how to do that.

  • To fix use the physics behavior’s set stepping mode action to set it to frame rate independent. Then physics will run the same speed at 60fps or 144fps.

    The only benefit of the fixed stepping mode is the simulation is more consistent but the value is lost on any fps besides 60.

  • Oh, I think I see what’s up. Do you have three instances of TextM… ? I can’t see what the rest of the name is.

    Anyways when you set the text of the text object the action is run for all the picked instances. So if you have three instances the function would end up being called three times.

    As a minimal example of this, add a text object and add three instances of it, then add a second text object (text2) to display the result.

    Then with these events you’ll get text2=“testtesttest” much like in your project.

    Start of layout
    — Text: set text to function.parse()
    
    On function parse
    — text2: append “test” to text

    Hope that helps.

  • You showed what it does but not what the function looks like. That would make it so others can possibly spot what’s amiss.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It’s probably as simple as they didn’t think to add that when they made it. There’s a lot of things like that in construct.

  • I mean if you have a tilemap with 100x100 tiles and have an array of size 100,100,1 you can consider them related even though they aren’t. That would give you an array location for every tile.

    The array would have whatever value you put in it. As an example look at only one tile, what value would you want in that location, and how do you want that set? Once you have that you can do it for all the tiles by looping over all the tiles and doing the same logic for each.

    You could make a different array for each variable you want per tile, or make the size 100x100x4. I’d go with whatever was easier to understand and read.

  • 100 mb doesn’t sound too bad actually. If the default type is a 64bit number it would be 1000x1000x10x8 = ~80mb

    Js also stores the type per value, and typically resizable arrays are made to allocate a bit more memory to make resizing faster.

    Presumably you could use the binary object which uses typed arrays under the hood to be more memory efficient since they don’t resize and share the same type for all the values.

    Anyways, in regard to the op I’d still just use an array the same size as the tilemap. It’s the simplest solution.

  • I mean you can try it. Sounds like they’d fight each other.

  • 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.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound