Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Tebbo

Pages: 1 2 3 4
1
Ask a Question / Box 2D Simple Push Settings?
« on: January 26, 2016, 12:26:25 pm »
I'm trying to figure out a very simple kind of physics and really can't seem to get the right settings with Box 2D.

My goal is to have character A push character B. Character A moves 20px/step. When character A collides with B and continues to move I would like both characters to move at 20px/step. When character A stops I'd like B to stop immediately also.

I have no need for any other physics related interactions. This is the only one and I was hoping to avoid using gravity, friction, linear dampening, etc. as I don't want to introduce any possible weirdness from Box 2D.

Any suggestions or solutions would be helpful, thanks everyone.

2
Ask a Question / Re: Step Size and Frame Rate
« on: January 16, 2016, 03:15:04 pm »
This thread had some recent dabbling of mine, but essentially the problem went unresolved. Might have something for you though.

http://community.stencyl.com/index.php/topic,45834.msg255182.html#msg255182

Thanks I think I actually picked through this thread before since I recognize your name.

Part of what you were looking for was something I was looking for and I did figure out how to retrieve that so this might be of interest to you.

What I did is trace the time in an 'always' and a 'when drawing':
trace("steptime_"+ (haxe.Timer.stamp()));

Always = per step, When Drawing = each draw. Since you can have several steps between draws by default (without my tweak) you want to track them both. If you just want to see draw speed though that's easy enough to grab and then do something like (X-Y) where X equals your most recent timer printout (and Y is the one before that) running in a 'When Drawing' event. Then divide 1000 by your result and that should give you the framerate as of the last drawn frame.

3
Ask a Question / Re: RPG
« on: January 15, 2016, 10:34:04 am »
The reason people have mentioned crash courses and tutorials unrelated to your RPG idea is because they teach the fundamentals you will use anyway. It's not like you will learn useless things.

When you know very little it's very hard for people to help you because their answers won't necessarily make sense to you yet.

You're not doing those crash courses to learn specifics. You do them to understand how stencyl works and what all the blocks do and how they interact. You need to learn programming logic before you can do anything and the crash courses do a good job of teaching that.

As for having a weapon move with another actor, just set the weapon actor's x/y to that other actor's x/y +- whatever offset is needed for it to be in the right spot you want. scene -> actor, 'for each actor of this type' choose the main character actor as the type and that's pretty much it.

4
Ask a Question / Re: Step Size and Frame Rate
« on: January 14, 2016, 08:04:55 am »
I've been doing as you said and looking through the engine file at the game loop and update portions.

I see a few ways I could alter things though I am not sure if I would break something.
Is there a way to insert code into engine.hx without having to modify the original copy? So I could edit it and it would only run an edited version for this one game.

I think what I could do is set animation frames to 10ms, this is of course faster than 1/60fps. Then since the animations are also based around the update loop if I can get the update loop to only go once a draw(), that should keep the animations in sync since they work off that update timing. At least it seems this way from looking at SheetAnimation.hx

edit: So I decided to mess around a little bit,

Code: [Select]
private function postUpdate(currTime:Float)
{
while(acc > STEP_SIZE)
{
update(STEP_SIZE);
acc -= (STEP_SIZE);
Input.update();
}

While looking at this bit which it seems, like you said captaincomic, determines how many steps it takes according to how much time has elapsed between frames. So I thought well, what if instead of acc being decremented by stepsize, it just decrements to 0 after updating once. So I tried making it acc -= acc and sure enough my timers (one trace in 'when drawing' and one in 'always') show me lockstep 1 to 1 (though the timing between them of course varies). It's reporting draw() around 2ms after updating every time.

Not sure yet if this will break everything in horrific fashion at some point but it seems to be working as I imagined for the moment. If this seems insane and like something which will obviously fail, let me know!

5
Ask a Question / Re: RPG
« on: January 13, 2016, 10:24:47 pm »
Scene change not camera change. So you have a scene, however large you'd like but let's just say it's the same size as your screen display.

Let's say that scene is name '0.0'. Now if you move to the bottom edge of scene '0.0' the game loads scene '0.1' (X=0,Y=1). If you move down again that's scene 0.2, etc.

You can name scenes in ways that allow you to refer to them by equations. So you can build a whole world scene by scene. Entirely done with blocks. Just basic math and a little effort.

However I am guessing you have littler experience and suggest you start out with things which are extremely basic. They won't be what you want to do but they will allow you learn what you need to eventually do what you want with some confidence.

6
Ask a Question / Re: RPG
« on: January 13, 2016, 09:13:31 pm »
it's entirely possible. i worked on a little prototype that actually also had the zelda overworld style where moving to each side of the screen moved to the same corresponding next scene (as if moving along x/y of a big world map).

I suggest using the 2DLists extension Photon developed.

7
Ask a Question / Re: Step Size and Frame Rate
« on: January 13, 2016, 08:24:21 am »
Hmm, I don't know how to force this:
Quote
1.update, 1.draw, 2.update, 2.draw, 3.update, 3.draw, etc.
You can look in Engine.hx at the functions onUpdate(), postUpdate(), and update(). The way it works, if I see this correctly, is that if more than STEP_SIZE time has passed since the last update, update() is called multiple times to "catch up". (So if STEP_SIZE is 10, and 33 ms have passed, update() is called 3 times.) So it's not completely fixed, but it's independent of the drawing loop.

Maybe you could just do all calculations in "when drawing" events instead of "when updating" events?

First, thank you for your insight and help with this!

I did more research so I could better communicate what I am trying to achieve, this was very helpful:
http://gameprogrammingpatterns.com/game-loop.html

if you scroll down to 'take a little nap' he posts some pseudo-code example,
Code: [Select]
while (true)
{
  double start = getCurrentTime();
  processInput();
  update();
  render();

  sleep(start + MS_PER_FRAME - getCurrentTime());
}

This is a basic kind of example because render and update happen in line I guess so you want some time if your update takes less time than the framerate (16.6). In this example it would stop things from running insanely fast. But it's kind of related in that maybe I can make the updates pause forcing them to go 1 to 1.

With Stencyl they don't happen in line, like you're saying.

Is there a way to muck around in engine.hx within stencyl, in a way that it would make a temporary copy or something so it was a bit easier and less possible for me to screw something up badly?

Also I was trying to find some kind of timer since that seemed important, so I imported  haxe.Timer and was messing with that. I set it up in an Always event to stamp() and print to console and the timing it gives no matter what I set the framerate or stepsize too is the same and usually moves between 14 and 18ms. Not sure how accurate that is or what's going on really (I'm a novice obviously) but it was interesting that hard forcing a framerate and stepsize did nothing to that value. I was expecting the value to increase based on the stepsize I set things to but that didn't seem to be the case.

Your idea about doing things in whenDrawing events is really interesting. Going to have to play around with that.

Edit:  After looking at it and learning what the operators meant I see how it functions like you're saying. 
I'm not sure whenDrawing will work because of the difference between the specific timing of each frame being displayed and the time each frame of the animation is progressing at. I would need to remove the Xms timing of animation and set them to only advance when draw happens. As it is now it is possible for it to break down and skip a frame so anything placed in 'whenDrawing' doesn't occur if it's looking for that frame. From my testing this is what seems to be happening.

So I guess it's twofold actually, I also need a way to set animations to only advance on update and not have their own timer since the ms per frame is irrelevant, frame (of animation) to frame (of draw) is what would work.

8
Ask a Question / Re: missing blocks
« on: January 12, 2016, 10:28:17 pm »
you're positive they aren't under Flow -> Conditions and scroll to the bottom?

9
Ask a Question / Re: Step Size and Frame Rate
« on: January 12, 2016, 08:10:27 am »
The step size and framerate a separate. The step size is fixed (default 10ms), while the framerate is variable (capped at 60fps). When there is not enough time to do the rendering, frames will be skipped.

I guess you could set the step size to the inverse of the frame rate, during each step, but that would make the game behave strangly when frames get skipped and the step size changes. Calculations of physics, velocities, etc. are based on the step size, and expect it to be a constant value.

I'm aware of all that yeah. I actually used some of your older posts to start tweaking things! So thanks for that.

Step size has to be an integer it seems so I am not sure exactly how I would go about setting it in that way...
The problem as far as physics isn't important since I am not using any physics, velocities, etc.

So yes this means things actually slow down if the framerate moves lower, which is fine. It's much better to have the gameplay slow down very slightly than to miss a frame. Though of course there's also monitor referesh speed to consider as far as what the player can see.

How would I actually go about setting the step size like that? In an always event, how would I grab the framerate to use it in this way and then be able to get step size to actually accept that value since even at 60 that's 16.66...

Thanks so much for your response either way.

Edit:
So maybe if I were to re-arrange the thinking a little it might make more sense and be possible.
Is there a way I could force stencyl to always go like this:

1.update, 1.draw, 2.update, 2.draw, 3.update, 3.draw, etc.

as you stated and as it seems to be, it's more like:
at 60fps, 10ms step, 16.66...ms passes between frames.

update 10ms, (draw 16.67ms), 20ms, 30ms, (33.34ms), 40ms, 50ms/(50.01ms), 60ms, (66.68ms), 70ms, 80ms, (83.35ms), etc.

That would be at a steady framerate which probably won't happen anyway.
A way that would wait to step based on drawing is I think what I am after.

10
Ask a Question / Re: Step Size and Frame Rate
« on: January 12, 2016, 07:46:54 am »
My understanding (although limited) is that Stencyl must have it's game logic and it's rendering separate? Since they can occur independent of each other.

Is there any way to rig it so it acts as though the two are happening in line always one to one (one update/collision step, one draw, repeat). That might be a better direction to look into.

11
Ask a Question / Step Size and Frame Rate
« on: January 11, 2016, 06:39:21 pm »
Is there any way to tie the step size to the frame rate? This isn't necessarily useful without also being able to set animation frame time to a variable but maybe that's also possible.

The idea being no frames (of animation) are ever skipped. Useful when using animation frames to determine the timing of things (if current frame, etc.).

Right now I am working with 20ms stepsize and max 50FPS which gives me a little more regularity of frame per step (with 20ms per frame animations).

Not sure if this is possible but it would be cool to mess with if it were and someone knew how.

12
Ask a Question / Re: [Events] If/Then event possible without attributes?
« on: September 24, 2015, 07:55:45 am »
I'm not sure I follow exactly what you're trying to do. Did you consider using a custom block that returns a boolean?

I've been sticking to non-custom blocks for the most part. That's why I initially asked if anyone was aware of a nice way to handle something like that using custom blocks/code because it certainly seems possible, just that there is no pre-built block for it.

I wanted to avoid placing an attribute in an event (when event happens, true) and then outside it elsewhere as an 'always' (false) just because I don't like having to communicate between attributes and then grab attributes across behaviors. It gets somewhat messy. A global custom block is probably something which would handle it, I am just not sure how I should build it and was wondering if someone had already built something like that and was willing to share.

It's no big deal really :) Either way I have solutions and/or can figure it out. I just figured I should check with others to see if someone knew a good solution or had a method they were familiar with already.

13
Ask a Question / Re: [Events] If/Then event possible without attributes?
« on: September 22, 2015, 05:12:42 pm »
Well, I haven't found anything to suggest that it is possible to check an event's occurence outside of its own code block.

Alright thanks!

14
Ask a Question / Re: [Events] If/Then event possible without attributes?
« on: September 22, 2015, 04:54:33 pm »
that is so convoluted. if you want certain code to be executed as an event happens, then just put the code in that event. you know, somewhere between that 'when event happens' bracket.

I know what you're saying it's really just because of how it interacts with other things that are already written at the moment. I see how it sounds, it was just a question as to how events are handled and if I could use them more generally to take care of a lot of things, and if anyone knew how to do that via code or a custom block.

Let me guess, you have all sorts of code in different behaviors that wait for something to happen?

If so, maybe my current project have some relevance to you. Basically I have a clock actor that updates time for everything else. The clock would trigger the Time Update event for any scene behavior that have it. As a second method of detection, the clock actor will also update a game attribute called GV_TIMEUPDATE. Any scene or actor behavior can compare it against their internal value and do whatever if it changes.

Basically, it passes messages to anything that needs them without having to know who they are.

Pretty much.
It's mostly an organizational thing. I have a similar function in one game also using a game attribute to keep track of time or number of player inputs which triggers other actors.

It may have sounded odd initially, I'm not looking for the basics or anything, just wondering if I could save time using a method I wasn't aware of to refer to things without needing to create additional attributes to handle whether or not something is happening.

15
Ask a Question / Re: [Events] If/Then event possible without attributes?
« on: September 22, 2015, 04:39:55 pm »
No offence, but you are not making a lot of sense.  Why do you not think custom events will work for you??  They seem to be almost exactly what you are asking for!  Did you not read the documentation  yoplalala  linked to?  If you did not understand how to do custom events, then ask for help on custom events.

I understand how to create and use custom events. I wanted to build them into something which was already built and to do that would need to handle what happens when the event isn't occurring.

So in a sense, "If [event happens] then..., Otherwise...".

Without making an attribute for true/false within the event itself I wanted to be able to check if the event was occurring.

The nice thing about events is that they turn on/off without needing to be 'reset' like an attribute. Since something is either happening 'on' or not, 'off'. So I was thinking it might be possible to use them generically to cut some corners and avoid some extra attributes per behavior.

Pages: 1 2 3 4