[XP] Grid-Free Doodads

Started by Wecoc, January 28, 2017, 03:47:09 pm

Previous topic - Next topic

Wecoc

January 28, 2017, 03:47:09 pm Last Edit: January 30, 2017, 12:00:38 pm by Wecoc
Grid-Free Doodads
Authors: Wecoc
Version: 1.01
Type: Doodad System
Key Term: Game Utility



Introduction

Grid-Free Doodads is a system that implements on your game the use of Doodads, in other words, tiles which are not fixed on the default editor grid.

With this you can get an effect very similar to those made with parallax mapping but this time controlled on the game, with extra options. Also, the size of the game file will be much lower, solving this way the main problem found on games that use parallax.

This system was inspired by the Grid-Free Doodads plugin for RPG maker MV, made by Yanfly.
It contains a total of 7 scripts: Mouse and Keyboard support, a script containing all the info you need to know to use this system in your game, and the system by itself divided in 4 parts.


Features


  • Unlimited Doodads per map

  • You can see the Doodads on the project as normal tiles (not on the Editor)

  • Area Support to use Regions like in VX/Ace/MV --> No passable Doodads

  • Animated Doodads with unlimited frames, yay!

  • Doodads which appear under a condition




Screenshots

Spoiler: ShowHide













Demo

Grid-Free Doodads 1.01 (English)
Grid-Free Doodads 1.01 (EspaƱol)


Script

You will find the 7 scripts in the demo, place them in your game (first you should save a copy of you game on its current state). Place them over main and over other custom scripts. You will find more detailed Instalation info inside the script Doodad Info.


Instructions

Inside the script Doodad Info

Spoiler: ShowHide
#==============================================================================
# ** [XP] Grid-Free Doodads v1.01 ENG
#------------------------------------------------------------------------------
# ** PART 0 - Doodad Info
#------------------------------------------------------------------------------
#  Grid-Free Doodads is a system that allows the use of Doodads, in other
#  words, tiles which are not fixed on the default editor grid.
#
#  This allows an effect very similar to parallax mapping but controlled on the
#  game, with extra options. Furthermore the size of the game file will be
#  much lower, which is the main problem on games that use parallax.

#  This script was inspired by the 'Grid-Free Doodads' in MV, made by Yanfly.
#  Version: 1.01 (English)
#------------------------------------------------------------------------------
# Features:
#
# - You can see the Doodads on the project as normal tiles, but not on the editor
# - Doodads are placed and configured in Debug Mode.
# - The system consists of 7 scripts (4 parts + info + Mouse & Keyboard support)
# - This system has integrated an Area Support.
# - This demo contains Doodads inside the Graphics/Doodads/ folder.
#   There you can define your own Doodads, inside folders and sub-folders.
#
#------------------------------------------------------------------------------
# Credits:
#
#   Wecoc - Grid-Free Doodads
#   Glitchfinder - Key Input & Mouse
#
#------------------------------------------------------------------------------
# Installation:
#
# 1. Copy the 7 demo scripts to your project in the same order (you should first
#    save a copy of your project in its current state)
#    The scripts must be placed over main and over the other custom scripts.
# 2. Copy the folder Doodads of this demo inside the folder Graphics of your
#    project.
# 3. If you are not using RTP, define the icon used to show folders in the game,
#    in the very start of the script Doodad Setup.
#
#------------------------------------------------------------------------------
# Tutorial:
#
#  Once you have installed Grid-Free Doodads, you can access the main menu by
#  pressing F8 in Debug mode.
#
# 1. Place a Doodad
#
#  To place a Doodad on the map, go to the Place Doodads option in the setup
#  main menu. The list of folders inside the folder Doodads will be displayed.
#  You can create as many folders and sub-folders as you want.
#
#  After selecting the doodad you want to insert, you can place it on the map
#  using the Mouse.
#
# - If you press the arrow keys you will scroll the screen over the entire map.
#
# - If you press Q/W you change the Doodad priority. Priority is the height of
#   the Doodad on the map, and works exactly like tiles (0-5), but they have an
#   extra priority (-1) so you can place them under the player and events.
#
# - If you press CTRL you can fix the doodad in a 16x16 grid. The length of the
#   grid is defined on the script Doodad Setup.
#
# - If you press E you will access to the Doodad configuration.
#
# - If you click with the Mouse, the Doodad will be placed on its current place,
#   and you will instantly have the possibility to insert the next one.
#
# - If you press CTRL + Z the last Doodad will be removed.
#
# - Finally if you press Cancel (X) you will back to the main setup menu.
#
# 2. Edit a Doodad
#
#  To edit a Doodad go to the Edit Doodads option in the setup main menu.
#  The number of doodads and priority categories will be displayed.
#
#  After selecting your category a list of all doodads on that category will
#  be displayed. On the map, the current selected Doodad will blink.
#  If the selected one is under the window, place the mouse over the window
#  and its opacity will decrease.
#
#  Once you select your Doodad the edit options list will appear.
#
# - Edit Position allows you to define X, Y and priority of the Doodad again.
#
# - Hue will change the hue of the Doodad bitmap. This proccess is the most
#   time consuming and will decrease the color quality of the Doodad after some
#   changes, but no need to worry about that, once you exit the editor its
#   colors will look fine.
#
# - You can also change the Opacity and Zoom of your Doodad.
#
# - Anchor X and Y are used to define the doodad center points.
#   That's used to calculate when the Doodad is in front or back of the player
#   and events in priority 0, or of other doodads and tiles in any priority.
#
# - Blend, Bush and Mirror work exactly the same way as always.
#
# - Angle is used to rotate the Doodad. If you press CTRL its value will
#   increase or decrease faster.
#
# - Animation allows to asign a loop animation ID on the sprite of the Doodad.
#   Its position depends on Anchor X and Y.
#
# - Set Tone opens a window where you can control the tone RGB of the Doodad.
#   The values are between -255 and 255. You can save the current tone to select
#   it directly on any other Doodad, that info will be stored in TONE.txt inside
#   the Doodads folder of your project. You can change there the name of the
#   tones and define as may as you want, but do not alter the tabulation format
#   of the file, or the tone won't be read properly.
#
# - Condition is the last opcion, only for scripters, and it's disabled if you
#   access the edit window from the Place Doodads mode (E).
#   Condition allows to write an eval to restrict the appearing condition of
#   the Doodad. If the eval is well-written, Condition will be displayed green,
#   but red if not.
#
# 3. Delete a Doodad
#
#  To delete a doodad go to the Clear Doodads option, the same list of doodads
#  as in Edit Doodads will appear.
#
# 4. Impassable Doodads
#
#  The only way to make a no passable Doodad is using Areas to define the
#  passability of a tile on the map. You can configure it on the script Area
#  Support, but by default 10 is no passable, 11 is always passable, 12 has
#  bush effect and 13 disabled the bush effect.
#
# 5. Animated Doodads
#
#  Yes, you can also make animated Doodads. To define the frames of a Doodad
#  its graphic name must end with [X,Y] where X are the horizontal frames and
#  Y the vertical frames. You can later define its speed on the game.
#
#==============================================================================



Compatibility

If you are using other Mouse and Key support scripts in your game you can use them instead of the ones found in the demo, but you will have to edit the last script (Doodad Setup) to adapt it to your scripts.

You will probably get an error if you try to load a save file of your game, if you saved it before inserting Grid-Free Doodads.

No other compatibility issues were found.



Credits and Thanks


  • Wecoc - Grid-Free Doodads

  • Glitchfinder - Key Input & Mouse




Author's Notes

This is for rebels who still use RPG maker XP but want Doodads because f*ck, they are great.
Enjoy~

KK20

Spoiler: ShowHide

I remember seeing the MV script on Youtube and was like "Damn we need that shit in XP--I should make it once I finish my other things".
But dude you have delivered.
++ bro

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Blizzard

This is awesome! How did you implement them in the backend? With tiles or events?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Wecoc

Quote from: Blizzard on January 29, 2017, 03:31:59 amHow did you implement them in the backend? With tiles or events?


I thought events would probably increase lag much more, so I created an entire new type.

The Doodads are default RPG::Sprite stored on Spriteset_Map, but their properties are defined using a new class "Doodad", and saved to Doodads.rxdata, which is created the first time you insert a doodad.
The Area info is saved in Map(ID).rxdata in a very easier way as many other default properties of the map; my first plan was doing the same with all the doodads data but I had some troubles with that so I decided to store all their info in a new rxdata.

Some project compilators still work anyway, some others will need some changes to compile Doodad.rxdata with the others.

Also, talking about lag, I tested it adding 200 animated doodads in the map and lag is nearly the same as you can see here.
Spoiler: ShowHide

OH MY GOD ALUXES WHAT THE HELL ARE YOU DOING?! RUUUNN!!

Blizzard

Nice. It was a good idea to make it a separate file so maps can be still easily edited in RMXP's editor.

Spoiler: ShowHide
Aluxes: "I'm fireproof, bitch!" xD
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

KK20

January 29, 2017, 11:14:07 pm #5 Last Edit: January 30, 2017, 12:30:31 am by KK20
Things I noticed in the demo:

  • When placing Areas, if you scroll around the map, it sometimes would not be in the position of the mouse cursor.

  • Why is it that if I place Areas, change the map size, then check the placed Areas again, Areas that I newly place are gone but the ones you pre-defined that came in the demo are still there?

  • While placing a doodad, if you edit it, but press Input::B, it takes you back to the main menu and places the doodad you currently had selected (should function like I pressed 'Finished Edition' (by the way, the correct word is "Editing")

  • Window cursor index should be reset to zero. For example, if you edit a doodad, go all the way to the bottom ("Condition"), press Input::B, then Edit Doodads again, you get this:
    Spoiler: ShowHide

  • You should handle invalid syntax when making Conditions. In Window_DoodadEdit#refresh:


        result =
        begin
          eval(@doodad.condition)
        rescue SyntaxError
          print $!
          nil
        rescue
          print $!
          nil
        end

    This will print the error they made in their code, while not just crashing the user entirely of all their progress.
    You'll also need to do the same to Spriteset_Map#update, but remove the print statements (or you will forever spam the user with messages).

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Wecoc

Thank you KK20 for testing it all.

Fortunately, many of these bugs were easy to fix, I already fixed them and upload the demo(s) again.
But there's one I don't know how to fix or if it's even possible...

QuoteWhen placing Areas, if you scroll around the map, it sometimes would not be in the position of the mouse cursor.

I knew using Mouse.tile_x and Mouse.tile_y for that would not be a good idea after all. I believe I fixed it, now it's done with Mouse.x and Mouse.y

QuoteWhy is it that if I place Areas, change the map size, then check the placed Areas again, Areas that I newly place are gone but the ones you pre-defined that came in the demo are still there?

I see what happens, you have to quit the program and restart it after defining new Areas so they will not be erased when changing the map properties on the editor after that.
I have no idea how to fix this.

QuoteWhile placing a doodad, if you edit it, but press Input::B, it takes you back to the main menu and places the doodad you currently had selected (should function like I pressed 'Finished Edition' (by the way, the correct word is "Editing")

Ok silly mistake (and silly misspell, lol). Fixed.

QuoteWindow cursor index should be reset to zero. For example, if you edit a doodad, go all the way to the bottom ("Condition"), press Input::B, then Edit Doodads again, you get this

Fixed on the Edit window, I don't know if the same problem is anywhere else. I've been trying some combinations and everything seems fine.

QuoteYou should handle invalid syntax when making Conditions.

Good point. Done!

I also fixed another bug I found; hue changes were not working properly on animated doodads.

If somebody finds other bugs please let me know.

KK20

QuoteI see what happens, you have to quit the program and restart it after defining new Areas so they will not be erased when changing the map properties on the editor after that.

Can't you just do the same thing as you did with Doodads.rxdata and make an Areas.rxdata?

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

LiTTleDRAgo

Just want to point out

  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  def setup(map_id)
    doodads_setup(map_id)
    if FileTest.exist?("Data/Doodads.rxdata")
      doodads = load_data("Data/Doodads.rxdata")
      @doodads = doodads.select{|doodad| doodad.map_id == map_id}
    else
      @doodads = []
    end
  end


FileTest.exist? won't detect items inside encrypted project
try this instead : RPG_FileTest.exist?

whitespirits

Is there any chance this can be released for VXACE? it would save all the damn parallaxing :D

whitespirits

Hello all, I was wondering if anyone can convert this to VX ACE so I can overcome the VX mapping system that is just terrible