Pages: 1 2 [3]
  Print  
Author Topic: Spelunky Source  (Read 42983 times)
Svenski
Seedling
*
Posts: 4


View Profile
« Reply #30 on: January 01, 2010, 08:59:19 AM »

The way level generation works is from what I see:

A 4x4 grid (different sizes for cave, jungle and ice) is made for each level, each square represents one 10x8 block mini-room inside the level. A path through the grid is made, and then different premade mini-rooms with slight random variations are placed in each square depending on the path and how the spelunker needs to get through it.

For example where the path of the level travels through a square in the 4x4 grid from left to right, a 10x8 mini-room will be placed that is known to be transversable from left to right will be placed. Squares which the spelunker does not travel through are randomly selected.

the 4x4 grid is generated in scrLevelGen and the placement of the 10x8 blocks are in scrRoomGen, you can understand what symbol means what with this :

Code:
0 -empty
1 -block (1/10 pushable)
2 -block (1/2 chance of create) (1/10 pushable)
L -Ladder
P -Ladder top
7 -spikes
4 -pushable block
9 -entrance/exit
A -altar
x -sacrificial altar
a -chest
I -idol
C -crystal idol
B -spikehead
+ -block looks like pushable
K -shopkeeper
i -shop item
W -wanted poster
k -shop sign
w -water
v -bottom water
J -fishboss
T -tree
D -damsel
Logged
DariusK
Bulb
*
Posts: 97



View Profile WWW
« Reply #31 on: January 06, 2010, 02:59:41 PM »

Hi Derek,

I found a minor bug in the source code. In the oPlayer1 object, in the Step Event, in the third block of code (the one that covers player damage/death), on line 148 you see the following:
Code:
obj = collision_rectangle(x-6, y-6, x+6, y+7, oSpearsLeft, 0, 0); instance_nearest(x, y, oSpearsLeft);
if (obj)
{
    ...
The instance_nearest is older deprecated code, it should be commented out like you see on line 189, so it looks like this:
Code:
obj = collision_rectangle(x-6, y-6, x+6, y+7, oSpearsLeft, 0, 0); //instance_nearest(x, y, oSpearsLeft);
if (obj)
{
    ...
Not that this *does* anything, but it should probably be cleaned up.
Logged

DariusK
Bulb
*
Posts: 97



View Profile WWW
« Reply #32 on: January 06, 2010, 04:03:18 PM »

And another bug. The panning on the damsel's yell has always been off for me -- when I'm standing to the right of the damsel, I hear her on the right channel, and when I'm standing to the left of the damsel, I hear her on the left channel.

Basically, in this scenario, when she yells, I hear it on the left channel.

 Spelunky Dude      Spelunky Damsel
 Spelunky WallSpelunky WallSpelunky WallSpelunky WallSpelunky Wall

In the oDamsel step function, line 199, we see the following code:

Code:
        if (oPlayer1.x < x) SS_SetSoundPan(global.sndDamsel, -10000);
        else if (oPlayer1.x > x) SS_SetSoundPan(global.sndDamsel, 10000);
        else SS_SetSoundPan(global.sndDamsel, 0);
        playSound(global.sndDamsel);
What that says is, "if the player is to the left of the damsel, pan her yelling sound hard left." (See SS_SetSoundPan, which says at the top of the script that -10000 is full left pan.) Which is what I've observed, and it's the opposite of what we want!

Also, if this isn't the appropriate place to be posting bugs I find in the source code, please let me know!!
Logged

marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #33 on: January 06, 2010, 04:04:25 PM »

I think it woudl be more likely to get a hold of him in the bug area of the forum. it is the reason it exists!
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
DariusK
Bulb
*
Posts: 97



View Profile WWW
« Reply #34 on: January 06, 2010, 04:05:33 PM »

Hm, I see your point but I thought that was for bugs in the game, not in the source code? Anyway, I'll post there, thanks!
Logged

Sudonimus
Mossy
*
Posts: 2743


Stop staring.


View Profile
« Reply #35 on: February 28, 2010, 07:11:39 PM »

People have gotten really serious with Spelunky since the Source...
Maybe if we waited a while...
Logged

How is there no such thing as non-existence?!
Arucard
Mossy
*
Posts: 2810


Hey! Is that CANDY?!?!?

Arucard.Tepes
View Profile Email
« Reply #36 on: March 01, 2010, 06:30:29 AM »

Well regarding this bug specifically, it has been reported numerous times on numerous versions. Most likely it's such a small change Derek either keeps missing it, or is more focused on fixing bigger bugs. And Darius has always been serious about Spelunky's code, he just waited until the source release to talk about it much here.
Logged

Oh, they look like monsters to you?

There's a light in the darkness of everybody's life.
gummybears123
Mossy
*
Posts: 5785


Yummy Gummy!


View Profile
« Reply #37 on: March 01, 2010, 02:29:12 PM »

People have gotten really serious with Spelunky since the Source...
Maybe if we waited a while...

Are you implying we SHOULDN'T make mods?
Logged

I made a rap.
It sounds dumb, like reading a map
I really should stop this thing before it goes too far
But I don't really car as long as I stay below the radar
Those big companies won't get me no
I'll get away before the fuzz show

-Most famous rapper of Mossmouth
Kirbylord
Arucard
Mossy
*
Posts: 2810


Hey! Is that CANDY?!?!?

Arucard.Tepes
View Profile Email
« Reply #38 on: March 01, 2010, 02:38:50 PM »

It sounded to me like he was talking about the bugs, as in wait for Derek to fix them. But the previous post was put up a while back, I'm not sure if he noticed or not.
Logged

Oh, they look like monsters to you?

There's a light in the darkness of everybody's life.
Bae
Mossy
*
Posts: 1696


Pro YoCo strats #AGDQ2014 #GYCL


View Profile
« Reply #39 on: January 31, 2012, 03:43:15 PM »

This dead thread seems like the most appropriate place to ask this

do any of these:

actually get used in the game?
Logged


[0/18]complete

think about it. Zom-bees.
halibabica
Bossy
Mossy
*
Posts: 2118


old guard


View Profile Email
« Reply #40 on: January 31, 2012, 03:52:05 PM »

The sprites themselves don't get used, but there's a copy of them in the Panoramas or something that do.  They're added to the tops and bottoms of blocks, and disappear if you uncheck high details in the config.
Logged

Sometimes I wonder if I like Spelunky too much.
ManTrap mod - Tastes Like Spelunky
Hand-drawn comic - Spelunkying
KarjamP
Mossy
*
Posts: 3684


Meet Miijam!


View Profile WWW Email
« Reply #41 on: May 02, 2012, 09:31:11 AM »

Necro'd just to say that the price on the front page has since been inflated (and also the latest version's now 8.1).
Logged

Meet Bodyless!

3DS friendcode: 4210 - 4681 - 1626



Join Dropbox!

BTC: 1M7MKFdwwrDqqowMUkrCXKhcEi7a16pwWy
Pages: 1 2 [3]
  Print  
 
Jump to: