GEO BLOCKS

RPG Maker VX Ace

Disgaea-style Geo Block system (WIP)

So I decided to start looking into RGSS. Some people, when they're testing out a new programming language, write up something simple like a "Hello World." Me, I try to do something useful. So I wrote up a Disgaea-style Geo Block system.

The functionality is still a bit limited, but right now it's able to create a Geo Block overlay on a map, place Geo Symbols on the map, and break a symbol, with the appropriate chain reaction, including accelerating as the color-changing goes on. And all in under 160 lines of code.

Known issues:


To use: Get a reference to the Geo_Effects instance at
SceneManager.scene.geo_manager

Call the add_color, add_symbol, or geo_break methods on it. (NOTE: Obviously, this will only work when the current scene is Scene_Map.)

Sample usage:
Create two events on the map. On the first one, give it a script like the following:

geo = SceneManager.scene.geo_manager
(5..10).each {|x|
  (5..10).each {|y|
    geo.add_color(x, y, 1)
  }
}
geo.add_symbol(9, 8, 2)
geo.add_symbol(7, 8, 3)
geo.add_symbol(7, 10, 0)


This creates a square of red Geo Blocks, with three Geo Symbols on it, one green, one blue, and one white (clear).

For the second event, give a script to break one of the blocks:

geo = SceneManager.scene.geo_manager
geo.geo_break(7, 8)


This will set off a chain reaction, Disgaea-style, that ends up wiping them all out.


Any feedback is welcome.

Posts

Pages: 1
wow, are you really just starting in RGSS?
Anyways, is this used in the battle? or just for map events?

Great work there! I'm looking forward for you to finish this. I might find it useful in the future.
author=mike_14
wow, are you really just starting in RGSS?


Yes, this is actually the first time in my life I've ever touched Ruby. I have, however, been programming for more than 20 years in a variety of other languages, and I'm good at reading documentation and sample code, so that helps a lot.

Anyways, is this used in the battle? or just for map events?


Just for map events. It requires a square grid to work, so there's no good way to integrate it into a standard RPG Maker battle system. (If someone makes a tactical CBS, though, this would come in handy.)

Great work there! I'm looking forward for you to finish this. I might find it useful in the future.


I hope so! I'll keep working on it.
If you're interested in writing scripts for tactical battle systems you can consider using this as the base: http://forums.rpgmakerweb.com/index.php?/topic/16085-gubids-tactical-battle-system-v2-for-ace/

This is probably one of the more developed ones, though there are several others.
author=Tsukihime
If you're interested in writing scripts for tactical battle systems you can consider using this as the base: http://forums.rpgmakerweb.com/index.php?/topic/16085-gubids-tactical-battle-system-v2-for-ace/


Looks interesting, thanks. I might contact the author to talk about stuff. Mostly, though, this was just something for me to try out to learn a bit of RGSS. :)
There's also a battle system that takes place in the map. Just like Chrono Trigger.

http://forums.rpgmakerweb.com/index.php?/topic/2676-ve-map-turn-battle/

Though I think your script is more suitable in tactical games.
Update: Since a lot of the functionality that makes Geo Effects so interesting is related to the way they interact with the rest of the battle engine, I added four hooks that accept procs or blocks as callbacks so that the engine can fill in the blanks in ways that make sense for itself.

onChangePanel: Fired every time a panel changes color as part of a Geo Break round, with the coordinates of the panel that got changed.

onBeginRound: Fired at the beginning of each Geo Break round, whether it was triggered by the player breaking a symbol or as part of a chain reaction.

onChainFinished: Fired at the end of a Geo Break chain.

onBoardClear: Fired at the end of a Geo Break chain if the chain ended with all panels being cleared from the board.

With these hooks, it should be possible for a tactical battle system to implement the full functionality found in a Disgaea game, or make their own modifications on the basic theme.
The use of event handling/callbacks is definitely under-used in RM, though I think usually that's because the only people that would really make use of them are scripters, and so the audience is much smaller.

I find that most of the scripts that I provide with developer API's usually don't get much usage.
Hmm. So what would be a better way of making this customizable? I'm primarily a Delphi developer, and so event handlers are completely natural and idiomatic to me.
I tend to expose these things to RM events. Even though someone doesn't know how to write ruby, they can probably put together an event to get something done. I would use the callbacks and provide a simple interface that can be used by events.

For example, a single geoblock can be represented by a single event. The event can define what happens when you break the block, and all of the other callbacks, WITHOUT having to write any ruby. Instead, the scripter would figure out a way to use the event editor to allow users to specify these things without opening the script editor. Some script calls may be required, but that's typically less daunting than "full-on scripting".

I think it would be useful to find a way to manage geoblocks using only events and regions, which can be treated as the geo regions.
That's an interesting idea. Does RGSS3 give any way to read and modify region data programatically? I don't see anything about that in the documentation, but I might just not be looking in the right place.
Region data is stored with the map data.
You can retrieve this map data via $game_map.data.

The map data is stored in a Table object (check help file) in the 4th dimension, so you would access the region of the top-left corner of the map like this


$game_map.data[0, 0, 3]


Note that the region itself only occupies the highest 8 bits of the integer, so the value you get needs to be shifted over by 8


$game_map.data[0, 0, 3] >> 8


You need to make sure that you are only operating on the highest 8 bits, because there is other data stored in the other bits.

Here's how I'm doing it, but don't know if there's a more efficient way.
http://forums.rpgmakerweb.com/index.php?/topic/9962-changing-region-id-bitwise-operation-fun/
author=Tsukihime
Here's how I'm doing it, but don't know if there's a more efficient way.
http://forums.rpgmakerweb.com/index.php?/topic/9962-changing-region-id-bitwise-operation-fun/


Yeah, Ruby's too high-level to do efficient bit-twiddling. If this was Delphi or C you could use typecast tricks to mess around with high-order bits more easily, but for a scripting language, I think what you're doing is about as good as it can get.
Pages: 1