R0J0hound's Forum Posts

  • ye7yakh

    The colors must be slightly different at those spots.

  • Prominent

    In that case "else" would still work since it's just logic based. Aka the else will be true if the previous event block fails. It just doesn't do any picking. The "split filter" condition is supposed to address the else like picking, but I may yet axe it from the design since it's kind of akward. I'm shooting for simple and intuitive with everything.

  • fisholith

    That should work with webgl off i'm pretty sure. Even with webgl on I think it should work. For reference you could look at the snapshot canvas action, which basically uses the same approach i think. i can''t test webgl currently.

    From a plugin you should be able to access the canvas from the runtime variable i think. There is a way to grab a pixel with just webgl which I tried to use with the paster plugin when webgl was working for me but it proved unreliable.

  • Here I present an idea for a ground up re-design of Construct's event system. This is purely for the logic portion and doesn't cover engine features. It's not entirely fleshed out and there are details I'm probably forgetting. The purpose is purely for fun, and may never see the light of day.

    conditions

    First off conditions are greatly simplified.

    Here are the system conditions:

    * "if" which is basically the same as system->compare

    * "else" this will differ from C2's else in that it doesn't pick, it's only if the previous event block was false.

    * "loop" which will cover all looping: and will look like "loop: var i=0 to 10", "loop: var i=sprite.count",...etc. More on what "var" is later.

    * "split filter" my solution to else. It's like "filter" below but the unpicked instances will be put in another type. Example "split filter: sprite, sol other: sprite.x>0", after which "sprite" will be all the instances below 0 and "other" will be all the instances above zero.

    Object conditions will be:

    * "filter" which is the catch all picking. For example "sprite: filter sprite.x=2" will replace "sprite: pick by x=2". It still follows the rule if nothing is picked then the following conditions in the block don't run.

    "sort" the idea with this one is is an object type is a list of objects and can be sorted. The closest in C2 already is the for each ordered. One example use would be "sprite: sort sprite.y" which would sort the object list from low to high instead of it's current order.

    actions

    Actions as well will be simplified. Basically for values, instead of "sprite: set x to 10" it would be "sprite.x=10". More on other kinds of actions later.

    variables

    Next up are variables definitions. The big thing here is you can put them anywhere you need them. A list of possible places:

    * in between event blocks, like C2 already does

    * inside event blocks

    * in the actions column.

    * special cases: var in "loop", and sol in "split filter".

    Next we have two kinds of variables:

    * "var" this is basically the same as C2's variables. aka. number and text. However this can be extended to array, object, dictionary, etc...

    * "sol" this defines a new type on the fly, which will replace families and make picking two seperate instances simpler. From the point it's defined it acts like any other object type.

    Family example:

    sol family=sprite, sprite2, sprite3
    
    +----------------------------+
    | family: filter family.x<10 | family.x = family.x+1
    +----------------------------+[/code:3j88tc5m]
    
    General picking example:
    [code:3j88tc5m]+----------------------------+
    | sol other= sprite          | sprite.x=200
    | sprite: filter sprite.x=10 | other.x = 11
    | other: filter other.x=11   |
    +----------------------------+[/code:3j88tc5m]
    
    [b]expressions[/b]
    Referencing seperate instances with expressions will be improved.
    You can still do the familiar pattern for an action: "sptite.x = sprite.x+1" which will add 1 to the x of every picked instance.
    You can also use "sprite[0].x" which is about the same as c2's "sprite(0).x" but will reference the first picked instance of sprite instead of just the first instance. You can also do stuff like this:
    x of first picked sprite: "sprite[0].x"  
    x of last picked sprite: "sprite[-1].x"
    It even applies to the action:
    [code:3j88tc5m]+----------------------------+
    | sprite: filter sprite.x<10 | sprite[0].x = 11
    |                            | sprite[-1].x = 22
    +----------------------------+[/code:3j88tc5m]
    Also objects can be assigned to variables.
    [code:3j88tc5m]+----------------------------+
    | start of layout            | sprite.child = sprite2
    +----------------------------+
    +----------------------------+
    | sprite: filter sprite.x<10 | sprite.child.y = 11
    +----------------------------+[/code:3j88tc5m]
    Another reason for this is to make create an expression if you don't want to affect the sol:
    [code:3j88tc5m]+----------------------------+
    | start of layout            | var new = create("sprite")
    |                            | new.x =33
    +----------------------------+[/code:3j88tc5m]
    Of course you can use create as normal as well which only picks that new sprite. At this time of design the same top level picking as with C2 is used.
    [code:3j88tc5m]+----------------------------+
    | start of layout            | create("sprite")
    |                            | sprite.x =33
    +----------------------------+[/code:3j88tc5m]
    
    [b]Functions[/b]
    This is the most significant re-design.  The goal is to make functions be able to be used perfectly as a condition, action or expression.
    
    First off parameters are named and can be object types.
    
    [code:3j88tc5m]+-----------------------------+
    | on function "turn" (ot, deg)| ot.angle = ot.angle+deg
    +-----------------------------+
    +-----------------------------+
    | start of layout             | call turn (sprite, 90)
    |                             | call turn (sprite2, 45)
    +-----------------------------+[/code:3j88tc5m]
    
    Next the return action will actually exit the function instead of just setting the return value.
    [code:3j88tc5m]+-----------------------------+
    | on function "dist" (a, b)   | return distance(a.x,a.y,b.x,b.y)
    +-----------------------------+
    +-----------------------------+
    | start of layout             | sprite.width=call.dist(sprite1, sprite2)
    +-----------------------------+[/code:3j88tc5m]
    
    Next in order for a function to modify a sol, returnSol is used instead.  This allows it to be used as a condition.  ReturnSol can have multiple values.
    
    [code:3j88tc5m]+-------------------------------------+
    | on function "indist" (a, x,y,dist)  | returnSol a
    | a: filter distance(a.x,a.y,x,y)<dist|
    +-------------------------------------+
    +-------------------------------------+
    | call "in dist"(sprite, 0,0,100)     | sprite.angle = sprite.angle+1
    +-------------------------------------+[/code:3j88tc5m]
    
    The synatax of calling sould simplified somehow.  Above are just a few ideas.
    
    Anyways that's a rough overview.  I'll have to prototype it in order to flesh out a few of the details.
  • The idea isn't super difficult but i guess explaining it with text and implementing it is tricky.

    1. we first need to know if the player is colliding with a tilemap. This is dead simple with one event.

    2. we need to know what tiles the player is overlapping. This example here does that:

    viewtopic.php?f=147&t=123332&p=877612&hilit=overlapping+tiles#p877612

    3. So now we have a list of tiles overlapping the player. Here's a collection of ideas that search gives to get a rough collision point between two objects:

    how-do-i-get-coordinates-of-span-class-posthilit-collision-span_p983039?#p983039

    Guess one idea would be to get an average of all the tiles and use that.

    Here's an idea to take the example from two and only use the part of the tile that's overlapping:

    https://dl.dropboxusercontent.com/u/542 ... oint2.capx

    works well if the sprite is only slightly overlapping the tiles

  • [quote:2qlqyoaa]one question though, how do I actually pick by UID? I can add System.Object With UID(Function.Param(0)) Exists", but that doesn't seem right.

    The array object has a pick by uid condition.

  • That's a handy idea.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's still acceptable in my opinion. There's probably some more details about it in ashley's blog or something. What it comes to is if you need to measure a timeframe that matches the real clock, use wallclocktime.

  • Good point, could be interesting if changes in the code could reflect in the editor.

    That's not really possible since you can do things in js/c that don't translate directly to events.

    The modular idea sounds good but it'll have to wait to see how it works. For construct this is tricky because events are all over the place, so it's hard to handle all cases.

  • 1.

    That's not wrong. It's just in scientific notation. The e-02 at the end means move the decimal point left two numbers.

    2.

    Time and wallClockTime will be more or less the same except.

    WallClockTime is always advancing even from one event to the other.

    Time on the other hand updates only once per frame.

    So if you compare the two at the top of the event sheet they will be about the same.

    Now time is incremented by dt every frame, but dt is capped at I think 10fps so if the game ever dips below 10fps time will lag behind wallClockTime.

  • Search for "bitwise" with the forum search. The method is called bitwise tilemaps, and is usually done with terrain, but it would work perfect for roads.

  • If you want to create an effect like that you can probably look up on google for the math. You could also use the forum search to see an effect already exists that does that.

  • It might look a bit better than than the js but still. The resulting code will be very much dependent on their runtime and most things that would be possible to tweak would be better made into a plugin I'd think.

  • Search should give a few ways. In the case of a tilemap you first need to know the tiles the Sprite is overlapping. To help with searching, I've made a capx that does that.

    After that the location the two objects are overlapping depends on the shapes of the objects. Keep in mind two objects can overlap at multiple places. One simple way could be to use the midpoint between the two objects, which works well if the objects are the same size and shape. There are also some more involved ways, but search should give more info about those.

  • Probably not at all. I mean what would most users do with such source code? It won't look very readable since a lot of things would have to be done in c to match the events. It's kind of like manipulating the js of an exported project if it wasn't obfuscated.

    What get's me from watching the second video is it looks like things are still have the same design they had from Klik n play.