Quote:
All sounds great mate, but I'd suggest making sure when you get to the end you spell out in very simple terms everything this baby will be capable of! I don't want any of your guys hard work to be missed out on for lack of knowing or understanding. I'm sure you have all your bases covered. This sounds like something that should replace 100% of all RM new games.
I'm very interested in this graphic module... I don't understand it, but I'm very interested! 640 x 480 limitation is my biggest turn off for using RM at the moment. Will this graphics module be relatively Plug and Play? So basically if I make higher resolution tiles I can display at 1024 x 768 by default, or am I way off here?
I'm very interested in this graphic module... I don't understand it, but I'm very interested! 640 x 480 limitation is my biggest turn off for using RM at the moment. Will this graphics module be relatively Plug and Play? So basically if I make higher resolution tiles I can display at 1024 x 768 by default, or am I way off here?
Good to see some support for this. I hate the 640x480 resolution as well. It is so tiny. And yes, this will support any resolution such as 1024x768. It works just like in VX "Graphics.resize(width, height). If you used Sewlyn's Resolution system, if you ever performed a transition, only the original 640x480 area would be effected. Via. the screenshot script (which is now located in the Graphics module as snap_to_bitmap), transitions can be performed at any resolution. The only real difficulty I am having is creating a fast enough process that makes transformations via. Transition files happen more quickly. I wrote a transform method for the Sprite class, but it checks bitmaps on both files and actually takes awhile since the bitmap.get_pixel and set_pixel are slow. Works, just need to come up with a faster method.
The only other problem is the Tilemap class. I have fixed my last version so its bug free (I hope) (and am working on merging it to allow even more layer's via a program called Tiled) but it is still slower than the default C coded Tilemap class XP uses. I am going to try to learn some C and re-write this class or something to make performance not take a hit when dealing with higher resolutions.
Quote:
To require from the game directory I use
$LOAD_PATH << "."
require "Scripts/your_dir/script"
Is that what you want
$LOAD_PATH << "."
require "Scripts/your_dir/script"
Is that what you want
I actually tried that as well, but it still errored. Not sure if I just corrupted my file or what the deal was, but I have a few ideas why its not working.
Quote:
In my opinion, the whole thing with trying to change the way that scripts are included with one another is a bad idea. In your example, the TripleTriad script would have been just fine if it was broken up into multiple files. A card is not a player, and therefore they should not have occupied the same file, or in this case script entry. I hope you at least plan to not break the original way, right?
Actually, those functions aren't for loading single files. I will have 3 functions, 1 that reads a directory and all sub directory and loads every file through all directories. Such as HBGE.load_library('Scripts/Ruby') and sub-folders with classes and modules with folders in those that it loads each .rb file. Second is just a lower level that reads files within a directory and loads .rb files. Lastly just a single file require.
Quote:
As for require, AFAIK Ruby just does an in-place evaluation. at the line that you put require. I think you'd get pretty close to what require does if you wrote it so that it loads the given file into a string and eval's it right there.
That's what I was going to end up doing when writing the functions for loading .rb files was using eval. Simple enough.
Quote:
As for graphics, did you replace the RMXP renderer, or just put the functions to resize the window? RMXP's default renderer is just GDI, so it's using software rendering. On my old P4 3.06Ghz HT 1024 x 768 was like 15 FPS, even if there were no sprites or anything else in the scene. Even just clearing that many pixels is difficult for it (It has to clear pixels one by one). I'm sure most people have better processors than that, but it's still something to watch out for.
I actually didn't touch the default Graphics#update method for the rendering. Every other method can be modified to work for higher resolution without destroying anything. If you are interested, current Graphics module code (I still have some work to do on it)
- #==============================================================================
- # ** Graphics
- #------------------------------------------------------------------------------
- # * Library
- #
- # Graphics:
- # ---------------------------------------------------------------------------
- # Graphics.screenshot
- # Graphics.snap_to_bitmap
- # Graphics.width
- # Graphics.height
- # Graphics.resize
- # Graphics.fullscreen
- # Graphics.size
- #==============================================================================
- #==============================================================================
- # ** Graphics
- #==============================================================================
- module Graphics
- #--------------------------------------------------------------------------
- # * Screenshot File Directory
- #--------------------------------------------------------------------------
- Screenshot_Dir = ''
- #--------------------------------------------------------------------------
- # * Screenshot (By Andreas21 & Cybersam)
- #
- # image_type : 0 - bmp, 1 - jpg, 2 - png
- #--------------------------------------------------------------------------
- def self.screenshot(filename = 'screenshot', image_type = 2)
- # Adds File Extension
- filename += image_type == 0 ? '.bmp' : image_type == 1 ? '.jpg' : '.png'
- # Create True Filename
- file_name = Screenshot_Dir + filename
- # Make Screenshot
- API::Screenshot.Screenshot(0, 0, self.width, self.height, file_name,
- API.hwnd, image_type)
- end
- #--------------------------------------------------------------------------
- # * Snap to Bitmap
- #--------------------------------------------------------------------------
- def self.snap_to_bitmap
- # Take Screenshot
- self.screenshot('snap_to_bitmap')
- # Load Bitmap
- bitmap = Bitmap.new('snap_to_bitmap')
- # Delete Screenshot
- File.delete('snap_to_bitmap.png')
- # Return Bitmap
- return bitmap
- end
- #--------------------------------------------------------------------------
- # * Width
- #--------------------------------------------------------------------------
- def self.width
- return @width == nil ? 640 : @width
- end
- #--------------------------------------------------------------------------
- # * Height
- #--------------------------------------------------------------------------
- def self.height
- return @height == nil ? 480 : @height
- end
- #--------------------------------------------------------------------------
- # * Resize
- #--------------------------------------------------------------------------
- def self.resize(width = Default_Width, height = Default_Height,
- fs = @fullscreen)
- # Saves Width & Height
- @width, @height = width, height
- # Modify Transition Viewport
- @transition_viewport.dispose
- @transition_sprite.dispose
- @transition_viewport = Viewport.new(0, 0, @width, @height)
- @transition_viewport.z = 99999
- @transition_sprite = Sprite.new(@transition_viewport)
- # Set Resolution
- self.set_resolution(fs)
- end
- #--------------------------------------------------------------------------
- # * Set Resolution
- #--------------------------------------------------------------------------
- private
- def self.set_resolution(fullscreen = !@fullscreen)
- if fullscreen
- API::User32.SetWindowLong.call(API.hwnd, API::User32::GWL_STYLE, API::User32::WS_VISIBLE|API::User32::WS_CLIPSIBLINGS)
- API::User32.SetWindowPos.call(API.hwnd, HWND_TOPMOST, 0, 0, @width, @height, API::User32::SWP_SHOWWINDOW)
- API::Display.Set_Res.call(@width, @height, 4)
- else
- w = @width + (2 * API::User32.GetSystemMetrics(API::User32::SM_CXFIXEDFRAME))
- h = @height + (2 * API::User32.GetSystemMetrics(API::User32::SM_CYFIXEDFRAME)) +
- API::User32.GetSystemMetrics(API::User32::SM_CYCAPTION)
- x = (@default_size[0] - w) / 2
- y = (@default_size[1] - h) / 2
- API::User32.SetWindowLong(API.hwnd, API::User32::GWL_STYLE,
- API::User32::WS_VISIBLE|API::User32::WS_CLIPSIBLINGS|API::User32::WS_CAPTION|API::User32::WS_SYSMENU|API::User32::WS_MINIMIZEBOX)
- API::User32.SetWindowPos(API.hwnd, API::User32::HWND_TOP, x, y, w, h, API::User32::SWP_SHOWWINDOW)
- self.update
- API::Display.SetResolution(@default_size[0], @default_size[1], 0)
- end
- end
- #--------------------------------------------------------------------------
- # * Size
- #--------------------------------------------------------------------------
- private
- def self.size
- return API::User32.GetSystemMetrics(0), API::User32.GetSystemMetrics(1)
- end
- #--------------------------------------------------------------------------
- # * Resized?
- #--------------------------------------------------------------------------
- private
- def self.resized?
- return @width > 640 || @height > 480
- end
- #--------------------------------------------------------------------------
- # * Save Default Instances
- #--------------------------------------------------------------------------
- @default_size = self.size
- @width = self.width
- @height = self.height
- @fullscreen = false
- #--------------------------------------------------------------------------
- # * Tranisition Viewport & Sprite
- #--------------------------------------------------------------------------
- @transition_viewport = Viewport.new(0, 0, @width, @height)
- @transition_viewport.z = 99999
- @transition_sprite = Sprite.new(@transition_viewport)
- end
- # Resize
- Graphics.resize
Expand to see the code.
What is left is keeping it from changing resolution when Alt+Enter is pressed. I tried quite a few ways for doing this (disabling key enter while Alt is pressed via various API), but couldn't figure it out).
Quote:
Alright, so I took a look in eval.c of the Ruby 1.8.6 source code, and for .rb files, require does just what I said. So you can emulate that aspect of require with just a simple eval() of the contents of the file you want to require. As for .so objects, I forget whether Enterbrain just undefined the ruby method "require" or whether they legit gimped the C function rb_require. I do not have RMXP installed, so I can't do it myself, but the first thing I would try is to write a DLL which redefines the ruby function require to call rb_require. If that doesn't work, then I would take a look at the rb_require file in eval.c of the ruby source code and recreate that function and define the ruby function "require" to call your recreated function.
Yeah, I ended up writing my own method for requiring files. Thanks for the info. :thumb:
Quote:
One reason I was trying to avoid the AWorks input was because it completely destroys the original module. That means you can't use the original module for stuff like game controllers anymore. It also requires a patch to fix events. As for your Graphics module, do you know how to add to the default module without breaking it?
Really? I tested it and it still checks the computer keys just fine. I've never had a problem with it at all. I believe there is a function that updates the Input constants when keys are configured when the user presses F1. I think all we would have to do is add something in the something like Input.update to check if a key is pressed (F1 or something) and it would call the function to update constants based off the registry values. Unless I am miss understanding something here... Shouldn't be a problem.
With what I posted above with a re-write of the Graphics module, its more of a update to the Graphics module to include a few more methods and functions (like found in VX). It shouldn't ever become a problem I would think.