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

Improve directory structure #45

Open
fleskesvor opened this issue Sep 27, 2017 · 7 comments
Open

Improve directory structure #45

fleskesvor opened this issue Sep 27, 2017 · 7 comments

Comments

@fleskesvor
Copy link
Contributor

We should improve the directory structure of custom scenes to improve re-usability.

What this means is that scenes and their direct dependencies should be compartmentalized to make it easier to build a mental map of how the game is structured, plus make it much easier to re-use things like player characters and action menus in new rooms.

A rough layout might look something like this:

scenes/
├── characters
│   ├── astronaut
│   ├── detective
│   └── doug
├── items
│   ├── bag
│   ├── board
│   ├── boulder
│   ├── moai
│   ├── pedals
│   ├── pipe
│   ├── rug
│   ├── screw
│   ├── seat
│   └── ship
├── menus
│   ├── doug
│   └── space
└── rooms
    ├── clock
    ├── cop
    ├── doug
    ├── hub
    └── space

Where each directory contains a scene (*.tscn file) and a sprites/ directory with the files it uses, plus an animation GDScript file in the case of player characters.

The advantage of this is that if we eg. want to make another doug room, we can just instance the doug player scene and the doug action menu into it without having to either duplicate them or create direct dependencies on different rooms.

Escoria scripts (*.esc files) should remain in the rooms they are used, since we might want to re-use items but have interactions trigger different actions depending on which room they belong to.

This isn't a trivial change, since it will break references within scene files (*.scn and *.tscn), but it might be broken down into manageable chunks by creating the scene directory structure and start moving a few things, like the player scenes at first. Thankfully, Godot has a nice menu for fixing broken dependencies, which will make this task easier.

For reference, there's 187aaa9, which I'm not sure ended up doing much good.

@JenniBee
Copy link
Contributor

That sounds like a good idea. I like the idea of separating out items.

There is one set in particular that I wanted to move out to a more easy to find area, and that's the active inventory items scripts. Most of them are currently in global, which is really not helpful. It would be a good idea to move those out to the directory of their respective inventory items too.

@fleskesvor
Copy link
Contributor Author

Yeah, that sounds like a good idea too. This could be done in multiple steps, and maybe @etisdew wants to take a look at some of it, since he was looking for some tasks to get familiar with the project.

@ghost
Copy link

ghost commented Sep 27, 2017

I'm in. Long time no see JenniBee. Where do we start, considering it will break what I can only assume is a default structure?

@fleskesvor
Copy link
Contributor Author

fleskesvor commented Sep 28, 2017

Great! There isn't really a default structure. The example room that comes with Escoria has all its scenes laid out flatly in a single directory, with only sprites separated into a subdirectory. If you need to revert to a stable state though, that's easiest done with git reset, optionally with a commit hash if you have local commits that work.

I think the best way to start might be to move rooms/doug/player.tscn into characters/doug, see that it breaks and then try to fix it. That will give you a better idea of how things are connected.

To fix the build, you will have to load the moved player.tscn in the editor and fix the problems Godot complains about. Then you will have to do the same with rooms/doug/doug.tscn, since it references the now moved player scene.

After that, I think the build should be stable again, so that's a good place to commit locally to get a "save point" to revert to before you do the same thing with the detective player scene. The space player scene might be a bit tricky since we did a bunch of custom stuff with that whole room, so that might be tricky.

When you're happy with your commits, you can push them and make a pull request. Let me know on IRC or the DFAF Discord if you're having trouble. I'm always happy to help, but I think we're active at very different hours since I'm based in Europe.

The ultimate goal is to move the whole characters directory into the proposed scenes directory, but I think that's unnecessary complexity in the short term.

@JenniBee
Copy link
Contributor

JenniBee commented Sep 28, 2017

Nice to see you again too estidew. I'm happy that you are willing to work on this. 👍

A nice feature of the Godot editor is that you can click on a tscn file to see its dependents. If one of the dependents is broken, it will appear red. Then you can simply choose to browse for a replacement, and you can choose the new location for that file.

It's still going to be a pretty massive task, but that should help ease things a bit.

@ghost
Copy link

ghost commented Sep 29, 2017

I just pulled a full ride with Lambda School! Been a little chaotic but thank you for the task, this is a good chance to get up to speed on using this engine. Could I get a discord invite at [email protected]? I frequently close my browser. I'll be back online tonight to hit this one. -8GMT

@fleskesvor
Copy link
Contributor Author

Nice. :) Which course did you take?

I just sent you an invite by email. Let me know if you need any help with the refactoring or if you want to do something else. (There's a PR for another scene that you could use to get experience with .esc scripts if you want. I just need to tie up some loose ends first.)

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