Asset - Extension Stream *NEW ASSET*

ZeDuval

Member
# Introduction

Stream
provides a completely new way to structure your code. It allows you to manage an object and all of its events in one script. If you ever thought something along the line of "Man, it would be nice if I wouldn't have to wage this war against the GM IDE...with object-windows that need to stay open...the handling of too many open windows at the same time, wait, which window belongs to which object, I can close this object, right?! NO! GODDAMMIT!" - this asset might be just your kind of best new friend!

What's so nice about it?
  • You don't have to dig through an object's events, jumping from one event-code-window to the next
  • You don't need to use several scripts for one object, which gets sooner or later out of hand
  • You can directly access all code from the tree-view and use the search
  • Stream adds objects to the assets that can be handled by using an external coding IDE
  • Provides a way better overview over the individual events as a whole, which makes sense since often several events intertwine like gear wheels.
  • ...
In the end it's a matter of personal preference, but I guess I'm not alone with the wish to handle objects like this. Before I explain how to use this asset...

# Example

How does it look like? This is an example how a script for an object could look like. I added some flavor 'cause you code with your eyes first!



What you see here is a script called _o_dice, which contains a switch/case over the Macro EVENT, which is composed of several cases based on further Stream-built-in-Macros. In line 4 is a case that will never be executed, it's just an idea to lodge all objects relevant to this script, so that you can middle-mouse-button-click on them for quick access.


# Basic Information

All event-macros begin with an uppercase EV+underscore to seperate them from the GM-built-in-constants. Then follows the event-name in Titlecase, just like the events are displayed in the event-list within an object(spaces replaced with underscore). Just type in EV_ to see the auto-completion-list or check out the extension itself. There are only a few async events missing because I could not trigger them and so I wasn't able to get their event-ids.


# Basic Usage

  1. In the Room Creation Code, in the Create-Event of your main-controller-object or in your init-script - wherever you initialize other assets, global variables and enums, use
    Code:
    stream_init("os_");
    to initialize this asset! The argument provided to this function, which must be a string-value, defines the prefix of all object-scripts.
  2. Create a new object, for example obj_hero.
  3. Add all events the object should have to the object's event-list.
  4. In every single one, add one Execute Code Block, containing
    Code:
    stream();
    and nothing else.
  5. Create a new script with the name being the combination of your chosen prefix and the object-name, in this case os_obj_hero.
  6. Build the switch/case, containing the events you added to the object, yourself or use the supplied object-script-template as a base to expand on.
  7. Try and see if it works - and if not come here and we'll solve the problem!

# Of Course

...I'll be happy about every review, comment, suggestion, bug-report - you call it. I'm excited about your opinions!
PS: The HTML5-Module is not yet supported, though this is point 1 on the agenda.

Click on the Stream - Logo at the top of this page to get to the Marketplace Asset Page.

Tested for following export modules: Windows, Windows(YYC).
 

ZeDuval

Member
@Mike It's been down for quite a while. I recently made some big changes and will republish the whole thing in the not-so-distant-future. I'll prepare a WIP-zip this evening when I'm back from work and send you a link. :)
 

Mike

nobody important
GMC Elder
Don't worry... I was just browsing. Not sure I'll ever manage to even get time to look at it! :)
 

Coded Games

Member
This is really interesting, definitely could see it being useful if you have a lot of little objects and don't want to spend forever clicking around. Does it have any noticeable loss in speed making object this way over the normal way?

Unfortunately I only make HTML5 games so I wouldn't get much use out of it right now.
 

ZeDuval

Member
This is really interesting, definitely could see it being useful if you have a lot of little objects and don't want to spend forever clicking around.
Funny that you say that, because I use it primarily with a hand full of rather big controller-objects!
Does it have any noticeable loss in speed making object this way over the normal way?
That's a good question and I really don't know why I didn't do any speed/performance tests by now. Will do so after a few things are finished!
Unfortunately I only make HTML5 games so I wouldn't get much use out of it right now.
What does the platform have to do with it? However, to be honest - right now this asset won't work in the HTML5 module because all events have different values. But I will add HTML5 support eventually.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
I've been using a similar pattern for small various small cases (weapons, dialogue actions, etc.). When it's for objects, may as well have a switch on event_type directly (with sub-conditions).

I think what I'm the most curious about in the screenshot shown is what "Access" variable does, as the expression would compile as ((class_meta >> class_rect) > o_dice), therefore taking value of true or false.
 
Top