[XP] Custom Resolution

Started by ForeverZer0, November 25, 2010, 03:28:40 am

Previous topic - Next topic

ForeverZer0

@123th

I actually just spent a couple minutes looking at it, and the reason it doesn't work is that the script changes the name in the Tilemap class and not Game_Map. My script doesn't even define that variable, it simply reads the name of the tileset from Game_Map. If the script is adapted to change the name of $game_map.tileset_name, and then refreshed, it will work. Its not even practical to use, but it will work.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

IserLuick

An awesome script indeed. Congratulations!  :haha:

If this data can help, I found an interesting error with the script; when I press Alt + Enter to have the game full screen, the resolution changes to the default 640x480, and most interesting, if I press alt+enter again to switch to window mode, the window gets to default size and not the one defined by the script. Another interesting thing is that when this happens, the position of the player remains the same as defined by the script (I tested this on the demo); for example, if I get to the center of the screen with the custom resolution, when I press Alr + enter the resolution changes but the player does not appear in the center of the screen anymore, and when I move the screen moves, but it moves accordingly to the custom resolution.

This do not crashes the game, it only "resets" the resolution to its original value and messes up a bit with the player's position.

Good luck!
Greetings!  :)

ForeverZer0

I noticed that as well.
I may be able to fix this, but it is going be a little buggy to fix it. The Alt+Enter combo is a command used by the Windows platform, not by RMXP. Basically, the game doesn't even know if it is in fullscreen or not.

I may be able to make some type of fix that checks the for the button input, checks if the screen is going back to default, and then re-initialize the Resolution to revert it back.

I would actually prefer to somehow disable ability to do so, but then the script would have to be distributed with a very slightly modified version of Game.exe.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

G_G

Oh F0. I completely forgot xD. I can test your thing now. Great way to break out my new computer. Though it'd be nice to know whats steps and setups I should test. Let me know and sorry...xD

ForeverZer0

There's actually a number of ways you could test it. I used a console to view the data in real time, and used something like this in Spriteset_Map:


time = Time.now
@tilemap.update
puts Time.now.to_f - time


I also used a few variations to see the averaged number, etc, etc.

Try different maps, different screen sizes, number of sprites, etc.
You can also keep an eye on the FPS and see how it is affected.
The good 'ol "Is the game lagging?" test is also pretty good.  :P

Thanks again!
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Ryex

holly!

tested at 1400, 900

with a 100 x 100 map with 79 events
I got 23 - 25 fps on average and the game process was using 50% of my CPU (2.5 GH dual core)
init: 0.404000043869019
update: 0.00600004196166992
update: 0.00600004196166992
update: 0.00566665331522624
update: 0.00575000047683716
update: 0.00560002326965332
update: 0.00566669305165609
update: 0.00571431432451521
update: 0.00575000047683716
update: 0.00577775637308757
update: 0.0056999683380127
update: 0.00581815026023171
update: 0.00583330790201823
update: 0.00584613359891451
update: 0.00592855044773647
update: 0.00593331654866537
update: 0.00593747198581696
update: 0.00594115257263184
update: 0.00594442420535617
update: 0.00610524729678505
update: 0.00614998340606689
update: 0.00614284333728609
update: 0.00613635236566717
update: 0.00613042582636294
update: 0.00616665681203206
update: 0.00615999221801758
update: 0.00615384028508113
update: 0.00614814405088071
update: 0.00614285469055176
update: 0.00613793011369376
update: 0.00613333384195964



then I tested a 50x50 map on the same res with 16 events
30 - 32 fps
40 - 45% CPU

init: 0.141999959945679
update: 0.00300002098083496
update: 0.00250005722045898
update: 0.00200001398722331
update: 0.00150001049041748
update: 0.00139999389648438
update: 0.00133335590362549
update: 0.00114287648882185
update: 0.0011250376701355
update: 0.00111116303337945
update: 0.00110006332397461
update: 0.00100005756724965
update: 0.00100006659825643
update: 0.00100005589998685
update: 0.0010000467300415
update: 0.00100003878275553
update: 0.00100003182888031
update: 0.00100002569310805
update: 0.00100002023908827
update: 0.00094738759492573
update: 0.000950014591217041
update: 0.00095239139738537
update: 0.000909100879322399
update: 0.000913049863732379
update: 0.000916669766108195
update: 0.000920000076293945
update: 0.000923074208773099
update: 0.000925920627735279
update: 0.000928563731057303
update: 0.000931032772721915
update: 0.000933329264322917
update: 0.000935485286097373
update: 0.000937506556510925
update: 0.000909097266919685
update: 0.000911768744973575
update: 0.000885718209402902
update: 0.000888890690273709
update: 0.000891898129437421
update: 0.000894741008156224
update: 0.000897438098222781
update: 0.000900000333786011
update: 0.000902437582248595
update: 0.000904758771260579
update: 0.000906977542611056
update: 0.000909090042114258
update: 0.000911108652750651
update: 0.000913039497707201
update: 0.000893613125415559
update: 0.000895828008651733
update: 0.000897952488490513
update: 0.000899996757507324
update: 0.000901960859111711
update: 0.000884615457974947
update: 0.000905662212731703
update: 0.000907412281742802
update: 0.000909098711880771
update: 0.000910720654896327
update: 0.000912285687630637
update: 0.000896556624050798
update: 0.000898312714140294
update: 0.000900010267893473
update: 0.000901648255645252
update: 0.000903233405082457
update: 0.000904768232315306
update: 0.000890631228685379
update: 0.000892312710101788
update: 0.000878792820554791
update: 0.000880600801154749
update: 0.000882359112010283
update: 0.000869571298792742
update: 0.000871433530535017
update: 0.000873246663053271
update: 0.000875009430779351
update: 0.000876720637491305
update: 0.000878385595373205
update: 0.000866673787434896
update: 0.000855270184968647
update: 0.000857151948012315
update: 0.000846162820473695
update: 0.000848109209084813
update: 0.000850009918212891
update: 0.000851863696251387
update: 0.000865866498249333
update: 0.000867481691291533
update: 0.000869058427356538
update: 0.000858834210564108
update: 0.000860474830450014
update: 0.000862080475379681
update: 0.000863646919077093
update: 0.000853943021109935
update: 0.000933345158894857
update: 0.000934079453185364
update: 0.000923926415650741
update: 0.000924743631834625
update: 0.000925543460440128
update: 0.000926326450548674
update: 0.000927095611890157
update: 0.000927848914234909
update: 0.000928584410219776
update: 0.000929307455968375
update: 0.000930016040802002
update: 0.000930708233672794
update: 0.00092158364314659
update: 0.000922344263317516
update: 0.000923090256177462
update: 0.0009238220396496
update: 0.000924542265118293
update: 0.000925246800217673
update: 0.000925940495950204
update: 0.000926621463320671
update: 0.000927287882024592
update: 0.000927942293184298
update: 0.000928585018430437


I did NOT expect it to do that well
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

ForeverZer0

I'm pleased with that. Although the hardware will be the primary factor determining lag, I did attempt it to make it update the least number of objects. ABSEAL should make it even better.

I would still suggest against using screen sizes so large. Aside from the fact that you need to keep it in a range of sizes that pretty much anybody's screen is big enough for, there is going to be at least some performance loss using a larger resolution.


@ryex
Thanks a bunch for the testing!  :D
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

dani3

Sorry to necropost, but there is a problem concerning events on the map. I set a resolution of 1024x768 and they disappear when they move.

Blizzard

Are you using a custom anti-lag script? Make sure it's set up properly and if there is no special setup for this, you will need to edit it.
Either way make sure that all Viewport instances in Spriteset_Map are set up properly to the new resolution (only where needed obviously).
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.

dani3

Thank you blizzard, I suspect it's XAS that causes that... I will try to tweak with those scripts to see if I can solve this issue.

Zexion

I know this is old, and I don't know if anyone would be willing to fix this, but it's kind of an annoying bug.
If you place an autotile on the first layer, and place ANYTHING on the second layer (over the autotile of course) it stops animating, AND loses it's passability rules.

KK20

Bleh, that's probably a problem in the rewritten Tilemap class. God knows I don't even want to try studying that...yet. (I probably will since my Advance Wars kinda needs it, but this is low on my priority list right now)

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!

Heretic86

I've noticed a couple problems right off the bat.

#1  Resolution is not adjusted for Full Screen Resolutions.  Resolution is still set at 640x480.  At least for me. (XP 32)

#2  While in Full Screen, bottom and right side of map are not dispalyed properly.  The map stops scrolling, but the character can continue to walk to off screen where the map normally continues, but not visible due to failed scrolling.

#3  Also Full Screen related.  Character is centered in positions other than center of the screen.  Im sure this is directly related to being rendered as 640x480 and calculated for alternate resolutions.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

G_G

All those problems have to due with RMXP's built in fullscreen crap. I don't believe there is anyway to change the resolution in fullscreen as that's set in the underlying engine. And since the screen is forced to 640x480 and the script thinks it's a different resolution, that's why the scrolling and centering isn't working properly. Long story short, can't fullscreen with this script.

Zexion

I think the autotile problem has to do with that system that checks if the autotile needs to be updated. I think it should always be updated if it exists. I just wouldn't know what to change, but I think it's in this part of the code...
  def map_data=(data)
    # Set the map data to an instance variable.
    @map_data = data
    # Clear any sprites' bitmaps if it exists, or create new ones.
    @layers.each_index {|i|
      if @layers[i].bitmap != nil
        # Dispose bitmap and set to nil.
        @layers[i].bitmap = @layers[i].bitmap.dispose
      end
      # Create new bitmap, whose size is the same as the game map.
      @layers[i].bitmap = Bitmap.new($game_map.width*32, $game_map.height*32)
    }
    # Draw bitmaps accordingly.
    refresh
  end
 
  def refresh   
    # Set the animation data from the file if it exists, or create it now.
    @animated = $game_map.autotile_data
    # Iterate through all map layers, starting with the bottom.
    [0,1,2].each {|z| (0...@map_data.ysize).each {|y| (0...@map_data.xsize).each {|x|
      tile_id = @map_data[x, y, z]
      # Go to the next iteration if no bitmap is defined for this tile.
      if tile_id == 0 # No tile
        next
      elsif tile_id < 384 # Autotile
        name = $game_map.autotile_names[(tile_id / 48) - 1]
        bitmap = RPG::Cache.load_autotile(name, tile_id)
      else # Normal Tile
        bitmap = RPG::Cache.tile($game_map.tileset_name, tile_id, 0)
      end
      # Determine what the layer to draw tile, based off priority.
      layer = @priorities[tile_id]
      # Perform a block transfer from the created bitmap to the sprite bitmap.
      @layers[layer].bitmap.blt(x*32, y*32, bitmap, Rect.new(0, 0, 32, 32))
    }}}
  end
 
  def update
    # Update the sprites.
    if Graphics.frame_count % $game_map.autotile_speed == 0
      # Increase current frame of tile by one, looping by width.
      @animated[0].each_index {|i|
        @animated[2][i] = (@animated[2][i] + 1) % @animated[1][i]
        @animated[3][i].each {|data|
          # Gather data using the stored coordinates from the map data.
          tile_id, x, y = @map_data[data[0], data[1], data[2]], data[0], data[1]
          name, layer = @animated[0][i], @priorities[tile_id]
          # Load the next frame of the autotile and set it to the map.
          bitmap = RPG::Cache.load_autotile(name, tile_id, @animated[2][i])
          @layers[layer].bitmap.blt(x*32, y*32, bitmap, Rect.new(0, 0, 32, 32))
        }
      }
    end
  end
end

KK20

Figured it out. It wasn't because of any of those. :P Nice effort though.

Near the bottom under DEBUG Mode

above = []
((z+1)...data.zsize).each {|zz| above.push(data[x, y, zz]) }
animated[3][index].push([x, y, z]) #if above.all? {|id| id == 0 }

That can all be replaced with

animated[3][index].push([x, y, z])


Anything with a priority of 0 placed on top of the autotile, however, will not appear.

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!

KK20

Script has been updated to version 0.94. It addresses some bugs that users have found and I have fixed.

  • Changing a map's panorama more than once closed the game

  • When caching the maps, if your project had a lot of maps (we're talking hundreds), the project would get a 'Script is hanging' and close

  • Tiles placed on layers over an animating autotile prevented the autotile from animating. It also disrupted passability rules.

  • Transparent animating autotiles would not be transparent due to overlapping of images. (It is recommended that your autotile have a priority higher than 1 to prevent seeing the panorama/black viewport behind it)

  • $game_map.data[x,y,z] = tile_id did not make graphical changes to the map instantly. (The actual code to do this was quite a doozy!)


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!

Terv

Quote$game_map.data[x,y,z] = tile_id did not make graphical changes to the map instantly.

Thank you for providing a function that is no less than vital to my project any plans for a special limited signature edition of your project I could throw my money at?

ExoReality

If I copy the script version 0.94 into the old demo I get this glitch:


I did something wrong? D:

Terv

July 24, 2013, 08:27:57 am #79 Last Edit: July 24, 2013, 08:29:40 am by Terv
Quote from: KK20 on December 24, 2012, 01:41:51 pmAnything with a priority of 0 placed on top of the autotile, however, will not appear.
If you change the brige's tiles' priority to 1 they appear again; however they also overlap the player and the autotile beneath blocks the path. You could just merge the autotile and the bridge in Photoshop and put them on a single layer, but this doesn't work for animated autotiles, like the water on your screen. So a fix is needed.