I’m looking for some advice on the best way to organize my project. Essentially, a programming architecture. The resources here (forum, docs, API reference, sample code) have been very helpful in figuring out how Corona works, but everything focuses on the API, and how to perform certain tasks, maybe occasionally on how to organize a function or improve performance. I’m looking for how to organize a project.
The director class is a great next step - helps you organize your project into screens. The template included with the director class is helpful too, so each file is structured in the same way.
However that’s where I find the advice here stops. I’ve used the director class, and the template, and my level1.lua file is just initializing the objects, and I have external modules to do the rest. But I don’t have an overall paradigm of how to organize my project. I just write functions or listeners as I need them, and group them into modules if they’re related, but there’s no overall METHOD to what I’m doing.
I’m constantly having to look through all my functions and make modifications to them when I’m adding new features or debugging. I add something that SHOULD work independently, get an error, read through EVERY line of code, make modifications where needed, then repeat. Horribly inefficient. Yes, I do use the console and debugger, but that’s not what I’m talking about here. I feel like I should have a more organized structure that prevents these types of errors, or at least simplifies my debugging process.
And I can’t find any help on this here. The code samples are too small, they don’t show project organization. Even the larger samples, like the Ghosts vs. Monsters sample code, is not helpful for a large project. Everything’s lumped together in the level1.lua file. Imagine creating 20 levels, then realizing you needed a change in gameplay… you have to re-modify every levelx.lua file! That’s not a criticism of the sample code here, and I’m not complaining about the lack of resources - I realize that’s not the point of the sample code, and it’s outside of Ansca’s responsibility to teach programming architectures. But I’m hoping some people would have some good advice.
I’ve done some reading on MVC architecture which seems to make sense the way Corona is written (event-driven), and seems like it would address my problems, but I’m unclear about exactly how it would be implemented. This thread is a great start:
http://developer.anscamobile.com/forum/2010/11/16/game-desing-best-practices
The advantages stated with this approach EXACTLY address the problems I’m having. But without examples I’m a bit stuck on how it actually works with a project.
Are there any more concrete examples of how to architect a whole project? Any sample code or multi-file project templates? Any tips for reading, or other resources? These don’t even have to be specific to Corona or Lua. [import]uid: 49372 topic_id: 9298 reply_id: 309298[/import]
[import]uid: 34945 topic_id: 9298 reply_id: 33967[/import]
[import]uid: 52491 topic_id: 9298 reply_id: 86063[/import]