Plugins & Behaviors in development

  • I'm currently working on a Polygon plugin. You basically feed it some vertices (in the proper order) in local space and then draw.

    It also handles collisions.

    What I have done so far:

    Condition:              ?

    • Is overlapping another object
    • Is overlapping at offset
    • Collisions enabled
    • On Drawn
    • Compare area

    Actions

    • Add Vertex (x,y) \\ in local space
    • Log Vertex List \\ outputs the vertex list in the js consol
    • Draw Polygon (fillColor,lineWidth,lineColor) \\ every change in vertex list needs a draw call to be seen
    • Move Vertex (index,x,y)
    • Remove Vertex (index)
    • Clear Polygon \\ empty the vertex list and erase the poly)
    • Load (JSON)
    • Download (JSON)

    Expression

    • VertexX(index) (in world space)
    • VertexY(index) (in world space)
    • VertexCount
    • Area
    • LocalVertexX(index) (the original values entered in Add Vertex)
    • LocalVertexY(index) (the original values entered in Add Vertex)
    • asJSON

    Basically everything in this list is done and I'm already using it for a project so I can thorouoghly test it.

    Also it might not be super easy to work with since I'm mixing local and world space. But that's what I found the most practical.

    You create vertices relative to the position of the object so you can feed the same vertex list to other instances an have the same shape drawn.

    And you retrive the vertex position in world space so you can "pin" some objects to them or do some calculations.

    You can copy polygons using either the LocalVertex expressions or Get as JSON -> Load

    I don't support textured polygon for now at least... If it's not too hard to implement and if it doesn't make the plugin too complex I might.

    I think I'll be releasing it this month so we'll be able to talk about it in its own topic =)

  • I put my TODO list of my plugins in here. Uh, might be a little long...

  • I'm currently working on a Polygon plugin. You basically feed it some vertices (in the proper order) in local space and then draw.

    It also handles collisions.

    What I have done so far:

    Condition:              ?

    - Is overlapping another object

    - Is overlapping at offset

    - Collisions enabled

    - On Drawn

    - Compare area

    Actions

    - Add Vertex (x,y) \\ in local space

    - Log Vertex List \\ outputs the vertex list in the js consol

    - Draw Polygon (fillColor,lineWidth,lineColor) \\ every change in vertex list needs a draw call to be seen

    - Move Vertex (index,x,y)

    - Remove Vertex (index)

    - Clear Polygon \\ empty the vertex list and erase the poly)

    - Load (JSON)

    - Download (JSON)

    Expression

    - VertexX(index) (in world space)

    - VertexY(index) (in world space)

    - VertexCount

    - Area

    - LocalVertexX(index) (the original values entered in Add Vertex)

    - LocalVertexY(index) (the original values entered in Add Vertex)

    - asJSON

    Basically everything in this list is done and I'm already using it for a project so I can thorouoghly test it.

    Also it might not be super easy to work with since I'm mixing local and world space. But that's what I found the most practical.

    You create vertices relative to the position of the object so you can feed the same vertex list to other instances an have the same shape drawn.

    And you retrive the vertex position in world space so you can "pin" some objects to them or do some calculations.

    You can copy polygons using either the LocalVertex expressions or Get as JSON -> Load

    I don't support textured polygon for now at least... If it's not too hard to implement and if it doesn't make the plugin too complex I might.

    I think I'll be releasing it this month so we'll be able to talk about it in its own topic =)

    Yann it looks interesing! Isn't based from Rojohound's canvas plugin?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Joannesalfa

    The drawing part ressemble the draw line and fill action. But it's simplified since you don't have to do the beginPath, moveTo and lineTo, endPath, fillPath, strokePath etc

    you just have to do a serie of Add Vertex action followed by a draw Polygon action where you specify the fill color and line width/color.

    Everything else is handled under the hood.

    And since you give the vertices in local space, you can more or less dynamically position the origin. And also the collision polygon is automatically created to fit your polygon.

    So yes... ressemble canvas plugin but way more specialized toward polygons.

  • I put my TODO list of my plugins in here. Uh, might be a little long...

    That plugin for Pomelo (which I'm discovering btw) sounds exciting ^^

  • lemo

    The plan of this plugin does not include server programming.

    I'm thinking that is it possible to create server logic by C2.

    -> Could C2 create a server at linux?

  • Making a plugin for use of volume buttons and potentially pwr button

  • we need a microphone input plugin , why doesnt this come with the base of construct 2?

  • Wastrel - I see in the first post of this thread that, like me, you're interested in A.I. Did either of your FSM or behaviour tree plugins mentioned there ever come to fruition? I'd be interested to know what functionality your FSM behaviour provides that differs from, say, using an instance variable to record an object's current state, and a set of conditional events to handle transitions to other states.

    I have my own existing Javascript implementations of Genetic Algorithms and Artificial Neural Networks that I'm considering wrapping into plugins. The problem is that, in order to be useful, they both require a reasonable amount of scenario-specific customisation that is easier to achieve at the code level rather than via C2's GUI. I'm therefore dubious of the value of providing them as plugins, since it would only really be useful to people who were happy to dabble with the code....

  • tanoshimi

    I had made a FSM plugin/behavior before, and use it to control the game flow.

    <img src="http://i1081.photobucket.com/albums/j352/rexrainbow1/fsm_zps33150e5e.png" border="0">

    The transitions (enter/exit) are option events. "action:Request" will trigger "condition:On transfer" logic of current state, for setting new state by "action: Set next state".

    I had made another fuzzy plugin.

    Here is an example to use fuzzy logic to simulate behavior of fish.

    • click to put feed
    • click gray plan to open ui for creating a new fish. Click ones to close it.

    And it is the define of memberships and fuzzy logic in this demo.

    <img src="http://i1081.photobucket.com/albums/j352/rexrainbow1/bf177d5b490cd54a2c6c1a3d09d650d0_zpsdb3e24ab.png" border="0">

    I had not released these plugins because that I did not know how to explain these concepts for beginner.

  • Rex - very interesting, thanks. I've always implemented FSM behaviour directly through the event sheet, although I see your method has the potential to be slightly tidier, particularly with respect to the OnExit/OnEnter triggers.

    If you'd be willing to share your fuzzy logic plugin I'd be very interested to see it. I've never really seen the point of fuzzy logic - I find you can achieve better results from modelling uncertainty using probabilistic methods.

    Maybe I'll have a go at porting my ANN to a plugin and see whether it's usable or not!

  • tanoshimi, I was never able to complete my plugin. Not long after that post, my professional life went through some rather drastic changes (positive changes, thankfully), and I found myself with no time to complete any of my gaming projects.

    rexrainbow's solution looks like a good one (as always).

  • tanoshimi

    Most of my plugins are trying to decrease the usage of events, except fsm plugin. FSM plugin will increase the event counts because it split transitions and transfer logic into different events.

    The reasons of using fsm are

    1. it provides javascript input to do logic and/or/not (I made fsm plugin before C2 had "OR" block, now it is not an advantage at all.)

    2. it is clear for designer to list transitions and transfer logic.

    3. designer could trace the state changed at "condition:on state changed" (not shown above)

    The source code of fuzzy plugin is here. I might release it when I have time.

  • tanoshimi

    Fuzzy is not a probabilistic based algorithm -- it does not use random function.

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)