Mikuri 0 Report post Posted June 18, 2011 Hello! I've been trying since a few days to get this to work, but I failed everytime :)! What I am trying to do is to be able to scale the graphics of my game to 0.5 (half-size) and to decide on my own, the screen size, like 800x600 for exemple. I'm currently using ForeverZer0 script for costum resolution : HERE So as you can see, half the job is done thanks to ForeverZer0. Now, I only need to scale the graphics to 0.5 I've found that zoom_y and zoom_x could be use, but how and where? It needs to scale -> tilesets, battlers, caracters, icons... If it could scale everything it would be fine enough, I'll deal with the menu and stuff like the caracter movement. So in the end... Can anyone help me with this? A plug-and-play script would be fun, but anything is fine really. And it must work with a new project :) Thanks to anyone that can help :)! Share this post Link to post Share on other sites
kellessdee 48 Report post Posted June 18, 2011 out of curiosity, is it necessary to scale down the graphics? if so, I would HIGHLY suggest resizing them in something like gimp or photoshop. Using the existing methods to resize the graphics could easily slow down/lag your game ALOT. calling the zoom_x / zoom_y methods takes a lot of processing power (well not THAT THAT much, but multiply the number of rescales necessary by 2 and that's a lot of method calls.) Share this post Link to post Share on other sites
Mikuri 0 Report post Posted June 18, 2011 (edited) Hehe, I could, but I can't manage permission to walk with a tileset that is divided in 4. Like, I want a pole that is half a tile width, I can't set it to half only where there's no pixel. And I've seen some pokemon games with a scale 0.5 or so turning pretty well, so it can't lag that bad with a bit larger screen. So, yes, it is necessary :) Edited June 18, 2011 by Mikuri Share this post Link to post Share on other sites
kellessdee 48 Report post Posted June 19, 2011 hmmm I never thought about the tilesets..I guess that makes sense XD And I think I may have come up with a quick and easy solution to this! I never thought about it; A simple rewrite of the rpg::Cache module that instead of returning the full-sized bitmap, re-blt it at 1/2 scale and return it...hmmm EDIT: Okay, so I got it to work, well sort of anyways. Those pokemon games you speak of MUST have a different method all together for scaling the graphics (as it would need to scale the entire screen rather than each individual graphic) OR they did a huge script rewrite. Everything worked fine, except for tilesets. Since the movement in rmxp is tile based (32 X 32 px tiles to be exact) one would probably need to rewrite movement, tilemaps, etc. in order to scale the tilesets correctly. Otherwise, there may be a set of win32api functions that can scale the entire screen...which is something I am not very knowledgeable of. Share this post Link to post Share on other sites
Mikuri 0 Report post Posted June 19, 2011 (edited) Hmmm, I don't know where that rpg::cache is. If you can tell where it is, maybe I could try something with it. But for the moment, I have 1 thing cleared, I had success at resizing with caracters :) In Sprite_Character, at line 70 and 71, I added self.zoom_y = 0.5 AND self.zoom_x = 0.5 And it works... I'll try to see if I can find a way to make it works with the tileset and battlers if possible, but main objectiv is tileset since battlers is candy. EDIT : Hmmm, I could edit the movement pretty easy don't I? Must be a value somewhere to change 32 to 16. And yes it could be win32api functions of some sort to be more effective than my zoom_y method. EDIT2 : There's probably 2 methods like you said, one is to resize things in script like I may do for now, to test if it's possible without huge lag AND a way with win32api to scale the window one shot. Should I research about this? Hmmm... I could :) Edited June 20, 2011 by Mikuri Share this post Link to post Share on other sites
kellessdee 48 Report post Posted June 20, 2011 The RPG::Cache is technically a hidden module, but the script is in the help manual, but to make it easier for you: RPG::Cache (just c/p any where within the script editor, and any changes made will overwrite the existing cache) module RPG module Cache @cache = {} def self.load_bitmap(folder_name, filename, hue = 0) path = folder_name + filename if not @cache.include?(path) or @cache[path].disposed? if filename != "" @cache[path] = Bitmap.new(path) else @cache[path] = Bitmap.new(32, 32) end end if hue == 0 @cache[path] else key = [path, hue] if not @cache.include?(key) or @cache[key].disposed? @cache[key] = @cache[path].clone @cache[key].hue_change(hue) end @cache[key] end end def self.animation(filename, hue) self.load_bitmap("Graphics/Animations/", filename, hue) end def self.autotile(filename) self.load_bitmap("Graphics/Autotiles/", filename) end def self.battleback(filename) self.load_bitmap("Graphics/Battlebacks/", filename) end def self.battler(filename, hue) self.load_bitmap("Graphics/Battlers/", filename, hue) end def self.character(filename, hue) self.load_bitmap("Graphics/Characters/", filename, hue) end def self.fog(filename, hue) self.load_bitmap("Graphics/Fogs/", filename, hue) end def self.gameover(filename) self.load_bitmap("Graphics/Gameovers/", filename) end def self.icon(filename) self.load_bitmap("Graphics/Icons/", filename) end def self.panorama(filename, hue) self.load_bitmap("Graphics/Panoramas/", filename, hue) end def self.picture(filename) self.load_bitmap("Graphics/Pictures/", filename) end def self.tileset(filename) self.load_bitmap("Graphics/Tilesets/", filename) end def self.title(filename) self.load_bitmap("Graphics/Titles/", filename) end def self.windowskin(filename) self.load_bitmap("Graphics/Windowskins/", filename) end def self.tile(filename, tile_id, hue) key = [filename, tile_id, hue] if not @cache.include?(key) or @cache[key].disposed? @cache[key] = Bitmap.new(32, 32) x = (tile_id - 384) % 8 * 32 y = (tile_id - 384) / 8 * 32 rect = Rect.new(x, y, 32, 32) @cache[key].blt(0, 0, self.tileset(filename), rect) @cache[key].hue_change(hue) end @cache[key] end def self.clear @cache = {} GC.start end end end as for editing the movement...it unfortunately isn't as simple as distance variables, there are a lot of calculations to be taken into account and slowly apply movement over a certain amount of frames, to make the sprite "move." Editing movement efficiently is actually probably one of the more difficult things to do within the engine... And the scaling the tilesets would be difficult (in terms of externally scaling the graphics) as you would need to rewrite the tilemap to display each tile at 16 px intervals rather than 32...and the tilemap class is a hidden class (thus cannot be editted, you would need to write it from scratch) I think your best bet would be to see if those pokemon games have any scripts available to look at/for use. I don't even know if there is a function within the win32api that does this, but I make that assumption as the most efficient way to rescale everything at once would be by scaling the entire screen. Also, imo I think that graphics that are half size (unless they are HUGE to begin with) would make it difficult to play, no? I wish I could be more help, but good luck with this :) Share this post Link to post Share on other sites
Mikuri 0 Report post Posted June 20, 2011 Omg! I think I've found something awesome thanks to you! I've find some Tilemap class rewrite and I modified something in it... And it supports costum resolution! I've tried with RPG::cache but nothing worked well with me, win32api would only resize the screen for me with things I've found... So I pray to find something that will make it works fine with the tilesets (I succeeded in making "normal tiles" looks half size, I now need to find how for autotiles (can't be that hard...) and I'm ready for movement... x.x!! Thanks again for helping me :) Two heads is better than one ^^! Share this post Link to post Share on other sites
kellessdee 48 Report post Posted June 20, 2011 No problem :) glad I could help in some way. My method with the RPG::Cache involved creating a bitmap then stretch_blting that bitmap into the cache so all graphics called through the cache would be scaled to 1/2. anyways, good luck with everything :) Share this post Link to post Share on other sites
Mikuri 0 Report post Posted June 21, 2011 (edited) Ok! So here I am, about 2 days later, with my costum resolution and scale graphics done! There's 1 thing left to do before beginning the project for real. - Character movement, I need to tell the program to visually move only 16 pixels instead of 32, but again, any idea where to fix this? Thanks again if someone can give me some hints :)! Edited June 21, 2011 by Mikuri Share this post Link to post Share on other sites
kellessdee 48 Report post Posted June 21, 2011 1. I am not sure; the event's are loaded through the map's data (from map editor) and since there isn't really anyway to modify the map editor....however the only thing i can think of is perhaps if you head over to Game_Event script, look at line 30: moveto(@event.x, @event.y) maybe if you change that to: moveto(@event.x / 2, @event.y / 2) the only issue is that if that is referring to the logical position or actual position. If logical (as in x based on 32px tiles and y based on 32px tiles) it may not work correctly. 2. It would take some work, but I believe the Game_Character1 2 & 3 scripts is where you should start. Game_Character2's update_move method may be of interest to you 3. Z layer? Access-or-not layer? I am not sure I follow.... EDIT: Oh, it looks like you figured out 1 & 3? Share this post Link to post Share on other sites
Mikuri 0 Report post Posted June 22, 2011 Yeah, sorry for the edit, I've found out already how to deal with #1 and #3. Only this "visually character moves" is left (I think). But this is far more complicated than I think it was. Gonna try again tomorrow, but it is where you said, in the frame update(move) section of Game_character2. Share this post Link to post Share on other sites
kellessdee 48 Report post Posted June 22, 2011 Well...there is probably more to it then that (event triggers, etc.) but the the movement is *mostly* within that method... good luck :alright: Share this post Link to post Share on other sites