My TIGSource competition entry: This Cursed Rock

Post your Construct-made creations!

Post » Mon Dec 01, 2008 3:33 pm

Scytos, open a crashing file with the XAudio2 object in Construct, and press Debug All instead of Run all. It should (hopefully) report an error via a messagebox. I just remembered the normal preview silently supresses errors - running a Debug will show you the error messages. If you could paste the error, if any, to me here then I can see what might really be wrong!
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Mon Dec 01, 2008 7:10 pm

Unfortunately the error doesn't seem to be very informative.

"A crash inside a plugin's non-event code has been intercepted! This may be a bug in the plugin, or a problem in Construct. The application has exited.

Plugin: XAudio2.csx
Object name: XAudio2
Instance ID: 0 (of 1)"

Maybe, is there some other program that uses XAudio2 that might give me a better hint on what's going on? I looked around and I couldn't find any.
B
1
G
4
Posts: 9
Reputation: 1,043

Post » Mon Dec 01, 2008 8:22 pm

Humph, I'll make a thoroughly error-checked version soon and send it to you, maybe that will help identify what's wrong.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Tue Dec 02, 2008 5:11 pm

Ashley,

I got some feedback from one of the the players. The sound version was crashing for him, but the no-sound version works fine. Here's his specs:

[quote:2bdkc2ck]Ok! I'm using an HP laptop with:
Vista Home Premium, Build 6001, 32-bit (SP1)
Intel Core Duo T7250, ~2.0GHz
2046MB RAM
NVIDIA GeForce 8400M GS
DirectX 10

Sound card/setup seems to be Realtek Digital Output (Realtek High Definition Audio)[/quote:2bdkc2ck]

It seems the crash was happening for him when the sound was being stopped (upon walking back into the house from the outside, when the front door closes). I too have had a couple crashes with the sound stopping, usually on the menu screen. When selecting the "play" option it crashes sometimes. Only rarely though, and usually if I hit the Z key right away when the menu first becomes available. At that point the volume for the ocean sound is still being adjusted.

I think setting the volume and turning off the sound in the same tick might be what's causing this particular problem. On the screen in question I have a sprite in the center of the room. When another sprite (which follows the screen as it scrolls) overlaps the room sprite, it adjusts the background sound volume.



The event looks like this:

[code:2bdkc2ck]volumeController: Overlaps frontRoomVol
> HouseSound: Set channel 1 volume to -8 dB
> HouseSound: Set channel 2 volume to 1 dB
> HouseSound: Set channel 3 volume to 0 dB
> HouseSound: Set channel 4 volume to 0 dB
> HouseSound: Set channel 5 volume to 0 dB
[/code:2bdkc2ck]

When the player crosses the door boundary it turns the environmental sounds off (the wind/crickets):

[code:2bdkc2ck]Player: Overlaps doorTriggerA
Player: Does Not Overlaps doorTriggerB
System: Trigger once
> door: Set animation to "Closed"
> doorClosed: Set collision mode to Bounding box
> HouseSound: Stop channel 1
> HouseSound: Stop channel 2
> HouseSound: Autoplay resource "doorclose.wav" (No loop)
> doorTriggerA: Destroy
[/code:2bdkc2ck]

So in essence it's setting the volume and turning off the sound in the same tick. I don't know if that's exactly what's causing the crash, but I can run some tests to make sure.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue Dec 02, 2008 5:35 pm

Pretty cool game. I loved the graphics and the ending is awesome. :P

Strangely enough, I didn't have any issues with it despite the fact that I have seemingly random sound crashing issues with the latest version of Construct. :?
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Tue Dec 02, 2008 9:55 pm

This is really cool and extremely well done, I like it a lot.

I do have a question though, may I see how you did the AI? I can't wrap my head around how to do them half as well as you have them.
B
2
S
2
G
4
Posts: 136
Reputation: 1,722

Post » Tue Dec 02, 2008 11:07 pm

Scytos, can you try running this?

http://www.scirra.com/files/xaudio2test.zip

Let me know what messages appear - it's got a prompt at every stage of the initialisation process. Hopefully it'll be able to tell us exactly where things are going wrong for you.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed Dec 03, 2008 2:01 am

[quote="Barri167":2mh8izmo]I do have a question though, may I see how you did the AI? I can't wrap my head around how to do them half as well as you have them.[/quote:2mh8izmo]

Sure, no problem.

Each of the enemies has six parts:



1. The enemy sprite
2. The hitbox (has platform behavior on it)
3. A detector for walls (the black and yellow striped sprite)
4. A detector for the floor
5. An enemy locator (the M is for 'monster')
6. A separate death sprite

The first five items are all in a container together. The only thing not contained is the death sprite. This is so I can show a dead body on the screen, but still have all the unecessary parts destroyed when the enemy is killed.

When I build my level in the Construct layout editor, I don't place enemies. Instead, there's a seventh sprite that spawns everything. It looks like this:



This is the object I copy/paste around the level where I want my enemies to be. Everything else gets a checkmark next to "Destroy on startup."

At the beginning of the layout I spawn all the enemies:

[code:2mh8izmo]+System: For each enemySpawner
-> enemySpawner: Spawn object enemyBox on layer "actionLayer" (image point 0)
-> enemyBox: Start ignoring user input
-> mLocator: Set position to object enemyBox (image point 0)
-> enemySpawner: Destroy
[/code:2mh8izmo]

This creates all the parts needed to run the enemies, and puts the hitbox and locator where the spawning object was. Then it destroys the spawner.

The sprite and detectors get placed on top of the hitbox every cycle, so there's no need to place them here.

Now for the AI:
Each enemy has a variable called "active" that is defaulted to 0. When the enemy is on the screen, this is set to 1. It stays at 1 until either the enemy or the player dies, so the monster can chase you from screen to screen when it sees you.

For the movement, each enemy has the following variables: mySpeed, lastX, lastY. This sets up the speed (capBox is the player hitbox):

[code:2mh8izmo]
+Every 125 MS
-> enemyBox: Add 1 to 'speedTime'
+enemyBox: Value 'active' Equal to 1
+enemyBox: X Greater than capBox .X
+enemyBox: Value 'mySpeed' Greater than -4
-> enemyBox: Subtract 1 from 'mySpeed'
+enemyBox: X Less than capBox .X
+enemyBox: Value 'mySpeed' Less than 4
-> enemyBox: Add 1 to 'mySpeed'[/code:2mh8izmo]

The speed can go from -4 (full speed left) to 4 (full speed right). Notice that we're not setting the speed of the platform behavior directly based on where capBox is, but rather just adding or subtracting a variable. This is so the monster doesn't turn around immediately when you jump over the top. If the monster changes it's X in relation to the player, it takes one full second for the monster to turn around and gain full speed (every 125 ms add 1 from -4 to +4).

But we still haven't actually set the speed yet. There's another variable called "speedMod" that randomizes to give each enemy a slightly different speed, so they don't all bunch together:

[code:2mh8izmo]-> enemyBox Platform: Set speed to (enemyBox.Value('speedMod')+25)*enemyBox.Value('mySpeed')[/code:2mh8izmo]

And this is how we get the speedMod: See the 'speedTime' variable up there? When it reaches 5 this happens:

[code:2mh8izmo]+enemyBox: Value 'speedTime' Equal to 5
-> enemyBox: Set 'speedMod' to random(27)
-> enemyBox: Set 'speedTime' to 0[/code:2mh8izmo]

Dang, that's a lot of info just for one post. We're about halfway done. Here's how to set the direction of the sprite:

[code:2mh8izmo]+enemyBox: X Greater than enemyBox.Value('lastX')
-> monsterSprite: Set angle to 0

+enemyBox: X Less than enemyBox.Value('lastX')
-> monsterSprite: Set angle to 180

+System: Always (every tick)
-> enemyBox: Set 'lastX' to .X
-> enemyBox: Set 'lastY' to .Y[/code:2mh8izmo]

As you might guess, 'lastY' is for setting the jumping and falling animations. I'm sure that's pretty self explanatory. Speaking of jumping, here's how they do it:

[code:2mh8izmo]
+enemyBox: Value 'active' Equal to 1
+enemyBox Platform: is on ground
+enemyWallDetector: overlaps Family Terrain
+System: random(20) Equal to 4
-> enemyBox Platform: Jump
[/code:2mh8izmo]

I added in the randomizer so that they don't just immediately jump when they hit the wall. Like the change in speed and direction I wanted it to look a little more natural, like they were thinking about it or something.

Resetting and killing enemies:
When the player dies, his position is set to the last eye stone that he touched. At the same time, there's a loop that sets each enemy to the mLocator sprite in it's container (that was set back when they spawned at Start of Layout). Then the 'active' value for enemyBox is set to 0 again so they don't just run around the level willy-nilly.

When they're killed, the blinking "hit" animation is played. When the animation is finished (and only if the enemy is on the ground) then a dead monster sprite is spawned and the enemyBox is destroyed. Destroying the enemyBox destroys all the other objects in the container. And that's about it.

I didn't cover animations really, so if you want to know how that's done let me know. Though I will be putting this kind of information in my Platform School tutorial, so if you can wait until then that's cool too.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Dec 03, 2008 10:16 am

I just played the third Construct entry in competition. Afterlife Consequences.

It's pretty bad. Even the creators admit that it's pretty bad. The person in charge of making the game apparently decided to start using Construct at the beginning of the competition, so he had no idea what he was doing. The results definitely reflect this fact.

What makes me a little sad is how he's constantly bagging on Construct the whole time, like it's Construct's fault he's made a bad game. He also states that Construct is just an "insane wall of bugs." He only mentions a couple of bugs in the thread, only one of which he posted about here in the Help forum, which was already a known issue and he actually found a fix for it anyway (the other is the IDE crashing when editing sprites... sounds like a hardware issue to me). The rest is just design issues... he's complaining about animation and hitbox problems that aren't actually bugs and are easily remedied, and all he had to do was ask. Hell, he didn't even have to ask... there are plenty of threads that talk about hitboxes and animation already.

Sigh. When scytos mentioned there was a third Construct entry, I had some higher hopes for it than this. Oh well.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Dec 03, 2008 2:28 pm

[quote="deadeye":like810r]I just played the third Construct entry in competition. Afterlife Consequences.

It's pretty bad. Even the creators admit that it's pretty bad. The person in charge of making the game apparently decided to start using Construct at the beginning of the competition, so he had no idea what he was doing. The results definitely reflect this fact.

What makes me a little sad is how he's constantly bagging on Construct the whole time, like it's Construct's fault he's made a bad game. He also states that Construct is just an "insane wall of bugs." He only mentions a couple of bugs in the thread, only one of which he posted about here in the Help forum, which was already a known issue and he actually found a fix for it anyway (the other is the IDE crashing when editing sprites... sounds like a hardware issue to me). The rest is just design issues... he's complaining about animation and hitbox problems that aren't actually bugs and are easily remedied, and all he had to do was ask. Hell, he didn't even have to ask... there are plenty of threads that talk about hitboxes and animation already.

Sigh. When scytos mentioned there was a third Construct entry, I had some higher hopes for it than this. Oh well.[/quote:like810r]

Well.. I don't really mind that he calls Construct buggy, he did encounter an annoying bug. What would be better is transferring the criticism into bug reports - which he has done with one bug, and it got fixed. Hopefully with more of these reports we can change Construct from an 'insane wall of bugs' into a rose scented stallion.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

PreviousNext

Return to Your Creations

Who is online

Users browsing this forum: No registered users and 1 guest