Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Modeling Jack's World
#1
As I strive to put interesting features into my current mansion project, I've found that trial and error is currently my only method of design, and I think that stinks. I can't help feeling that I could be much more effective if I were able to describe interactions in Midnight Mansion mathematically so that I could model how a certain mechanism is to work before I go building it. It also occurs to me that some of what I want to know may already be common knowledge among the community.

So, before I went haring off trying to figure all this out on my own, I figured I'd post a list of all the things I want to know and see what others can fill in. After that, I'll figure out the rest and post them in a follow-up, so we can all have a handy reference to build off of.

Units
If you're gonna describe something, ya gotta have units! Fortunately, we only need three in this case. I've chosen to use seconds (s) for time, tiles (t) for distance, and tiles/second (tps) for speed.

Please use these units when posting quantities (or if there's a better unit, use it but explain it).

Modeling Jack's Motion
  • How fast does Jack run (tps)?
  • How fast does he fall?
  • How fast does he slide down poles?
  • How high does he jump?
  • How high does he jump from vines?
  • How fast does he travel horizontally while falling?
  • How far can he jump (can be obtained from the previous three)?
  • How fast does he climb ladders and vines?
  • How far can he fall without dying?
  • Bonus question: What effect do moving things (conveyor belts, moving platforms) have on Jack's horizontal motion, and is there a mathematical relationship between this effect and the speed of the platform?

Modeling other motions and times

General:
  • What is the conversion factor between the speed number you type into the dialog box and tps? Is this factor the same for all sprites that can have a speed?
  • How do duration numbers translate into seconds? (some dialogs say it's s/60, but others don't. Is this consistent?)
  • How long does it take a door to open?
  • How long does it take Jack to flip a switch?

Spiders:
  • How fast does a big spider descend/ascend? (tps)
  • Small spiders--actually, I can't make head nor tail of these numbers. If someone could explain what they mean I would be most appreciative.

Birds:
  • How does the amplitude number translate into vertical range (as in, given an amplitude number, how many tiles will the bird deviate up or down from its placed position)?
  • What does
    angle delta
    mean?

Fish: What relationships correlate initial speed, gravity, jump height, and speed of ascent/descent at a given vertical position?

Final remarks
I think that's all the information anyone could need to model any aspect of the game. If we can figure out all these numbers, it should be possible to just plug things into a spreadsheet and churn out answers to all sorts of design problems.

Here's a simple example if you're having trouble visualizing why I'd want to know all this: Suppose Jack is sliding down a pole. You have horizontal zapper beams across the path of the pole, and you want Jack to ride down in a cocoon of safety, with beams turning off just as he reaches them, and turning back on just as he passes through. I've seen this done before, and wanted to do it, but got stymied by the prospect of building it by trial and error. If I knew Jack's rate of fall on a pole (and what the zapper durations mean), I could just set up a few formulas in Excel and fill down to churn out the values for all of the zapper beams.

Think of it. Just think of it! :o :o ;D Tongue

Also, this information really should be in the manual. Eh Vern, wink wink nudge nudge? Wink Wink :-? :-?
Reply
#2
ryos,


I've also puzzled over those factors myself. Undecided Undecided Undecided

I've done the same as you with trial and error methods because I was too lazy too sit and calculate especially because it's different from Mac to Mac. I'm sure there's formulas behind the movement. just not sure whether Vern would publish those.
FWIW I did do a bunch with measurements in the custom graphics tutorial so that may help but that's a GREAT idea about modeling a mansion first. In a post somewhere I did mention that I was using Excel to track my layouts, critter dispersal, path validation and such and it would be very cool to add movement formulas to it.
Hmmmmmmm, we need to talk about this some more (unless Vern considers it taboo or reverse engineering). But I definitely LIKE the idea!

Joe B
Reply
#3
joeb wrote: ...too lazy to sit and calculate...

Heh. I'm an engineering student. Sit and calculate is what I do. Big Grin

...especially because it's different from Mac to Mac.

Sure, the absolute timing of things will differ from mac to mac, but the timing of events in relation to each other should remain constant. Were it not so, Jack would have a different jumping range on different computers, and crazy zapper beam contraptions wouldn't work, and Freddy's evil pixel-perfect Bedlam tricks would break, etc.

I'm sure there's formulas behind the movement. just not sure whether Vern would publish those.

I really hope he does. Like I said, this is information that I feel should have been included in the documentation. A number (for example, the speed numbers) is meaningless without a dimensional unit that relates it to something.

FWIW I did do a bunch with measurements in the custom graphics tutorial so that may help...

* ryos goes to read the tutorial...
Hey, that's nice! I now know that what I had previously referred to as a
tile
is really half of a tile, at least in the graphical sense. I chose the tile because it seems to be the only unit that's sane to try and measure in the editor, due to the grid. It also seems the most convenient, because everything is tiles in MM. So: 16x16 pixel tiles, 40x27 tile screen.

Actually, I do have a program (Art Director's Toolkit) with an onscreen ruler. That will be of much use I think.

...but that's a GREAT idea about modeling a mansion first. In a post somewhere I did mention that I was using Excel to track my layouts, critter dispersal, path validation and such and it would be very cool to add movement formulas to it.
Hmmmmmmm, we need to talk about this some more (unless Vern considers it taboo or reverse engineering). But I definitely LIKE the idea!

Yay! Someone else crazy like me! Wink

I'll get to measuring tonight when I get done with work. My tools of choice will be the aforementioned ADT and a stopwatch. I'd be happy to post any spreadsheets I come up with as well. It should be easy to come up with a few calculator sheets (fish movement, small spider movement, etc) that convert desired movement characteristics to dialog box numbers.
Reply
#4
I don't have time to really get into this right now, but I'd recommend using game seconds instead of real world seconds to make measurements. And the most reliable way to do that is the zapper beams. The time increments the zapper beams use is supposed to be 1/60th of a second. So a beam with 1 on and 59 off should flash once per second, and you can make measurements off of that.
Reply
#5
is supposed to be

Yes and no. REALLY don't want to get into it but a slower machine takes more time to do EVERYTHING not just the system task which is supposed to occur once a second but actually doesn't based on interrupt status. This is from my Test Engineering days at GE, RCA, Intel and Motorola and based on what's actually hooked to the processor and the speed of those peripherals you can see some interesting
seconds
.
But the model you present is an accurate one for figuring out what ryos is talking about.

What kind of engineering? Based on the sit and calculate (or plug and chug as we called it in the olden days) I'd say you were one of those unfortunate soul EE students looking to calculate anything but parasitic capacitance. YUK!!!!

Let me know what you come up with and I'll see if I can Excel it. Doing a lot with Excel now as we're using a new product called Crystal Xcelsius for creating dashboards for financial analysis and it'd be fun to do something other than figure out how the bank can make yet more money.

And yes, my wife says I often dabble in the realms of crazy and she just wishes I weren't so good at it.

Tin foil hat is now off.....

Later dude,

Joe B
Reply
#6
The zapper clock is an interesting concept, but unfortunately it proved too hard to watch both it and what I was trying to time, plus its inherent inaccuracy means that the error introduced is probably more significant than any differences based on differing machine time.

I still think it doesn't matter. The timing of all events in-game should scale in exact proportion to the current machine time. Data collected on a slow machine should yield the same models as data collected on a fast machine. We just have to be careful not to mix data sets and we should be fine.

Naturally, as with all empirical functions, there is an error involved that we need to be aware of. These methods are only so precise, and yield functions that are only valid under conditions near those used to determine them. Fortunately, this application does not demand a great deal of precision. One thing I've learned is that good enough is sometimes good enough. Smile

Anyway, I found a free stopwatch program called
Chimoo Timer
that works quite well. I didn't have time to get many measurements and I'm now going to bed, but I'm optimistic that this will prove fruitful.

Oh, and I'm a ChemE, hoping to work on alternative energy technologies/solutions. My dream is to help improve batteries to the point that an electric car has only upsides. They're already pretty close; see the Tesla Roadster for the best example. I also wouldn't mind working on renewable processes for producing electricity (like this one for example).

But right now, what I feel like is a monkey with a calculator. ;D
Reply
#7
Progress report time! (What follows is a description of what I've done so far to try and discover the function that maps the speed number to the physical unit of tiles per second, for those who are interested in that sort of thing.)

I timed all the speeds with Chimoo Timer, plotted the data, and fit a line to the plot. The resulting equation...didn't work in practice. I tried to construct a zapper beam room where Jack rides a platform of speed 20 across the beams in a pocket of safety, and the timings produced by the function were off by a fair amount. However, they were close enough that it wasn't too hard to tune the thing by hand.

After I had tuned it by hand, I entered those numbers into the sheet to determine the actual speed of the platform. I tuned another speed by hand to get another point and ran a line through it. The resulting function...didn't work.

Then, I came up with an even more accurate (but time-consuming) way to measure time in MM. Set up two zapper beams separated by the distance you're measuring over (one full screen for high speeds, less for slower speeds (for the sake of my sanity)). Have a platform with the speed to be determined bounce between them. Get the numbers right, and the beams will flash every time the platform hits them. The previously determined linear functions give a decent ballpark to start from.

Once the true numbers are determined by this method, not only will we have a table that we can use to just look up the proper speed, but we should get a more accurate function out of it as well. It's possible the relation isn't quite linear...we'll see.
Reply
#8
...time passes...

Ok, I've got all the measurements done and the function fit. The data aren't entirely linear, but pretty close. It makes me wonder if I might be off in my measurements by 1/60th of a second on some of them. Oh well.

The function that provides the best fit is a third-order polynomial. THIS IS VALID FOR SPEEDS 1-20 ONLY! Fortunately, there aren't any other possible speeds. ;D

The function is accurate to +/- 0.5 tps (or 8 px per second). That should be good enough for most applications. Those that require more precision can use the lookup table.

Here it is:
y = ax^3 + bx^2 + cx + d
a = 0.000397348
b = -0.006289512
c = 1.808243877
d = 0.041327132

With y being the speed of the object in tps, and x being the speed of the object in MM speed numbers.

I haven't tested this yet, but given the method employed I feel confident that it worked. Smile
Reply
#9
Jesus, you guys really must have some spare time to fill ! ;D Big Grin Wink
Reply
#10
aquaMat wrote: Jesus, you guys really must have some spare time to fill !   ;D Big Grin Wink

What can I say? I'm out of mansions to play! Big Grin

The semester is winding down for me. I'm in the lull where there isn't much homework, but it's still too early to start studying for finals. Hence, this monkey starts looking for more things to calculate!

And, really, all that sounds time consuming, but it wasn't that bad.

BTW, do people want me to keep chronicling my quest to model Midnight Mansion? Or would you rather just consume the fruits when it's done? I did it assuming it would be interesting to someone, but if no one cares I'll save myself the trouble. Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)