Creating Your Own Scripting System
#1
CREATING YOUR OWN SCRIPTING SYSTEM
by DerVVulfman


Greetings and salutations dear readers. Some of you may know me. Some may not. However, those that do know me or my works from 2006 to 2009 in the RPGMaker XP community will know me as a scripter, or coder for the RPGMaker XP and VX systems.

What I intend to impart are some words of wisdom to those ambitious enough in our community who intend to create their own RPGMaker system. In doing so, they will likely wish to include a feature to allow the users of their system to modify the in-game mechanics. This feature is typically referred to as a scripting system.

This should no way be interpreted as doctrine, but some helpful suggestions. Nor am I advocating any principle language (Ruby, C+ or Basic) over any other base language.

TAKE YOUR TIME.
This should be pretty self explanatory. If you are familiar with the RPGMaker VX system, you are probably aware of the numerous bugs that were evident in the code that have been repaired by coders like Yeyinde (formerly Meisme of RMXP.Net) and others. Many among the community that saw the in-game default scripts felt that the default scripts were rushed. It was true that some design aspects were superior to the previous RPGMaker XP system in how they structured the code for the end user. However it was the actual scripting code itself that had a number of bugs.


MAKE IT EASY TO READ
I can't emphasize this enough, but formatting your code and adding plenty of comments throughout your default scripts is a must. It is good for scripters to format their code properly though some may neglect this practice. It is unknown whether you are a scripter, an artist, or just a regular guy/girl who is reading this. But designing the scripts so they are legible for the end user is a true requirement.

As an example, let me refer to the RPGMaker SDK by SephirothSpawn, Trickster and the SDK crew:
Code:
#------------------------------------------------------------------------------
  * 4.1 - Commenting

  Scripts must begin with the following header :

#==============================================================================
# ** Script Name
#------------------------------------------------------------------------------
# Your Name
# Version
# Date
# SDK Version : (SDK Version Number) - Parts #s
#==============================================================================

  All classes and methods must have a comment describing the process or what
  was added. All code added to methods that can not be aliased must be
  formatted as follows:

  #----------------------------------------------------------------------------
  # Begin Script Name Edit
  #----------------------------------------------------------------------------
  [Code]  
  #----------------------------------------------------------------------------
  # End Script Name Edit
  #----------------------------------------------------------------------------

  Single line comments should precede the described block of code and should be
  indented at the same level. Code that is not self-documenting should be
  commented.
  
  However, very short comments can appear on the same line as the described
  code, but should be shifted far enough to separate them from the statements.
  If more than one short comment appears in a chunk of code, they should all be
  indented to the same tab setting. Attribute declarations should always have a
  trailing comment.

Of course, this was specifically written in the RMXP SDK, but you should be able to see how a standardized comment system would benefit any end user.

Also, you should think about having optional 'language' packs to change the comments/instructions in the default scripts. Just a thought. ^_^


THE SMALLER THE BETTER
Break up your default code into smaller and smaller modules whenever you can. For those that are familiar with the default RPGMaker XP scripts, you will be familiar with the lengthy 'main' methods in all the 'Scene_' scripts. They are huge and cumbersome. If you wanted to change or add a feature to one of these 'Scene' scripts, you may need to rewrite the entire 'main' method to achieve what you wanted.

However, designing your default code to be more modular and streamlined can allow your end user to modify without having to rewrite anything, or limiting rewrites to a bare minimum. Again, if you are familiar with the default RPGMaker XP 'main' methods, take a look at the 'main' method used by the RMXP SDK below:

Code:
def main
    main_variable                 # Main Variable Initialization
    main_spriteset                # Main Spriteset Initialization
    main_sprite                   # Main Sprite Initialization
    main_window                   # Main Window Initialization
    main_audio                    # Main Audio Initialization
    main_transition               # Main Transition Initialization
    loop do                       # Scene Loop
      main_loop                   # Main Loop
      break if main_break?        # Break If Breakloop Test
    end                           # End Scene Loop
    Graphics.freeze               # Prepare for transition
    main_dispose                  # Main Dispose
    main_end                      # Main End
  end

This shows how clean the default main methods could have been if it was designed in a more modular fashion. Many lessons can be learned by examining the RMXP SDK itself when working on your scripting code in how your default script code should be designed.
Reply }
#2
I'm no scripter, but I can tell a script (or scripts) that have been neatly coded and one that has not. I like to tweak scripts and make them work with each other, and since it is sometimes hard to find talented scripters to do this for me, I've had to adapt and overcome this by learning a thing or 2.
Scripts are much like any product one wishes to put out there. You're putting your name on it and you should attempt to put the best product you can. Sloppy headers, poorly coded, and little to no comments make it hard for experienced scripters to decipher, let alone people who just want to tweak it a bit.
I've rambled a bit and I will get to my main point: DerVVulfman is correct in saying that taking your time is extremely important. Neatly coded and easily accessible codes are a must, especially if you want to make money off your product. Take pride in what you are doing Laughing
Reply }
#3
@Alpha-Mad
Um, why do you care about that?
i just want your product to work for me, nothing else!
what you are saying is that you want to take someones work and turn it into your own, if you want to do that then i say "figure it out on your own".
Reply }
#4
computerwizoo7 Wrote:@Alpha-Mad
Um, why do you care about that?
i just want your product to work for me, nothing else!
what you are saying is that you want to take someones work and turn it into your own, if you want to do that then i say "figure it out on your own".
DerVVulfman is referring to making a scripting system that is neatly coded and organized. Since we, as game makers, edit or create scripts that use this system, it's a must to make them this way. I'm not saying a make scripts "my own" but I do customize them in ways they probably weren't meant to be so that they are compatible with each other. Nicely organized scripting systems helps the user out greatly, and makes the product more desirable.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Ruby Scripting kyonides 24 20,523 04-16-2024, 06:57 AM
Last Post: kyonides
Wink  RPG Developer Bakin: The Active Timed Battle System Tutorial JayRay 0 1,470 01-09-2023, 04:36 AM
Last Post: JayRay
   Creating a Proper Game Doc United Washcloth Express 2 6,809 02-22-2010, 11:33 PM
Last Post: Ace
   Creating a perfect storm MagitekElite 0 3,841 02-17-2010, 07:07 AM
Last Post: MagitekElite
   Creating a Custom Window by RPG Advocate DerVVulfman 0 3,986 03-11-2009, 06:49 PM
Last Post: DerVVulfman
   Creating Believable Characters ccoa 0 4,290 12-06-2008, 05:13 PM
Last Post: ccoa
   How to make interesting NPC's without scripting Third333Strike 0 3,879 12-06-2008, 04:59 PM
Last Post: Third333Strike
   Summoning System Tutorial Hebi Kumo 0 3,869 11-08-2006, 01:52 PM
Last Post: Hebi Kumo



Users browsing this thread: 1 Guest(s)