Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Using the SDK - In-Depth

Some people get confused of the SDK. Its not some monster thats trying to eat your scripts, no, its more like an angel that makes it esier for you to make compatible scripts.

The SDK Module also has some usefull things like Auto-Writing credits, event reading and turning off/on scripts.

In this tutorial I will try to explain how to use the SDK, how converte scripts and how to custimize the SDK to your needs. It won't be easy for me to explain since SDK is pretty much self-explonatory so cirticsm is ok and expected ;).

What is SDK?

SDK can be broken in to two parts;
  • SDK Module - Makes some diffucult commands easy to use.
  • SDK Script Overwrite - It rewrites some scripts in the database to increase compability and performance, if used the right way.

Mostly people have compatiblity issues with the SDK script overwrite. Why?
Like I said before it overwrites some commands in the script database.
Here is a list of commands that are rewritten in the SDK;

Code:
[COLOR=SeaGreen]    Game_Map - setup
    Game_Map - update
    Game_Character - update
    Game_Event - refresh
    Game_Player - update
    Sprite_Battler - update
    Spriteset_Map - initialize
    Spriteset_Map - update
    Scene_Tile - main
    Scene_Map - main
    Scene_Map - update
    Scene_Save - write_save_data
    Scene_Load - read_save_data
    Scene_Menu - initialize    
    Scene_Menu - main
    Scene_Menu - update & command input
    Scene_Battle - main
    Scene_Battle - update
    Scene_Battle - update_phase3_basic_command 
    Scene_Battle - make_basic_action_result[/COLOR]
Before we contuniue, read a tutorial on Alias;
http://www.rmxp.org/forums/showthread.php?t=5698

Thats what the SDK is for ;)
Using the SDK
When you are making a script, you often need to refer to RMXPs default classes. The most refered default classes are;

Game_Player
Game_Character
Scene_Map

The most overwritten classes are;

Scene_Battle
Scene_Map
Game_Character
Scene_Menu

Every time you overwrite a class, you decrease the chance of compability with other scripts, not only the SDK ;).

Thats where SDK comes in to help. SDK Script Overwrite part of the SKD breaks methods(functions or defs) in to sections and parts. Lets observe Scene_Map for a sec;

This is method main in Scene_Map(non-sdk);
Code:
[COLOR=SeaGreen]  #--------------------------------------------------------------------------[/COLOR]
 [COLOR=Blue] def[/COLOR] main
[COLOR=SeaGreen]    # Make command window[/COLOR]
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Save"
    s6 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
    @command_window.index = @menu_index
    [COLOR=SeaGreen]# If number of party members is 0[/COLOR]
    [COLOR=Blue]if[/COLOR] $game_party.actors.size == 0
      [COLOR=SeaGreen]# Disable items, skills, equipment, and status[/COLOR]
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    [COLOR=SeaGreen]# If save is forbidden[/COLOR]
    [COLOR=Blue]if[/COLOR] $game_system.save_disabled
     [COLOR=SeaGreen] # Disable save[/COLOR]
      @command_window.disable_item(4)
[COLOR=Blue]    end[/COLOR]
   [COLOR=SeaGreen] # Make play time window[/COLOR]
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 224
   [COLOR=SeaGreen] # Make steps window[/COLOR]
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 320
   [COLOR=SeaGreen] # Make gold window[/COLOR]
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
   [COLOR=SeaGreen] # Make status window[/COLOR]
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
   [COLOR=SeaGreen] # Execute transition[/COLOR]
    Graphics.transition
    [COLOR=SeaGreen]# Main loop[/COLOR]
    loop [COLOR=Blue]do[/COLOR]
    [COLOR=SeaGreen]  # Update game screen[/COLOR]
      Graphics.update
      [COLOR=SeaGreen]# Update input information[/COLOR]
      Input.update
      [COLOR=SeaGreen]# Frame update[/COLOR]
      update
     [COLOR=SeaGreen] # Abort loop if screen is changed[/COLOR]
[COLOR=Blue]      if [/COLOR]$scene != self
[COLOR=Blue]        break
      end
    end[/COLOR]
    [COLOR=SeaGreen]# Prepare for transition[/COLOR]
    Graphics.freeze
    [COLOR=SeaGreen]# Dispose of windows[/COLOR]
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
[COLOR=Blue]  end[/COLOR]
Do you see that big mess??

Now this is the SDK version;
Code:
  [COLOR=Blue]def[/COLOR] main
    main_draw    
    [COLOR=Green]# Main loop[/COLOR]
    loop [COLOR=Blue]do[/COLOR]
      main_loop
      break if main_scenechange?
    [COLOR=Blue]end[/COLOR]
    main_dispose
    main_tiletrigger
  [COLOR=Blue]end[/COLOR]

Now do you see the difference? The SDK just broke it into smaller parts, this increases compability. Because now you can alias esier. No need to overwrite anything.

Lets say you want to make a hud;
Firs you look at what you need to edit.

A hud is made of a cauple of windows and it appears on the map. So we need to use Scene_Map.

Usually you would need to edit Scene_Map directly. But with the SDK you don't need to. Lets say we already have the window for the hud called @hud_window.

Usually you want to do 3 things with a window;

Call
Update
Dispose

In the SDK, go to Scene_Map > def main, you see cauple of method calls;
  • main_draw - Used to call the windows.
  • main_dispose - Used to dipose windows.

Now, still in the SDK, go to Scene_Map > def update, there is one method we can use there;
  • update_graphics - updates the windows and sprites

If you know how to alias then you know whats coming next. Now all you need to do is aliase with those controls. No need to over write anything.

In this lesson we learned to think of what need before we code, and how SDK can help us increase compability and why and how it does that.

How to Converte Scripts;
To converte scripts we use the same method as before. Converting long scripts can be a pain, so that why you need notepad to help you make a list.
What list you ask?

As we said before the SDK replaces most methods and thats why it incompatible with other scripts, because scripts are usuall poor coded(no offense to anyone).

In the script you are looking to converte, see if it refers to any method or classes that is in the SDK and add it to your list.

After that go to the SDK and see what methods you can use to improve compability and convert the script.

For example, we are trying to converte an Hud script;

Look at the hud script, and lets say it is overwriting Scene_Map > Main. Now go to the other Default Scene_Map and compare the 2. By comparing you should be able to tell whats new and whats not.

Cut everything new in the method and paste it to an empty script. Now we look at the code. What does it have?(in this case, same as the Hud from the previous tutorial)

It calls the window and it disposes it.

What are the methods in the SDK you can aliase with to do this?
Thats right;
  • main_draw
  • main_dispose

Now just aliase with them in the script you are converting. Its that simple.

I hope that helped.

Thats is. I hope that helped. Can't say i didn't try ;)
 
thx for the comment. I acidently gave the wrong example, I used Scene_Menu instead of Scene_Map but it still proves my point lol.
 
Shark said:
Some people get confused of the SDK. Its not some monster thats trying to eat your scripts, no, its more like an angle

An angle? lol
Btw nice Tutorial Shark, hope you continue in this kind of tutorials, it realy helps newbys!
 
Oh but it a monster I saw. It eat's them, consumes their power to use as it's own. :lol:

Good Work Sharktooth. Once I get some free time, I will read into this and try to see if I can't add a few things here and there.
 
SephirothSpawn said:
Oh but it a monster I saw. It eat's them, consumes their power to use as it's own. :lol:

Good Work Sharktooth. Once I get some free time, I will read into this and try to see if I can't add a few things here and there.

That would be nice.

@chaosg1

Don't make fun of my spelling lol. Its suppose to be an "angel". I'll edit now.
 

Aran

Member

Doesn't the SDK feature finding events? i only skimmed, but i don't recall seeing it. perhaps you could go into detail w/ that?
 
hmm, I daupt I would explain the Developer tools that comes with it... Too lazy. Maybe later, I have the flu right now.
 

arev

Sponsor

@SS: finding an event - finding the current location of this event. f0tz! has it in his pixelmovement, thoug Near's pathfinding could easily do it on the default grid by calling pathfindig with coordinates taken from an event of specific id.
 
... Its easy

for event in $game_map.events.values

end

you get all the events.

You can do;

event.x or y
event.id

and so on.
 

arev

Sponsor

I know it's easy :)
when calling it from another event you can also use interpreter's command "get_character(id).x" since you're using interpreter anyway.
 
I know this may sound abit much... but wouldnt it be easier to just create a project and put in the SDK and zip everything and distribute it that way? You know... for those who arent all that great with this and still have a hard time grasping on what you are ment to do? Just a suggestion.. I think it would make it alot easier for everyone. Including the SDK team.. They dont have to keep updating a text file over and over again.. you know..
 
I think it's pretty clear:

Default RMXP Scripts
SDK
Non-SDK Scripts
SDK Scripts
Main

The order of the Non-SDK and SDK may or may not matter, but in the event that a non-SDK script overwrites a method, an SDK script shouldn't so it will more or likely work better this way.
 
Well i still dont understand how to put it into my project...Can i just creat a new script section and just copy and paste the whole SDK in there so everything is under one window?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top