Scripting example level

Source Code and development in general from a technical point of view. Post Patches here.

Moderator: SMC Team

Scripting example level

Postby Quintus » 07 Apr 2014 19:45

Hi there,

DarkAceZ asked for an example level using scripting, so I made one. You can find it attached; to view the script code, open the level file and scroll to the end. The stuff between <script> and </script> is the script code. Be sure you have the latest Git from today before you try it!

There are four things to notice in this level:

  1. Right at the beginning, you will find a switch. To activcate, jump on it -- this will unblock the path in front of you. Note that my collision checking in the script is not ideal, so if it doesn’t work immediately, try jumping on it not from straight above, but while moving in bottom-right direction.
  2. Defeating the black furball will not end the level, but make a climbing plant appear.
  3. Above the battle place, you will find an enemy spawner that generates furballs. You can stop it by activating the switch on top of it.
  4. Go past the final edge near to the level exit to find out what the fourth thing is :-). This is my favourite :-)

The timers don’t work right yet, so you might get a segfault on level exiting or observe weird behaviour of the furball spawner when you enter the menu. The timer functionality is unstable currently.

This only scratches the surface of what is possible with scripting. There are endless possibilities.

Valete,
Quintus
Attachments
scripting_test.smclvl
Test level with scripting.
(395.86 KiB) Downloaded 209 times
Come to our fork of SMC: https://secretchronicles.org
Quintus
SMC Team
SMC Team
 
Posts: 354
Joined: 14 Sep 2010 18:05

Re: Scripting example level

Postby -DarkAceZ- » 09 Apr 2014 22:33

Very nice, thanks!
One of the first things I thought of when I heard about scripting was enemy spawners. Yours, by the way, creates furballs walking backwards, until the run into something. :P Not sure why they do this though, it looks like you set the direction correctly...
Thanks for the example, I'm now making my own levels with scripts. :) Hopefully I can include them in the new world for SMC 2.0.
User avatar
-DarkAceZ-
Maryo small
Maryo small
 
Posts: 1063
Joined: 28 Oct 2010 17:24
Location: The Level Editor

Re: Scripting example level

Postby Quintus » 21 Apr 2014 11:28

So, here’s another level using some scripting. This time, it is a "real" level, not just something put together for testing. Not an easy one, and I’ve still to figure out how to properly test for the pow activation. Just wildly jump on these switches if they don’t want to activate...

The level uses some stuff I’ve recently added to Git, so you want a build from today. It is quite hard (especiall the big lava room), but it is beatable. By the way, do we have some clock ticking sounds in the forums? I made a time-based switch, but it seems SMC currently has no sound usable for that so I resorted to displaying a message (every scripter should know Level#display_info_message!). With a clock sound, one could utilize a repeating timer to play it, so one could even play it faster when time is about to run out.

Pipe entries/exists are not ideal yet, but I’m currently too lazy to fix this up in the level (it’s not a code thing, the pipes are mostly passive).

Have fun playing it!

Vale,
Quntus
Attachments
quintus_1.smclvl
(893.29 KiB) Downloaded 195 times
Last edited by Quintus on 02 Jun 2014 15:37, edited 1 time in total.
Come to our fork of SMC: https://secretchronicles.org
Quintus
SMC Team
SMC Team
 
Posts: 354
Joined: 14 Sep 2010 18:05

Re: Scripting example level

Postby -DarkAceZ- » 23 Apr 2014 01:57

Quintus wrote:So, here’s another level using some scripting.

Very nice! I especially like the blocks that are on a timer, even if there are too many gees in the area... :P
I found a (graphical) glitch in that area, too, check it out:
Code: Select all
https://dl.dropboxusercontent.com/u/22806246/Screencaps/smc-1.png
//no embedding because it's huge

The gees still draw their particle effects when their main body sprite isn't visible. (I didn't notice that embedded snail shell until after I screen'd it, lol)

Even ignoring the sweet scripting, you're a great level designer, Quintus. Very nice assortment of objects/tiles. :moon:
User avatar
-DarkAceZ-
Maryo small
Maryo small
 
Posts: 1063
Joined: 28 Oct 2010 17:24
Location: The Level Editor

Re: Scripting example level

Postby Quintus » 23 Apr 2014 11:21

DarkAceZ wrote:I found a (graphical) glitch in that area, too, check it out:

I’ve seen this as well. It’s not necessaryly a glitch. The Gees are well present and active (you can be hit by them!). This is caused by calling Gee#hide in the script, which removes the sprite from the game, but leaves the enemy there. I originally thought that calling #hide would make the entire thing disappear, but it obviously doesn’t. Thinking about it, I came to the conclusion that this is not a bug, but a feature! :-)

Entirely removing an object from gameplay seems to be a question of calling Set_Active() on the C++ object, which has not yet been bridged to mruby. I will add this to make it available for you, and probably change the semantics of the ::new methods to automatically show a sprite, but not set it active. So be prepared for having to change your level scripts accordingly. Hey, that’s the risk of following a highly fluctuative development version :-)

DarkAceZ wrote:Even ignoring the sweet scripting, you're a great level designer, Quintus. Very nice assortment of objects/tiles. :moon:


Thank you. I’m still thinking about what one could now do with the scripting in place... Too many possibilities, I can’t decide what to do :-P

<Slight OT>The scripting documentation site had a problem of not being regenerated due to branches having been renamed. I fixed this, so you now get daily regenerated docs from the current devel branch again.</Slight OT>

Vale,
Quintus
Come to our fork of SMC: https://secretchronicles.org
Quintus
SMC Team
SMC Team
 
Posts: 354
Joined: 14 Sep 2010 18:05

Re: Scripting example level

Postby Quintus » 14 May 2014 17:51

I made another level. This one is of medium difficulty and should be quite enjoyable. To receive the final bonus at the end you must collect the 8 red coins.

This level uses quite a lot of scripting and I’m proud to say it works and does not crash.

You need today’s git (that is, at least commit 2e8192ceedc36cdaa36a3cd704608e4b838a57a5) for this level to work, I added a few missing features and fixed a bug with mutliple-use boxes.

Valete,
Quintus
Attachments
quintus_3.smclvl
(644.58 KiB) Downloaded 183 times
Last edited by Quintus on 02 Jun 2014 15:38, edited 1 time in total.
Come to our fork of SMC: https://secretchronicles.org
Quintus
SMC Team
SMC Team
 
Posts: 354
Joined: 14 Sep 2010 18:05

Re: Scripting example level

Postby -DarkAceZ- » 16 May 2014 03:41

Quintus wrote:I made another level.

Beautiful! :)
I feel like recording some gameplay from these levels and putting them together in a small example for Youtube... Does anyone know any good video editing software for Linux?
User avatar
-DarkAceZ-
Maryo small
Maryo small
 
Posts: 1063
Joined: 28 Oct 2010 17:24
Location: The Level Editor

Re: Scripting example level

Postby Quintus » 16 May 2014 06:35

-DarkAceZ- wrote:
Quintus wrote:I made another level.

Beautiful! :)
I feel like recording some gameplay from these levels and putting them together in a small example for Youtube... Does anyone know any good video editing software for Linux?


Currently, I’ve settled on Kdenlive for video editing, but I heard OpenShot has improved drastically over the last half year. I think a video would be very nice, this way people who don’t compile current Git get an impression of the upcoming SMC.

Btw. did you manage the 8 coins? To reach the one behind the yellow brick blocks you had to figure a bit :-)

Vale,
Quintus
Come to our fork of SMC: https://secretchronicles.org
Quintus
SMC Team
SMC Team
 
Posts: 354
Joined: 14 Sep 2010 18:05

Re: Scripting example level

Postby -DarkAceZ- » 16 May 2014 13:58

Quintus wrote:Btw. did you manage the 8 coins? To reach the one behind the yellow brick blocks you had to figure a bit :-)

Yeah, I got them all. I think what we need for object counters, though, is a function that shows an image/some text constantly on the screen... It would be handy for keeping red coin counts or how much time you have left on your timer before your blocks disappear. :P
User avatar
-DarkAceZ-
Maryo small
Maryo small
 
Posts: 1063
Joined: 28 Oct 2010 17:24
Location: The Level Editor

Re: Scripting example level

Postby Quintus » 16 May 2014 20:57

-DarkAceZ- wrote:
Quintus wrote:Btw. did you manage the 8 coins? To reach the one behind the yellow brick blocks you had to figure a bit :-)

Yeah, I got them all. I think what we need for object counters, though, is a function that shows an image/some text constantly on the screen... It would be handy for keeping red coin counts or how much time you have left on your timer before your blocks disappear. :P


We can have that, definitely. Should not be too hard to create a sprite subclass for this and expose it to the scripting interface. It could be placed in the HUD (the lines of information on top of the screen) with a configurable icon and text, if I manage to create enough space there for such a thing. Otherwise it would have to go in the lower left or lower right corner.

Vale,
Quintus
Come to our fork of SMC: https://secretchronicles.org
Quintus
SMC Team
SMC Team
 
Posts: 354
Joined: 14 Sep 2010 18:05

Re: Scripting example level

Postby Quintus » 02 Jun 2014 15:39

I have edited my previous postings and fixed the big levels to work with current git (commit 8a01b22e8a1b736e50772cf1f381997498956456).

Vale,
Quintus
Come to our fork of SMC: https://secretchronicles.org
Quintus
SMC Team
SMC Team
 
Posts: 354
Joined: 14 Sep 2010 18:05


Return to Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron