GML How to approach making rpg battles (NOT ABOUT BATTLE SYSTEM)

C

Cyndi

Guest
Hi! I'm creating an RPG type game, and I have a question, though it isn't about creating a system. I would like to know how to approach actually holding a battle without losing my room data. From what I know (which might be wrong, I'm relatively new to GM2), everything that happens in a room only happens in that instance of the room, meaning that if I spawn in an instance in a room and then load another room, that instance is no longer in the first room as it just loads the room as if I were entering it for the first time.
I want to know how I can transition into a battle room/setup without losing my room, preferably without using save states (though if that's the best way please tell me).
Thank you!
 
B

Bayesian

Guest
I think this would be one of the cases where using room persistence would be good. If you want to transition from "world rooms" to "battle rooms" you could set room_persistent to true before switching. And then back to false when returning. The idea being that only one room at time is persistent.
 
The most immediately simple thing you could do is utilize room persistence, but that comes with a host of problems that will creep up later on. One of which being inflated memory usage. A slightly more demanding upfront but overall more effective method would be to deactivate non-battle-related instances then just draw the battle screen on top. Just make sure to reactivate any deactivated instances when battle is over.
 

NightFrost

Member
Depends on what needs to be remembered from old room data. In a typical RPG overworld map (where combat encounters happen) I can't immediately think of much else but randomly spawned enemies that need to be returned to their places after combat is over. If you're going with the classic encounter chance rolling instead of physically having them on map, even that would be unnecessary.
 
I store everything that needs to be "recreated" at any point in global lists/maps. Takes a little bit of setup, but makes for easy save/load, easy data transfer between rooms, easy life.
 
D

dannyjenn

Guest
I've always found room persistence to be confusing, so I stay away from it...

The two easiest ways which come to my mind are what @nacho_chicken and @RefresherTowel said. Either don't switch the room at all (do all battling on a surface), or else switch the room but save all the important variables beforehand so you can restore them afterwards.
 
C

Cyndi

Guest
I think this would be one of the cases where using room persistence would be good. If you want to transition from "world rooms" to "battle rooms" you could set room_persistent to true before switching. And then back to false when returning. The idea being that only one room at a time is persistent.
Thank you so much! I had no idea of this, so I'll be sure to use this.
 
Top