Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Under the Hood
#1
Okay, so this *is* related to Midnight Mansion, but I didn't know where else to put it.

Someone mentioned a while ago in some other forum post (I forget where) that I was probably right when I said that things are more complicated
under the hood
than they appear when you play the game. Today I was working on the new troll monster, that can both walk left/right AND climb ladders. And ladder climbing is pretty tricky.

So for those of you who are a little curious what the source code looks like, and to gain a deeper appreciation for the complexity of the game
under the hood
, here is some of the code (not even all of it!) that handles Jack climbing ladders.

Hmm, seems it's too long to post as a message, so I'm attaching the file. This is purely for your amusement.

I seem to remember ladders took me like 2+ weeks to get working initially, not to mention fixing bugs later. It was definitely one of the harder parts of Jack's movement.

This is also one of those things you might call
ugly code.


Attached Files
.zip   ladders_txt.zip (Size: 19.53 KB / Downloads: 1)
Reply
#2
Vern,

Living in a programmers world daily I think I have an appreciation of what's under the hood. Just curious about when the rest of the car will be available (expansion pack).

:Smile :Smile :Smile

Thanks,

Joe B
Reply
#3
Why ugly?
It's commented which is my definition of pretty vs ugly.

Joe B
Reply
#4
Looks like hard work, Vern! Here's an example of what I did with my simple Meta language. (Type of code) These I believe is the buttons code... or the controls... It's been along time since I programmed, took me awhile to figure out. Its the code for my game, Laser Blaster. Download it free at my site! (www.antsarts.surf.to)


Attached Files Thumbnail(s)
   
Reply
#5
Vern....that's really amazing (and crazy...) - so many linmes of code needed just for moaking someone / something climbing a ladder.... Jesus Christ. :o
I wonder how many pages would be filled by the code for the whole game ???
Reply
#6
I'm not sure if there's a number for that!!! ;D
Reply
#7
There's 311 lines exacly for my Laser Blaster! My older brother is coming over soon to help me to get Health Packs working and to appear every now and then when you're playing! Then Laser Blaster 1.2 will be out! After that, I'll get more weapons for 1.3! It'll be wicked.

@Vern:
Do you know any Meta-Laugage? I use a app. known as Metal with my code. You can download it at: http://www.iit.edu/~sarimar/GDS/DL/metal-173.sit
Reply
#8
joeb wrote: Why ugly?
It's commented which is my definition of pretty vs ugly.

Well, ideally it would be modularized a bit more. Right now, it's the
stuff everything into one function
(or in this case 4 functions) type approach, which makes it hard to read, and difficult to modify and debug.

But sometimes you never really can get away with the
ideal
elegant approach, and have to go with real-world.

The nice thing it, I was successfully able to copy and modify this code for use with the new Troll monster fairly easily. Now I have a troll who runs along bricks *and* climbs ladders when he comes to them -- something I was previously afraid might be very hard.
Reply
#9
aquaMat wrote: I wonder how many pages would be filled by the code for the whole game ???  

Quite a few. ;-)

I have 15 main source code files for the game, not including the animation engine, SpriteWorld, which I also wrote much of, and not including many utility files, used for things like handling File Input/Output.

In the previous source code listing, there were 4
functions
:

ClimbingSpriteMoveProc
FinishClimbingLadderMoveProc
GetLadderRect
GetLadderRectFromTile

Below is a screenshot showing the entire function list from just one of those 15 source code files, to give you an idea of how long one of the files can be. This particular file has 4910 lines of source code.

This is one reason why they say programming has a
steep
learning curve on modern computers. ;-)

And now you can also recognize why commercial games typically have *teams* of 30+ people working for 1-3 years to create a single product. (Although many are typically do artwork or other non-programming roles.)


Attached Files Thumbnail(s)
   
Reply
#10
Looks... long. Wink
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)