Ruskul's Recent Forum Activity

  • One final caveat, if you are setting frames only to get collision polygons for a behavior to use, this works really well, however - I have a strict editor side hands off policy on the changing animations or frames for objects using this behavior.

    This results in a behavior that can only be used so long as the user adheres to "rules" of use. This is true of any code, but its not a grand replacement for a proper collision system with a dedicated api for all the obvious reasons.

    Such a dedicated api would allow for the creation of custom platformers and 8way controllers. The built in ones are nice, but they have issues you can't resolve via events. Mario and sonic behaviors clones with exacting detail could totally be created and shared. But not currently, not without hacks like this, meaning its likely to break in the future when Scirra changes things.

  • Hey all,

    I have some events I want to only run on the start of the first layout started, but for ease of debugging, I don't want them tied to a particular layout.

    I've created a data object with boolean "IsInitialized". At start of layout, I check this boolean. If false, I run the startup routine.

    It works, but I was curious if there was a better way.

  • Ah, yes... Spot on Ashley ! I found the forum post I was thinking of from 2013.

  • I thought construct ran an internal pool of objects in order to recycle objects destroyed objects and improve/reduce overhead for object creation/destruction in game.

    I didn't know if we are supposed to hook into that in order to avoid re-initializing certain types of data, or how data is handled through constructs instance creation, destruction, sent to pool, returned from pool, and absolute destruction.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey all!

    I have a behavior I made to solve a really simple problem. It tracks the state(s) of a binary toggle, flip, switch, or whatever you want to call it with extra benefits!

    The behavior automatically tracks last state, the time at which a state change occurs, the current state, and has conditions for entering/exiting (similar to input On key pressed, or On key Released).

    In addition, you can use it to track previous entry/exit times for states.

    The behavior uses an array of states, and accesses them by ID, but only updates the number you specify, keeping it lean and simple. The Id system allows you to determine what each state is. For example Forward = 0, Right = 1, Back = 3, and so on. States are also stored as numbers, so technically, you can have a state existing in a series of substates.

    I use it for character input (player or ai), and for tracking simple states, such as IsOnGround. In this case, I would have a variable on a data object called IsOnGround and set it to be the desired ID, then use it like so:

    Is entity overlapping water? -> Entity Set State(IsOnGround) to 1

    later on in the project:

    //True during the first frame a state is switched on from off

    entity enters state (IsOnGround) -> Do things

    //True during the first frame a state is switched off from on

    entity exits state (IsOnGround) -> Do Things

    You can combine them in nice ways like this (in this case to forgive/allow a player to jump when they pressed the input a fraction of a second too early):

    entity state (jump) was entered <= 0.1 seconds ago

    entity enters state (IsOnGround)

    ---> //call the jump behavior

    Would anyone else like access to this? I was hoping for feedback on naming conventions and ease of use, as well as use cases people find for it.

    ----

    Current ACES:

    Actions:

    //Given an id, sets a state to the value provided. Both are numbers

    -Set State(Id, State)

    //Called after all changes to states are made. This is used to compute new enter/exit times for any states that have changed. The time is calculated based on the instances dt

    -Confirm States

    //Set the total number of states to process (hard coded limit atm)

    -Set State Count

    //Resets all states and times to default/off state.

    -ResetAll

    -Reset(id)

    //Set the behavior to auto rollover input and advance the internal clock

    -Enable

    -Disable

    //Manually advance teh internal clock and roll over states from current to last

    -Advance frame (dt)

    Expressions:

    Returns the current value for a state, given the id

    -State(id)

    //Same as above, but for the last frame

    -LastState(id)

    //Returns 1 if the state at id was switched on during this frame

    -Enter(id)

    //Returns 1 if the state at id was switched off this frame

    -Exit(id)

    //Returns the time for a state entering or exiting or the previous one.

    -EnterTime(id)

    -ExitTime(id)

    -LastEnterTime(id)

    -LastExitTime(id)

    //Returns the number of states being processed

    -Count

    //Returns the Objects current time in seconds

    -Clock

    Conditions:

    //Returns true if state(id) is true,

    -State (id)

    -Last State (id)

    -Enters (id)

    -Exits (id)

    -Compare exit time (id)

    -Compare Last exit time (id)

    -Compare enter time (id)

    -Compare Last Enter Time (id)

    -Compare Clock

    -IsEnabled

  • Ashley , Uh, just a quick clarification - was there a place to add a function to be called when an object gets added to the pool or removed?

    I don't know if it matters, but currently I stuff any variables/objects I need on a behavior instance via the constructor by means of:

    this._whateverIneed = {
    	thing : true,
    	somenum : 42,
    	etc : "..."
    } 
    

    But I wasn't sure if I needed to clean up in any specific way afterwards - or if I needed to do anything between an object being in use / out of use.

    Thanks for answering so many of my questions today!

  • Applying editor-side changes while the editor is open is an extremely difficult problem. What happens to the project you are looking at if the addon has a breaking change made while you have a project open? There are probably hundreds of ways the editor could crash after that, and it's infeasible to spend weeks or months doing all the work to sort out all those possible cases instead of doing other things like new feature development, just so you don't need to reload the editor during development.

    That doesn't apply to the runtime though, so you can in general make any runtime change and it will apply on the next preview.

    I wasn't meaning to say the ability to make hot changes to the editor should be added! I totally agree, not worth the dev time. To be fair too, in unity you basically have no choice, all game logic is scripts that must be compiled after every change, whether runtime or editor side.

  • Well, I can't say I didn't do anything to break it, but I also didn't make any changes (that I was aware of) in order to break it. I didn't make anychanges to fix it and after restarting everything it was all good. I am curious if my server went down at just the right moment, could an expression fail to be loaded?

    In another instance I was breaking it on purpose, ASHLEY. But I was kinda expecting to be able to still open the project and remove all offending lines. I like to build up a project with all the ACES that a behavior adds, but as I work, sometimes I decide a behavior shouldn't have a particular ACE and I remove it... breaking the whole project.

    It would be super cool to be able to go into a project with errors and fix them.

    But yeah, the issue in that case is all on me, lesson learned. Delete All aces in project first before deleting in behavior.

  • If you're using a local server for addon development, and you end up in a mess, the easiest way out is to clear browser storage (which has the effect of uninstalling all addons).

    That is gold, thank you!

  • Cool, Thanks!

  • Shoots, thanks - good to know.

    As far as GC goes though, for example, I thought you said vector2 were dangerous because of gc. I try not to optimize ahead of time, but just wanted to make sure I was following best practices in this case.

  • It depends what your comparing it to. You don't need unreal engine, but if your going to add 3d then at least add collisions and 3d ray casting to finish the feature set. One of my biggest gripes with C3 is that a lot of things get added but never completed. Its just enough to entice you with what could be possible, but ultimately leaves you frustrated with its limitations.

    To be fair, I think the 3d in c3 isn't meant to be true 3d. Its all smoke and mirrors on what are essentially 2d games.

    I would agree with that what you say in a way, and I think that is my point. We still don't have a proper set of tools for 2d collisions and rays or a way to traverse object hierarchies. Adding in anything for 3d before even finishing this in 2d seems backwards.

    Consider that currently there are no collision resolution functions except PushFromSolid (requiring a behavior to use, and solid tag on objects). This is very restrictive given the way c3 families and behaviors work. Raycasting is similar. Box2d provides an impressive array of tools, but most are not available when using that behavior (requiring additionally using c3 overlaps).

    In my mind, given physics engine code is opensource, accessible, and to be found in great variety, I think c3 could easily offer more than it does in this realm, natively. Collisions are really core functionality (as are vectors), and c3 might be the only game engine I have used that won't provide the latter, and has a very simple simple solution for the former.

    This is all okay if you are making retro style platformers (even then there are some missing tools for that), because the functions are lightweight and can be handled in events.... but, 3d?

    Currently in 2d, we have no way of defining collision objects except by adding in objects with all sorts of extras we don't need. We have no way of creating compound colliders except by means of creating multiple sports or iterating through a sprites animation frames (bad for performance just to get a polygon). This is going to be compounded in 3d. We have no way of testing overlaping shapes and returning the points of contact etc... Box2d comes with a full sweet of tools, but many are not officially exposed. C3 doesn't have a model for detecting continuous collisions. C3 doesn't have swept shapes (which can be built off continous collision solvers). This list of issues is largely only solvable by rolling out your own code, but then you have the unpleasant issue with the fact you can't extend the editor.

    All this applies to 3d. You need everything I just listed, or you are going to have the most basic problems of getting a fully 3d character controller up and running. You need to know surface angles at point of collision, and so on.

Ruskul's avatar

Ruskul

Member since 23 Nov, 2013

Twitter
Ruskul has 2 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x6
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies