Technical Working 2: Electric Boogaloo
EDIT 5/24: Thanks to a user on my discord I found out that none of the previous devlogs had the images loading, so I've gone back and fixed this and the last one's to properly display images :)
Quickie: I'll be briefly going over what I did, if you join my discord @ https://discord.gg/q6grgzEahk you can talk directly to me to find out more.
The Parent-Child relationship:
A good rule of thumb for Node Communication is Call Down, Signal Up.
Referring back to this diagram I made in the last log, the Parent (Battle System) has Children (Player, Enemy, UI elements). If possible to manage, all the green arrows should be going downwards and not up. UI buttons shouldn't directly access Player, UI shouldn't access Enemy etc. I COULD pass Player/Enemy context to UI to negate this, but that wouldn't be good either, and it becomes harder to manage if anything else follows with this.
A Possible Solution: Singletons
For those of you reading who aren't exactly savvy in programming, a Singleton is a single static object, with the ability to allow anything to access it. The player, enemy, and UI buttons will now call functions from Battle Context to get access to other parts. Now my chart looks like this.
This creates a layer between all the objects, but doesn't quite solve the problem.
I've made another diagram to show a situation that can happen.
I've added new connections with a red line to show other things, when added, would have access to the singleton. This is bad, because Random Thing #2 at any time could make a call to Battle Context or change something. This will make finding bugs and glitches harder because I have to search through everything to figure out where it's happening.
I'm working on a better solution and I'll upload another devlog when I'm done explaining it.
Work Ethics
Status | Prototype |
Author | preggy |
Genre | Role Playing |
More posts
- A BETTER way to make a RPG Turn Queue: How-To Techlog #1Jul 16, 2021
- Overworld Design #1Jun 03, 2021
- Tech Work #3: Old Habits Die HardMay 24, 2021
- Technical Working #1May 21, 2021
- Spaghetti code and badly drawn ratsMay 20, 2021
- First devlog and some thoughtsMay 18, 2021
Leave a comment
Log in with itch.io to leave a comment.