Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 26 Feb 2007
Offline Last Active Sep 10 2014 12:11 PM

#5087716 YAML vs JSON vs XML?

Posted by Ravyne on 20 August 2013 - 06:52 PM

I think at the very least you could abbreviate that format -- remember that XML is really meant to be a semantic format -- I might do something like the following:

<item id="1" name="sword" category="weapon">
  <description> Just a regular sword.</description>
    <wieldable />

There's quite a bit of art to designing and XML schema, but good designs use elements and properties together in a way that reduces redundancy and encourages correct use. You can define your format using a DTD and validate such files before they touch your game or content pipleline.


Keep in mind that <item> might or might not be a valid element in your schema depending on how much commonality all the different kinds of items have with one another. Say, for example, that it makes no sense for some sub-class of items to have any components, but another sub-class of items might require at least one component. You could enforce this just in the DTD, but it could make maintaining the DTD complicated -- it might be better to not have a generic <item> element, but instead have elements for the different subsets, say <weapon> and <potion>. Like I said, there's some art and intuition behind these kinds of decisions, just think carefully about them rather than tossing the first thing that comes to mind together.

#5087701 YAML vs JSON vs XML?

Posted by Ravyne on 20 August 2013 - 05:47 PM

Those are the three semi-popular go-to choices. 


The downside to YML is that I've heard in a similar thread to this one that what few library options exist, none of them are really implemented in exactly the same way. Thus YML is loosely standardized in practice.


JSON is widely popular and relatively compact, but lacks real tooling.


XML is also widely popular, and has an extensive tools ecosystem (editors, validation via DTDs, XPATH, transformations via XSLT), but XML formats tend to be very, very verbose. Verbosity is fine during development, but its burdensome when you've got to write that data to every user's disk, or push it over the wire to them.


LUA can also be used for data interchange, in addition to scripting duties.



The question, really, is what do you actually need? XML is a structured data format language, whereas JSON or YML are (loosely) structured data interchange formats. In other words, you can use XML to define complex, hierarchical, rigid, versionable data formats, and then use them to exchange data using that format; JSON or YAML is structured in a sense, but only by convention -- your program only understands it as well as it's kept up with the latest changes, and no alarm-bells go off when unexpected data is found.


Personally, I like XML for some things as a content-authoring format, but I dislike it as a content-delivery format. If you use XML to author content, you can use XSLT to transform the authoring format into a format that's more-suitable for delivery, which might be JSON or a stripped-down, lighter-weight XML schema -- perhaps JSON data wrapped in a CDATA section within an XML root node that's just used for versioning.

#5087634 how can i draw like RPG Maker Sprites ?

Posted by Ravyne on 20 August 2013 - 12:53 PM

The Chibi big-head style is a direct consequence of low-resolution sprites of the 80s and early-mid 90s. Those sprites were typically 16x24 or 16x32, and the best way for a character to be distinctive, have personality, and display emotion was to devote fully half or more of the sprite to their face and head. At these sizes, you couldn't even afford to outline your sprites, but later examples of this style doubled the resolution to 32x48 or 32x64, and could them afford outlines.


My personal opinion is that the outlines start to break away from the original Chibi style, and move more towards traditional cartoon-like design and animation. Double the resolution yet again, and it becomes very inviting to break away from the style even further. I think you could do good, high-res Chibi-style sprites, but you'd really need to hold strongly to the underlying principles, otherwise it turns out to be something very different, and possibly odd-looking in an uncanny-valley sort of way.


A fellow by the name of Tsugumo wrote an excellent series of articles/tutorials called So you want to be a pixel artist? They've been around forever and have aged very well. I first started reading them around 12 years ago, and they are every bit as relevant today. They're required reading, so go do that now. Wikipedia also has a decent article on spriting.


Many people are able to do excellent sprite work in Photoshop or even in paint, but I prefer tools more tailored to the task. My choice for a long time has been ProMotion by cosmigo (about $80), but many people swear by GraphicsGale (about $20). There's also Pixen (MacOS, about $10), ASESprite and Grafx2, which are free, but the latter two look a little rough around the edges and I don't have experience with either, so I can't comment on whether their functionality redeems them.

#5087359 Creating My First Large Scale RPG

Posted by Ravyne on 19 August 2013 - 12:24 PM

I don't know a whole lot about RPG maker these days -- I meant to pick it up during the steam sale just to check out the tooling and whatnot, but missed the sale. But, there's a non-trivial number of actual, commercial games (if indie) written in RPG maker, so I'd really investigate whether it can be expanded to meet your needs through scripting or whatever interfaces it provides. That's probably the path of least resistance.


Unity is an ever-popular choice of engine these days, but I've heard mixed reviews as to whether its very suitable for 2D games out-of-the-box. Some say its just alright, others say its horrible. There's Unity2D, I think, that would presumably be a whole lot better suited, but it might not have as much tooling around it as Unity proper.


I'm really not aware of any other good engines for 2D work, though I'm sure some exist. Depending on how comfortable you are with programming, rolling your own might be reasonable. I'd recommend that you use a simplified graphics library to move fast -- something like SDL 2.0 or SFML -- rather than straight Direct3D or OpenGL. Those things are great to know, but if your ends are to create a game, learning them enough to be effective is a much longer route than something simpler. For scripting, I'd recommend Lua because its popular, well-understood, and Lua-Bind will help you tie it to your engine. Finally, if RPG maker outputs files in formats that are reasonably well-understood, or you can reverse-engineer them, consider leveraging as many of their tools as you can. It will be far quicker to leverage those than to write your own, even if you still have to write some simpler tools to close the gap between what you need and what they offer.

#5086918 C in game development

Posted by Ravyne on 17 August 2013 - 07:28 PM

Programming languages are for people, not computers. Even assemblers offer us meatbags much in the way of convenience over inputting op-codes by hand (or even the hypothetical worlds simplest assembler that only lets us write those opcodes with symbolic names). So it is kind of silly to say that using one language or another makes the computer think in a certain way. Demonstrably not true. Using one language or another makes you think in a certain way, but not the computer.


Program in C if you want. That's fine and dandy, but the only thing that C actually offers over C++ is that its a model your own human brain is more comfortable with, and perhaps that its marginally more portable to extremely limited or esoteric platforms, related mostly to the fact that its runtime is simpler and more compact than the C++ runtime -- take note, however, that only the first of those things is any benefit to you as the programmer.


There's a significant amount of software out there that's written in C, its not going to disappear. A lot of that software re-invents aspects of what's already provided in C++ or in other languages. But given that C is a nearly-perfect subset of C++ (There may be differences in the standardese or other small things, but truly impactful differences are essentially non existant), Microsofts slow adoption of C99 not withstanding, there's no really reason to limit yourself to 'C'. If strict C compatibility isn't something you need, you can merrily code along in C and then pull in bits of C++ as needed, rather than reinventing them yourself. Its probably wiser to just learn and use C++ proper, but at least it saves you reinventing the wheel.

#5086898 Generic Datatypes --Are Templates the Way to Go?

Posted by Ravyne on 17 August 2013 - 04:57 PM

If this is an educational exercise, go ahead and learn about implementing things with templates. If its a practical one, the standard template library almost certainly has everything you need, and if it doesn't have *exactly* what you need, you can probably build what you want by combining containers, and perhaps sprinkling in a few other standard library features.


On a related note to that last part, the reason you see your custom list as having more features that are more desirable is because its just doing too much. From your description, its part list, part dictionary (like std::map), and has something to do with translating abstract types to concrete ones.


It sounds to me like what you want is a std::map (add/remove elements, look up an element by a name). If all the types you want to put in the list share a common base class, then you can do something like std::map<std::string, base_class*> and be done with it. If you want things in the list that don't share a common base type, you might first consider whether they really should and make one, or decide they shouldn't in which case you want some kind of intermediate class that can point to different types and handle all the type conversions. Even if that's what you want, separating the different concerns (item lookup from all this type conversion) into different classes is way better than mashing them all together in one class.

#5086284 Whats cleaner? More global variables or getting Values thorugh functions?

Posted by Ravyne on 15 August 2013 - 04:02 PM

Also be aware that that this isn't a two-party system -- the options are not Globals on the left and Functions on the right. A perfectly-acceptable middle-ground might be to poll the input once per frame, hold it in a variable that's defined in a suitably-small scope, and then access that variable wherever keystate is needed. You might access that variable through its name alone, or as part of a class -- whichever you do, you might get ahold of it simply by being in a nested scope, or because it was passed into a function, or because a reference to it was passed into a class that contains that functionality. If you make reasonable choices, and organize your project well, such an approach need not introduce the same kinds of problems that honest-to-goodness global state does.


In general, you should prefer to pass information to functions or classes explicitly, rather than simply making it available implicitly. In this way you state which code is dependent upon which information (or which other code), which makes things easier to keep track off. Furthermore, if you later decide that a class or function really ought to depend on some other information (could just be a different source, it doesn't have to be a different kind of information) then you only have to update those places where the information (or functionality, if a class) is passed in, rather than every place where it's used.


This makes your code far easier to understand, reason about, and change. The code becomes less brittle and more robust.

#5085576 Generic RPG stats.

Posted by Ravyne on 13 August 2013 - 12:10 PM

A very flexible system would be for the object or character to have a stat field that indicates the minimum, maximum, and current values of a particular stat. From there, de/buffs are something applied -- they would never change the current value, but the effective value of the state would be calculated from the stat and the sum of all de/buffs. The effective value can be cached for performance if necessary, but its likely not a real issue.


More generally, de/buffs fall under the category of status effects -- they're a modifier that applies to something based on the presence of something else. Status effects might include things like a character being poisoned, mute, unconscious, or berserk, in addition to simple stat de/buffs. For maximum flexibility, you don't want to limit your thinking to things like one status effect affects only one stat, or status effects don't interact... For example, maybe there's something called the "Ring of Power" in your game that gives you +1 STR, maybe there are "Gauntlets of Power" that give you +2 STR, maybe there's an entire suit worth of "X of Power" armor that each give you +Y STR individually -- what if you want to give the player an additional +20 STR when they have collected and equipped the entire suit "of Power"?


This sort of thing builds interesting choices into your game -- is it better to buy the last piece in your suit "of Power", or is it better to get that Diamond Chestplate that has better base-stats than the Chestplate of Power, but won't give you the bonus buff? Or, what if you loot a mysterious ring from a warlocks home, equip it, and find out that it's cursed! You can't take it off, and the Warlock won't remove it for you unless you pay him 5,000 silver pieces. The penalties are interesting because not only can you not equip other useful rings, the cursed thing might prevent you from ever attaining the kind of bonus buff I described above, because you'd never be able to equip a complete suit "of Power".


Being flexible allows you to be more creative as a designer, and to offer the player more interesting choices that have real consequences. Notice that in the above scenario, choosing to steal the ring from the Warlock was something of a moral choice, it wasn't about simply upgrading equipment. That's interesting for the player, and the experience of being bitten by their greed will have an effect on the way they play the rest of the game. Particularly in an RPG where the game is really about choices and their effects, and with a strong emphasis on stats, equipment, and customizing the character to suit the player's playstyle, it makes a lot of sense to spend time building a very flexible system into those core game mechanics.

#5085224 Mathbook for dummies, any recomendation?

Posted by Ravyne on 12 August 2013 - 10:23 AM



I'd try to make it a rule of thumb not to buy books that insult its readers on the cover.


You should grow a thicker skin then, if you let things like book titles insult you. The whole line of "dummies" books just use it as a friendly pejorative to invite even the most-uninformed to feel comfortable picking up the book. It doesn't mean the reader is a dummy, it says "Hey, its Okay. We're all dummies at one thing or another." A particular dummies book may be good, or not, but its sill to dismiss the literally thousands of books with the word "dummies" or similar pejoratives in the title out of hand.

#5085223 What's your opinion on Game Makers?

Posted by Ravyne on 12 August 2013 - 10:16 AM

That said, we've been polite and friendly, but have been disagreeing (professionally, and with facts) with you. If you consider a 'terrible community' to be polite people who disagree, I'll just warn you: Finding a community of people where everyone just agrees with you is not how you grow. People placating and Yes-manning you, or patting you on the back when you are wrong, does more to damage your growth and skill than people being rude does.


Well, that's true for the most part, regarding the content of people's replies. But I'd also say that the OP is being a bit mistreated in the way he's being rated on at least some of his posts. Might he be a bit naive and a touch arrogant? Perhaps, but there's really no reason this post should be at -3:



I think the more salient question is: why do you care what other people are doing on their own time? Personally I don't like sour cream, but I don't get angry if a stranger orders a burrito with it.


Because it makes me feel useless when I code. It makes programming seem pointless. It makes me feel as if I've wasted the last 3 years of my life learning to program.



It maybe comes of as a bit whiney, but its not wrong to feel that way, and it seems to be a direct and honest answer to Facehat's question. I'm sure plenty of auto-factory workers in the 70s questioned their value and life-choices when robitics came in and could do their work better and more cheaply. The OP may not see his way past it, but its perfectly natural to question your worth if the path you've chosen is harder, but can be widely replicated by those with perhaps less in the way of hard skills.

#5085091 Describe your personal system for managing ideas & things to do

Posted by Ravyne on 11 August 2013 - 09:58 PM

Microsoft's OneNote is pretty nice. You can buy it standalone, or it comes with every version of office (even the student pack), or with their Surface products (Pro and RT).


Its kind of a digital notebook. You can add pages, sections, and new books. You can search text, even text in images. You can paste in word docs, excel spreadsheets, etc. Its not free, but its nice. Its great for managing a loosely-collected pile of information, and for keeping notes about on-going projects.


For todos, I mostly do what hodgman does -- post-its, white-board, calendars, I'll sometimes set reminders in outlook for work stuff. I also use google calendar to organize my social life a bit -- Everyone in my circle of friends has a calendar of their own, and we have shared ones for different things, say concerts, which make it easy for everyone to know what's coming up and who's going. You can create templates for different kinds of events, send email reminders, etc. I don't use it for professional things, but it could be quite useful if you're not concerned about giving google that kind of data (you can make private calendars, but anything in the cloud is only as private as the service provider really makes them).

#5084567 EventBus - Possible with C++ templates?

Posted by Ravyne on 09 August 2013 - 07:31 PM

So, the short version is that while Generics in Java or C# seem conceptually similar to C++ templates, they're very different beasts. Thinking in one while programming in the other is a recipe for misery and failure. Its perfectly doable to create a bus for events in C++ of course, you're just not going to accomplish it in the same way you would in Java, and if Java is your standard for what's nice or elegant, then C++ is likely to disappoint you until you understand why it is the way it is. In other words, an elegant C++ solution probably doesn't look like an elegant Java solution, and you probably don't make use of the solution in the same way either.


I imagine other things about C++ probably seem distasteful too, like free-standing functions (those not part of a class, or even a namespace), perhaps operator overloading, pointers. Java is a very dogmatic, language-designer-knows-best sort of language, while C and C++ are explicitly opposite. As languages they have different perspectives, and that leads to justifying all the usual trade-offs in different ways.


Anyways, I don't mean that to sound snarky, its just a reality of the two languages and where they come from.

#5084558 What's your opinion on Game Makers?

Posted by Ravyne on 09 August 2013 - 07:09 PM

Who cares. If a particular power-drill would've driven your screws just fine, I'm not about to assign you any extra points for subjecting yourself to the misery of using a screwdriver just because you think its more hard core. Certainly not if if it takes you 6 times as long to achieve same or less quality overall.


Tools are tools. I don't understand all the rage and hate. Unless... Did GameMaker touch you? Was it Scratch? GameSalad! Someone call the FBI! Show me on this doll where they touched you!

#5083730 Used old C++, Sudden feeling overwhelmed.

Posted by Ravyne on 06 August 2013 - 07:43 PM

The way I see it, you're kind of in luck. Nearly all of the must-have books have recently been updated to C++11--Lippman et al's C++ Primer 5th Ed, Bjarne's The C++ Programming Language, and Josuttis' The C++ Standard Library: A Tutorial and Reference being the first three you probably want--Meyers' Effective C++ is not yet updated, and as a book is probably most-useful when you have a better understanding of C++11, along with the standard library; depending on how he revisits the content from the 2nd Ed, the current 2nd Ed may or may not remain a valuable resource. Avoid "More Effective C++" it hasn't yet gotten a 2nd Ed, and it was published between C++96 and C++03, so its pretty outdated (there are some gems of info inside, so read it if you can borrow a copy, just don't waste your money on it at this juncture).


If you approach C++11 with a clean slate (that is, leverage your experience with the syntax, but try to forget your "old way" of doing things), then you'll have a good time. While C++ is larger and more intimidating, it actually is a great stride towards writing correct code that's easier to maintain if you use the tools properly, and the C++ standard library has been expanded upon with many helpful classes, like regex and smart pointers, that you previously had to build or find from a third party.


Good luck.

#5083665 My OLD Syntax

Posted by Ravyne on 06 August 2013 - 03:29 PM

I think the point Swiftcoder is driving at is that bool->int, and int->bool conversion only makes (some kind of) sense inside of C's kind-of-insane interpretation of any non-zero integral type as true. I mean, it might be a neat party trick, but what would we really benefit by being able to multiply some integer by a boolean value? There's no actual relationship between the two types, except for the arbitrary rule that was applied.