Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would like ability to add multiple items (Cybernetic Arms) #107

Open
EdwinHolley opened this issue Mar 2, 2019 · 2 comments
Open

Would like ability to add multiple items (Cybernetic Arms) #107

EdwinHolley opened this issue Mar 2, 2019 · 2 comments

Comments

@EdwinHolley
Copy link

I would like the ability to add multiple cyber-arms for my sons Uplift-Porpise.

@EmperorArthur
Copy link
Collaborator

Hi,

Thanks for your interest in this project.

It's currently undergoing a major re-write, which should allow for functionality like that.

Here's a sneak peak under the hood of why I'd love to do it, but what you're asking for is really difficult.

The problems:

Internally, the system has no concept of multiple items with the same "name". Heck, the database doesn't even use IDs for objects, and instead uses their "name". I, temporarily, broke quite a few things trying to just let you add a skill with the same name, but a different prefix. Since, internally, "name" and "prefix" are stored separately, and the code was just looking at "name".

Next, is the problem where the old code doesn't use an MVC (Model View Controller) framework.* That's important because it means everything dealing with the database is written in raw SQL. Which means working with the actual data is "fun".

So, how did the brilliant loons who originally developed this application get around having to make SQL calls all over the place? Every time you create a character, the entire database is read into the current session! That's why startup can take a bit. The application is making an object for everything you can modify in the creator.

Okay, so how does this affect adding multiple cyber-arms? It goes back to the "name" thing. Internally, we have an EPCharacter object that has an array of EPMorph objects. Whenever you add a new morph it's added (I'll get to why this is important later) to the array. The EPMorph has an array for gear. Which, probably, includes things like Cybernetic Arms.

So, what's the problem? Well, the traditional (for this app) way to add and remove objects from the array is by looking for a "name". I've mostly converted this to using a more UID (Unique Identifier) approach, but it's not perfect. For one thing, the front end was designed with that constraint in mind. Meaning, no matter how many cleanups I make in the back-end and in the JavaScript, the GUI just isn't designed for allowing either multiple morphs of the same type or multiple Cybernetic Arm.

That seems bad enough, but it doesn't stop there. Remember where I'd mentioned about adding things to the array. Well, there's a problem when we do that. From a technical perspective, what you expect to happen is a new object is created, or in this case copied from that master copy of "Cybernetic Arm". In an MVC framework, that's exactly what would happen, since a new object would be created by reading the database. However, the Creator does not use one of those for Models (yet).* Instead, a pointer to the original object is created.

Why is this bad? Well, because if you modify one instance of an item, then all instances would be changed. For example if Cybernetic Arms allowed you to change their color, then no mater how many morphs you had, they would always be the same color.

I've worked to limit this problem as well, but a simple programming mistake can cause it to rear its ugly head all over again.

What you care about:

The solution to all of these problems is to finish moving to an MVC framework, and re-write the GUI so instead of nested lists, you add an item in one place, and modify it in another.

My problem is time and motivation. I've done the initial move to an MVC framework, but that's just getting it running. I still need to get the database sorted out, move to using proper Models, oh and re-write the entire front end. Because, I haven't mentioned it yet, but this thing was way ahead of its time in terms of single page applications. Which means its GUI does things in ways that make modern web developers want to curl up in a corner and cry.

In addition to all that I am changing my entire personal server infrastructure around. Right now I'm using docker-compose, which means that if the server itself crashes I have to manually go and re-enable it. Which is difficult, because I'm not notified automatically when that happens!

The solution is to move to Kubernetes. Which works, but basically requires me to completely re-do my web server infrastructure from scratch. On the positive side, automatic reboots, potential auto fail over to a second server (if I want to spend the money), and app upgrades with zero downtime.

tl;dr:

Thanks for the report. Unfortunately, having more than one of the same item (outside things like guns where it's just a count) is the hardest thing to do in the current system.

* The latest version of the Eclipse Phase Character Creator uses the Laravel MVC framework. However, that code (which is the master branch) has not been deployed to the server yet.

@EdwinHolley
Copy link
Author

EdwinHolley commented Mar 15, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants