Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

182 Neutral

About AmagicalFishy

  • Rank
  1. AmagicalFishy

    Generating and initializing content for a text RPG

    Whoa. What language was it, if you don't mind my asking?   Just to clarify, "I hate it" referred to hating the floundering. I love C++ !
  2. AmagicalFishy

    Generating and initializing content for a text RPG

    That particular website has helped me out a lot, actually!    I've been programming for ~4 years indeed, so I understand the floundering around (though I only started w/ C++ a couple of weeks ago).   But god damned do I hate it. 
  3. AmagicalFishy

    Need to be taught to make a 3D MMORPG

    I don't know much about game engines, but isn't Unreal like... the EA of engines? (That is, you can't actually do anything without buying a bunch of game-engine "DLC" equivalents.)
  4. AmagicalFishy

    Generating and initializing content for a text RPG

    I'm spending a ton of time floundering around, struggling to get syntax correct—and not actually learning anything.  There is a distinct lack of good, succinct tutorials.
  5. AmagicalFishy

    Generating and initializing content for a text RPG

    Thanks, guys.   After a lot of research, and some benchmarking I've decided to go with rapidjson.   Now to figure it out!
  6. Point me in the right direction, please! So, I've got a basic (albeit, over engineered  ) text-RPG system down. Rooms, with characters inside of them, and items inside of those. Characters can move, interact, get items, etc. There's a class that parses player-input-commands and is imported by the main game loop—so the basics are there. Now that I have all the basic systems down, I'd like to start creating and storing the world, but am at somewhat of a loss as to how to do this.   I'm using C++, and can think of several things: Hardcoding the creation of each object and its containers in C++. For testing purposes, this is working for now, but it's not a long-term solution   An SQL database - which I really want to use, just because I think it'd be a good learning experience). This would require learning a C++ interface for SQL (or maybe a non-SQL database like MongoDB). I'm looking at SQLite now.   Text files - which I don't want to use, but might be easier. I'd do something like have a "Rooms" file, a "Characters" file, and an "Items" file or something. I'd then have to figure out a way of getting C++ to read the appropriate lines from these files and use them to instantiate the respective objects   JSON, XML, etc. - which I don't fully understand, but think it's something that turns strings into numbers for easy storage and recalling. Might it be the interface through which Rooms will probably have to be hard "coded" at first (until I get to random-room generation!)  Items and characters (i.e. - monsters) I'd like to randomly generate.  So, what do you guys use, and how do you use/implement it? 
  7. AmagicalFishy

    Is my object-structure bad? [Related to Text RPG]

    Excellent! Thank you, this was exactly the type of advice I was looking for (especially the one-way references).    It's totally doable to get rid of most of the Character verbs and group everything up in the handler. My purpose for having them was moreso for programmer-intuition. Something like: If the player types in "get item," then the resulting command sent to to the game would be Character->get(item). The Character.get method tries to associate the "item" string that the player typed in with an item-pointer in the inventory. If that is successful, it really does just pass along a message—and the handler does all the work of removing the item-pointer from the Room and putting it in Character->inventory_,  printing out a message like "You get [item]," etc. Otherwise, we get something like "You don't have that item."   I can similarly get rid of the World class entirely in favor of the Character class directly creating events. Or even having the Character class itself do all the work that the handler would otherwise do (but I don't think this translates well into multi-player, and don't really like the idea of the main classes [Room, Character, Item] having direct access to one another).    Maybe the best way to go about it would be: Rooms know what Character they contain (vector of pointers to const) Characters know what items they have (vector of pointers to const) Notifiers notify Handlers do the dirty work Characters directly create events (move events, item events, etc.) The most direct way would be just for Character A to call a method in Character B, but I don't like this idea (nor do I think it scales well to multiple characters interacting). The World class existed to be the structure in which the notifiers/handlers existed, but there's nothing wrong with them just free-floating.   Maybe I'm just thinking too much about structure? (I love thinking about structure, but at the same time I want to progress!)   haegarr, that sounds pretty awesome, actually. Let me make sure I have the idea straight:   Define an Interrelation container which just holds pairs of unique IDs, and call an instance of this "presence," for example. For a character to contain an item, the ID of the character and the ID of the item are combined and put in the table. For a room to contain an item, the ID of the room and the ID of the item are combined and put in the table. To check if a room contains a character, just see if the ID-ID key is in the table. Is this correct?
  8. I'm building a text-RPG and, while everything's working fine for now, I'm concerned that my structure sucks. The primary objects in play are: Characters Rooms Items Notifiers Handlers (Attack, Item, and Movement handlers) World (stores handlers, notifiers and events) The basic process is something like this: Character.move() from Room A to Room B World registers a move-event MoveNotifier.notify() Registered handlers receive notification and do their thing (i.e. - MoveHandler takes the pointer to Character stored in a member of Room A and moves it to the respective member in Room B. DescriptionHandler prints out the appropriate Room B description, what items it contains, etc.) (I know the notifier-handler thing may be a bit overkill for a single-player text-RPG, but this is all practice for the big picture—please think of this as early practice for creating a larger, multi-player game.)   Here's my worry: Many of these objects store pointers to other objects. Character has a pointer to the Room in which it stands, while Room has a vector of pointers to every Character contained within it. This doesn't feel right. Part of me thinks that Character should know what Room it stands in, but another part of me wants every object to be totally independent and self contained. If everything should be self-contained, then my question is:   Is there a standard line of containment? Should Room know what Character is in it? Should a Character know what Item it has equipped? Should an Item know what Enhancements it's infused with?   If nothing should be aware of anything else, then should everything be stored in a relational database? I've been looking into object storage w/ MySQL or some SQL variant anyway.
  9. AmagicalFishy

    Terraria clone. What do I need to learn

    Tangletail: I understand that parts of these fields play a role in randomly generating a world, but my point was that saying something like "you have to study advanced mathematics. Study trig, algebra, calculus, discrete mathematics..." isn't helpful. For example, discrete mathematics covers everything from set theory, to number theory, to information theory, to game theory—which are all huge fields in and of themselves, and wildly different. Some of the most prominent theoretical mathematicians study "discrete mathematics," while some of the earliest high-school classes teach it.   As much as I love and encourage learning of mathematics, I'd be sorry to see someone who just wants to randomly generate a world undertake such an enormous endeavor of study, thinking it will teach them how to do so. On the other hand, your most recent book suggestions are much better; they're specific to game design.   Might I suggest a process to OP, which I find pretty helpful: Start with (very) small things and work your way up. You know you want to randomly generate [complex] worlds. Start with simple, 2D cave generation (read the link that SimonForsman posted above) and slowly work your way up from there.
  10. AmagicalFishy

    Terraria clone. What do I need to learn

    OP: I'm not sure what your current education level is, but "Trig, algebra, calculus, discrete math, vector algebra, and algorithms" is a huge, totally non-specific list. Furthermore, you could take multiple classes in all of these (except maybe for algorithms) and still be totally clueless as to how to apply these to randomly generated worlds. Unless you're looking for the mathematics to be your primary focus, I think using the internet to find specific things will be a much better option than books.   Don't get me wrong, a good grasp of mathematics will always help, and if you want to learn all the mathematics required for a really in-depth, intuitive understanding of what's going on, then good! But you don't need to learn all of those things to be able to use an algorithm.
  11. AmagicalFishy

    What do you guys use as a key in RPG data structures?

    They're not, no.  I was just using them as an example, though.
  12. AmagicalFishy

    What do you guys use as a key in RPG data structures?

    If anyone reading this thread is similarly confused about decorators, this article really helped me. I revisited the (totally wrong) implementation of the Weapon wrappers that I attempted above. #include <string> #include <iostream> // Superclass class Item { public: Item() : durability_(100) {} void crumble() { std::cout << "Your item broke!\n"; } int durability_; }; // To-be wrapped class Weapon : public Item { public: Weapon() : Item() {} virtual void chip() { durability_ -= 6; } virtual void raise() { std::cout << "The sword is raised into the air\n";} }; // Decorator SuperClass class WeaponDecorator : public Weapon { public: WeaponDecorator(Weapon* baseWeapon) : baseWeapon_(baseWeapon) {} virtual void chip() { baseWeapon_->chip(); } virtual void raise() { baseWeapon_->raise(); } private: Weapon* baseWeapon_; }; // Decorators (which take after WeaponDecorator superclass) // Strong weapon halves the durability loss for chip() class StrongWeapon : public WeaponDecorator { public: StrongWeapon(Weapon* baseWeapon) : WeaponDecorator(baseWeapon) {} virtual void chip() { WeaponDecorator::chip(); durability_ += 3; } }; // Fire weapon sets the weapon aflame class FireWeapon : public WeaponDecorator { public: FireWeapon(Weapon* baseWeapon) : WeaponDecorator(baseWeapon) {} virtual void raise() { WeaponDecorator::raise(); std::cout << "It's on fire!\n"; } }; int main() { Weapon* baseWeapon = new Weapon; WeaponDecorator* enhancedWeapon = new StrongWeapon( new FireWeapon(baseWeapon)); enhancedWeapon->raise(); enhancedWeapon->crumble(); return 0; } The output:  The sword is raised into the air It's on fire! Your item broke! I'd explain more in-depth, but I'm pretty sure everyone in this thread already knows what a decorator is.  Now to go back and read the relevant posts.   Thanks for the help, everyone.
  13. AmagicalFishy

    What do you guys use as a key in RPG data structures?

    Sorry for being a little dense—I'm just not quite wrapping my head around this. (huehuehuehuehuehuehue) class Item { Item(std::string name) : durability_(100) { name_ = name; } void break() { std::cout << "Your item broke!"; } int durability_; std::string name_; }; // To-be wrapped class Weapon : public Item { Weapon(std::string name) : Item(name) {} void chip() { durability_ -= 5; } void rust() { durability_ -= 7; } } // Wrapper class StrongWeapon : public Item { StrongWeapon(std::string name) : Item(name) {} Weapon* baseWeapon = new Weapon; void chip() { durability_ -= 2; } }; // Wrapper class GlowingWeapon : public Item { GlowingWeapon(std::string name) : Item(name) {} Weapon* baseWeapon = new Weapon; void glow() { std::cout << "You're blinded by your own weapon!"; } }; Do I have the setup right?    The idea is that I can now have a strong weapon, a glowing weapon, or a strong-glowing weapon, right? I've seen code like this in all the tutorials, but it seems to either go on for 350 more lines, or just stop there.  I guess I'm not sure how to use these wrappers. How does a GlowingWeapon access the rust() method? Is it going to be something like: GlowingWeapon->baseWeapon->rust() ? Or just GlowingWeapon->rust() ? If it's the latter case, how (and why) does this work? How do I create a Strong, Glowing Weapon? Also, is it true that anything that takes a Weapon (or a pointer to a Weapon) will also be able to take a GlowingWeapon, or StrongWeapon (or both?)    I understand that "one class wraps another to change functionality," but beyond that I'm totally confused, and having a really hard time finding clear, succinct tutorials.   (Thanks for your patience, guys.)
  14. AmagicalFishy

    What do you guys use as a key in RPG data structures?

    So the wrapper only modifies the already-existing methods of the wrapped? That is, it doesn't add or remove any actual members?
  15. AmagicalFishy

    What do you guys use as a key in RPG data structures?

    Another question (pretty unrelated to the title of this thread: I've been reading a lot of the decorator and component patterns (I'd like to implement it for items. For example, while an inheritance pattern would look something like Item -> Equipment -> Weapon and Item -> Equipment -> Armor, I'd like to just wrap an item in an equipment wrapper, giving it stats, and then in a weapon wrapper, maybe giving it a damage-boost stat or something like this.   I'm not actually sure what wrapping entails, though. All the tutorials I see are... not very helpful. From what I've seen, it looks like putting an item object inside of a weapon object? Then accessing a weapon method  would be something like item->weapon->method()? I was under the impression that decoration should actually add the method, like an item wrapped in a weapon decoration would just be item->method()?. I'm having a hard time figuring out how to do this without inheritance. 
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!