Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Open Forums » JCS & Scripting

Angelscript for dummies?

Lark

JCF Member

Joined: Jan 2002

Posts: 1,564

Lark has disabled reputation

Jan 11, 2016, 09:18 PM
Lark is offline
Reply With Quote
Angelscript for dummies?

Hi sorry guys, stupid question, but WHAT IS ANGELSCRIPT? I take breaks from JJ2, and I come back and you can use the mouse and have customized weapons and pickups and stuff??? What the hell is my life here. What happened to JJ2? Oh, and while you're at it, can somebody show me a really cool level that uses it hardcore? Like a good one, ya know, OLC or CLM quality


edit sldkfjdf : PS please don't link me to the other thread. Yes I saw it. Yes it went in one ear and out the other (no I didn't use my ears to read it, I'm just a magician). you guys love me anyways. RIGHT?
__________________
=D
Borgia Borgia's Avatar

JCF Member

Joined: Dec 2014

Posts: 98

Borgia is doing well so far

Jan 11, 2016, 10:15 PM
Borgia is offline
Reply With Quote
I don't know if this classifies as hardcore, but it shows one of many possibilities of AngelScript:

Mighty Switch Test, by VioletCLM. You can click on the .j2as-file to get a preview of the document. That'll show you the lines of code used in this particular project.

Basically, AngelScript is a tool that, as the name implies, allows you to script events and things and magic and do the things you could never hope to achieve in JCS. It adds another dimension to JJ2, and offers possibilities I can't even imagine.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,991

Violet CLM has disabled reputation

Jan 11, 2016, 10:28 PM
Violet CLM is offline
Reply With Quote
I think that's a fair question. I'll try to use some words to answer it. (Mouse usage is partially separate from AS, though--you can interact with the mouse in it, but if you're thinking of being able to aim bullets with the mouse instead of by looking left/right/up, that's a separate JJ2+ feature, just like chat commands or green/yellow teams or new MP gamemodes.)

Technically AS is a scripting language, analogous to C or C++, but what we mean when we say "angelscript" is really a) the way JJ2+ runs it (primarily the hook functions) and b) the things it can do (the API). In reality the two categories are actually kind of isomorphic, but that fact isn't always as clear as it could be, because we didn't do the greatest job of designing the thing.

I'd tentatively say AS usage falls into three patterns, each with its own (largely independent) sets of hook functions and API details:
  1. Reacting to something that happens in the game. Think about events like Trigger Zone or Warp or Set Light: when you touch this tile, something happens! This is the probably the simplest kind of AS at a conceptual level, and it was (coincidentally?) the first kind to be implemented. If a Warp event says "Warp this player to Warp Target 0," you can use AS to say instead "Warp this player to Warp Target 0 if they're Jazz, or Warp Target 1 if they're Spaz." Or instead of caring which rabbit, maybe the level cares which CTF team they're on. Or maybe entering a new area should change the current music file in addition to changing the ambient lighting. Such examples take very little code to implement but can have a huge impact on how (well) a level works.

  2. Altering a basic fact about the game. There are a lot of things that, if we'd had complete power, should probably have been implemented as level options in some JCS window or other. That wasn't possible. But you can do that stuff in AS instead, and even alter it again later in the level if need be. You can decide that you want players to be able to carry only 15 Seeker bullets instead of 50. Or: RFs should fire only a single missile at a time. Or: Jazz should use a double jump instead of copter ears. Or: Water should be drawn in front of layer 2 but behind layer 1, so that some foreground tiles don't get distorted.

  3. Adding new content entirely. This comes in various forms--new weapons, new enemies, new sprites, new behaviors for old enemies with old graphics, whatever. This tends to take a whole lot of code (or artwork, depending) because there's so much to define, it's not just a question of setting some specific integer property and calling it a day.


Is that what you're asking, or am I totally off-base? (Probably the latter; I just got off from having entirely the wrong conversation and my head is likely still a bit muddled.)

As for "cool levels" that use AS "hardcore," I'm wary of that kind of recommendation because there's a certain art to this... the more AS you add to something, the more you run the risk of losing the core JJ2 gameplay, and at that point it becomes less clear why you're using JJ2 to begin with. Apart from as a personal challenge. But you could take a look at my latest—it gets kind of complicated later in the level (and ended up requiring more lines of code than I'd hoped), but the basic gameplay concept is very easy to understand. You can almost pretend it's all about trigger scenery. EDIT: Borgia agrees apparently.

Anyway, from what I've seen in "the other thread," I think the biggest problem people have when learning AngelScript is figuring out what they want to do... or at the least, how to express what they want to do, because we're not mindreaders. :# Let's say someone wants this: "Winning my new SP level should require the player to defeat every enemy before the time limit runs out." They come to the other thread, and may get questions like these:
  • Are there regenerating enemies like the bats in Castle? If so, how should those be treated?

  • If the player dies, how does that affect the count of which enemies have or haven't been defeated? Are there checkpoints? How do they interact with this system?

  • How is the time limit shown to the player?

  • How is the defeated enemy count shown to the player?

  • What happens if the time limit runs out and not all the enemies have been defeated?

Once all those questions have been answered, it becomes possible to provide code (or hints for how the person can write the code themselves) to make all those things happen. But writing code requires that you know what you want code to do. And if you can think of all those questions I listed yourself, you've won; you may not know how to do everything in detail, which takes research and practice, but you've got the mindset figured out.
__________________

Last edited by Violet CLM; Jan 11, 2016 at 10:48 PM.
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 866

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Jan 12, 2016, 02:01 AM
Seren is offline
Reply With Quote
More hardcore AngelScript level recommendations:
Single Player: Ozymandius, Rocket Powered Rabbits, Tweedle Wheedle
Multiplayer: Decimation (battle), Towerfall (battle), The Paint Game (domination spin-off), Jazzopoly (board game)
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.
Old Jan 12, 2016, 03:46 AM
Stijn
This message has been deleted by Stijn. Reason: nevermind
Blaze The Movie Fan

JCF Member

Joined: Mar 2004

Posts: 769

Blaze The Movie Fan has disabled reputation

Jan 12, 2016, 10:45 AM
Blaze The Movie Fan is offline
Reply With Quote
You're not alone, I'm new to the AngelScript thing as well.

And thank you, Violet CLM your post is very useful.
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT -8. The time now is 09:11 AM.