As an on-the-side project, I'm working on a command-line based game. Of course, always wanting to push myself into learning and using new concepts, I've been trying to abstract the game--separating actual elements of gameplay from the display and state storage.
I am stumped. I have no idea where to go or how to separate game elements from the rest of the code (using OOP, of course.) I try to lay out what I want to happen and work from there, but I always come up with a clumsy and haphazard solution. Having the game have multiple environments with different objects, having the objects interact with the user, and still remain separate from the "engine" is something I'm having difficulty implementing. If having a working game is all that I was after, I could do it using my poor techniques without a problem. I'm just sick of churning out code that is fully operational but poor in style :-/
Please help point me in the right direction. How should abstraction work with something like this?
Thanks,
-billyak
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.