[Kde-games-devel] Restructuring and rewriting KGoldrunner

Luciano Montanaro mikelima at gmail.com
Wed Jan 21 13:19:00 CET 2009


On Wed, Jan 21, 2009 at 12:26 PM, Parker Coates <parker.coates at gmail.com> wrote:
> On Tue, Jan 20, 2009 at 23:37, Ian Wadham wrote:
>> KGrSprite... KGrLevelPlayer... KGrEditor... KGrLevelPlayer...
>> KGrGameData... KGrLevelData... KGrLevelGrid... KGrHero... KGrRuleBook
>
> If you're refactoring the code, may I suggest dropping the KGr prefix
> from the class names and instead place all your classes in a
> KGoldRunner:: namespace? I made this change early in the development
> of Killbots and found it made things cleaner and more readable. Of
> course, that's almost purely a matter of personal preference, so feel
> free to disagree.

I think namespaces are worth using for libraries, maybe large
applications, but for a
small program as KGoldrunner, the namespace is an overkill.
Even the "KGr" prefix is not really needed, after all the code is
going to be used for the single program, so conflicting class names
are unlikely.

>
>> Whilst the main objective is to re-design and re-write the game
>> engine, I would also like to make the whole program as much
>> as possible Model-View-Controller (MVC).  So the game engine
>> will consist of classes descended from QObject (and ideally
>> nothing else) and will communicate to the view, sound-player
>> and controller code only by signals and slots.
>
> I've just launched a similar effort in Killbots. My Engine class was
> already in good shape as it was independent of the graphics system
> used, but my Scene and Sprite classes currently contain a mix of code
> that provides both basic game functionality and graphical display. To
> make the front end / back end separation even cleaner, I've decided to
> split those classes into BaseScene, GraphicsViewScene and BaseSprite,
> GraphicsViewSprite. The game logic in the Engine class will only use
> the Base classes.
>
> So in the future, this would enable me to replace the GraphicsView
> classes with QPainter or KGL ones without changing a single line of
> existing code other than where those objects are created in the
> MainWindow class. I'm not familiar enough with the KGoldRunner code to
> know if a similar split makes sense for you, but I thought I'd mention
> it as it seems on topic.
>
> Parker
> _______________________________________________
> kde-games-devel mailing list
> kde-games-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kde-games-devel
>



-- 
Luciano Montanaro

Anyone who is capable of getting themselves made President should on
no account be allowed to do the job. -- Douglas Adams


More information about the kde-games-devel mailing list