Jump to content

  • Log In with Google      Sign In   
  • Create Account

Ravyne

Member Since 26 Feb 2007
Offline Last Active Today, 12:44 AM

#5274106 Multiplication and division of four chars packed in one int

Posted by Ravyne on 03 February 2016 - 01:49 PM

For multiply operations you need a 16bit result potentially, unless you know your operands have a small magnitude. If you know that the left-most bit positions carrying a 1 in each operand sum to less than 8, a multiply won't overflow (e.g. 10000000 x 00000001 won't overflow, 00001111 x 00001111 won't overflow, as a kind of special case even 00010000 x 00001111 won't overflow -- but 00010001 x 00001111 does). To be suitable for larger operands, you need to provide more than 8 result bits -- at least temporarily if you know you can get the result back in range by the end of the algorithm. These extra bits would take the form of the most significant result bits.

 

Division is similar, but you need at least an extra result bit on top of the 16 bit result multiplication needs and all the extra bits would take the form of the least significant result bits.

 

One technique you could try would be to transform the algorithm algebraically to see if you can bend it into a form that's more suitable for your hardware -- e.g. replace divisions with multiplications by the inverse (which can win if you only need to calculate the inverse once and its used multiple times, or if you can accept a faster approximation -- a trick Quake used, IIRC). There are other old-school tricks that could help -- for example, multiplying and dividing by powers of two can be replaced with shifts, which are often but not always faster than multiply and usually faster and never slower than divide.

 

If your hardware really lacks SIMD (The ARM--I'm assuming, since its a smartphone--equivalent would be NEON, or VFP on very low-end devices, but I'm not sure how much either of them supports integer math) it might also have no/slow hardware divide instruction, in which case eliminating divides alone would be a huge gain. If your hardware does turn out to support NEON (and maybe VFP) you might find that its actually faster to use SIMD floating point math instead to take advantage of those instruction units, converting from and to your 8.8.8.8 bit format at the beginning and the end of your algorithm (or doing away with it in your filtering pipeline entirely).




#5274097 Footware at work

Posted by Ravyne on 03 February 2016 - 12:51 PM

Yeah, just get some slippers/loafers/sandals -- something with a rubber sole though; I don't think I'd like using communal bathroom facilities with a foam or cloth foot-bottom, not to mention subsequently tracking it all over the office. Something comfy, easy on/off, and suitable for indoor/outdoor use is probably a good place to start.




#5274093 Multiplication and division of four chars packed in one int

Posted by Ravyne on 03 February 2016 - 12:42 PM

I'm not aware of any software algorithm to do this, it takes specialized hardware instructions to do this kind of thing -- even add and subtract don't work as you think they do, they'll fail if any of the 4 bytes underflow or overflow.

 

You could pack fewer bytes into a word to avoid this, but I suspect you'd spend as many instructions shifting and masking as you're spending on adding and subtracting individual bytes.

 

What hardware are you targeting that there's no SIMD (SSE, or something like it)? What actual algorithms are you trying to speed up? There might be better ways of optimizing them.




#5273928 Game Title

Posted by Ravyne on 02 February 2016 - 01:53 PM

In this day and age, one of the primary concerns is searchability -- When your potential customers enter your title into google, you want at minimum the top 3-5 slots pointing unmistakably at your game. Preferably, if you've engaged with media in the right way, you can dominate the first several pages of search results with your website first, followed by reviews, Youtube videos, Let's-Plays, and Twitch streamers.

 

Being able to secure a highly-related URL factors into that, and helps ensure customers that they've found the genuine article. You should use the whois service to ensure such URLs are available, and if you have a few options you really like, its usually a worthwhile investment to lock down the .com and .net (at least) early on. I'm sitting on a handful of URLs related to game titles and the like myself -- it costs around $12/yr to register com/net/org and many others -- though some of the trendier top-level-domains (like .io) can go for ~$70. Once you've settled on one name, you'll want to snap up all the lesser 'common' TLD variations (ie .org, .info), and probably variations on your URL withing the most common TLDs (e.g. if you finalize on darknessarise.com, you'll probably want to lock down darkness-arise.com and darknessarise-game.com -- you'll also want to do a whois search against those URLs in your investigation phase also)

 

 

Finally, don't take it entirely upon yourself to name your project inside a vacuum. You can and should seek feedback from people outside the project -- specifically, people in your target demographic. A name you personally like and has meaning to you is often far less valuable than a name that your target market finds appealing. You can and should do focus-group style testing -- use your local Craigslist and offer $20 bucks and a free copy of the game for an hours time in an easily-accessible location (e.g. college campus if that's your demographic) or via Google Hangouts; or throw a survey on Mechanical Turk (you pay a small amount--you choose how much--for each result) -- using Turk you can have them watch videos or whatever it takes to inform them, you just have to balance what you're offering to pay with the time you ask for.




#5273088 Recommendations for a Text Editor

Posted by Ravyne on 28 January 2016 - 06:17 PM


With the continued rise of the "Web 2.0 Text Editors", though, I have to say that GitHub's Atom is equally capable, and free. If I didn't already own a Sublime Text license, it would be my go to editor.
 
Visual Studio Code is also a great alternative if you ever need to work with Microsoft technologies.

 

VS Code is my recommendation -- but I might be baised, working for Microsoft and all.

 

Its actually build on Atom's open-source shell (Not the editing itself, but the web-based front-end and node-based back-end) and very recently opened up its extensibility APIs for themes, highlighters, and plugins. And it became open-source that same day, its written in typescript. Even before going to extensions though, the editor itself and how it works with external tools is highly, highly configurable through some really nice JSON files.

 

Since then, there are tons of plugins for all your favorite languages available from the Visual Studio marketplace which you can access right inside Code. From what I can tell, debugging seems to be the stand-apart feature over Atom or other editors, and Code is at or nearing Parity in other regards. 

 

Its now my go-to editor when VS itself is unavailable (OSX, Linux) or heavier than I need. I still prefer VS for heavy lifting, but that would probably be less true if I did less of my heavy lifting in C++ and more in, say, C# (Code is only beginning to get more than basic support for C++, and its got better C++ support (e.g. intellisense) on non-Windows platforms so far), and I still use Vim when I want something super lightweight, only have a terminal, or to use its powerful programmatic editing commands.




#5272110 C++

Posted by Ravyne on 21 January 2016 - 02:09 AM


!@#, it's really rude to go on a downvote spree, downvoting the whole thread because someone disagrees with you.

 

QFE.

 

 

[edit: additional comments removed by moderator]




#5271883 How to actually measure stuff like cache hit, prefetch, ram traversal?

Posted by Ravyne on 19 January 2016 - 01:16 PM


Mistrust any advice about DoD or performance who use the term cache coherency in that context, ...

 

That's a good point, I'm sure I've made that mistake myself, and I know I've seen it made numerous times in articles and forum threads alike. I seems like a word that might mean what they meant, but its not. I guess something like cache locality is more apt, or perhaps temporal locality more generally.

 

To me, data-oriented-design boils down to two things -- firstly, the understanding that memory accesses (specifically, cache-line loads and stores to main memory), not CPU cycles, are the true bottleneck in most heavy computations, and secondly, following from the first, that the shape and flow of performance-critical data should be the prime concern, even above algorithmic, micro-optimization, and dogmatic object-oriented design considerations. What DOD is NOT, is recasting every inconsequential corner of your application to be "cache friendly".

 

DoD is often cast in opposition to classical OOP techniques because OOP places a lot of emphasis on human-centered object modelling, and its true that you have to cut against the grain of much OOP programming advice, but OOP is still a valuable tool in implementing DoD architecture, and in the rest of your program. 




#5271879 C++

Posted by Ravyne on 19 January 2016 - 12:49 PM

 

Meyers' books are great, but they're hardly for the novice -- and "More Effective C++" is woefully out of date since it never received a second edition (there still are some gems of wisdom inside, but its something you might want to check out from a library and peruse rather than buy and read cover-to-cover). Effective C++ 3rd edition and Effective Modern C++ should definitely be on your bookshelf, they just aren't the first ones that should be there.

 

And Modern C++ design is also a great book, but its also entirely dated since the advent of C++11 and C++14 which greatly added to the template meta-programming facilities provided by the standard library (std::is_* and friends) and by the language itself (variadic template arguments, auto, etc). 5+ years ago it was a must read for the advanced C++ developer, now its probably not much of interest except for serious library providers who use TMP techniques, and especially those who must maintain support for older compilers.

 

 

I do like Bjarne's small, red book A Tour of C++, but its true that the material is included in his large, blue book The C++ Programming Language, which you should soon add to your bookshelf anyhow. Tour has its merits, but its redundant if you're set on its larger sibling.

 

 

For the beginner, the very first book I'd recommend would be either Bjarne's Programming: Principles and Practice in C++ 2nd ed., *or* Lippman's (and friends) C++ Primer 5th ed (not C++ Primer Plus buy a different author).

 

The next tier of books you'd want are Bjarne's The C++ Programming Language 4th ed. and Jossuttis' The C++ Standard Library -- both fall under a style I like to call "Reference by example" -- which basically means to me that each chapter is more-or-less self-contained and can be read individually, you don't have to read it front to back (but you can, of course), you mostly just dip into whatever you need to know about as you need to know about it.

 

The third tier of books is where you'd find books like Meyers'. They're probably more practical than the 2nd tier books in many ways; I certainly don't mean to say that they're not useful until you've read most of the 2nd tier. I only mean to say that I wouldn't buy them *before* buying the second-tier books, but do buy them at the same time if you can afford to.

 

[EDIT] corrected confusion between C++ Primer (excellent) and C++ Primer Plus (less excellent).




#5270120 Fast C++ book

Posted by Ravyne on 08 January 2016 - 12:31 PM

There are two books you should absolutely own as reference -- The first is as Bregma mentioned: The C++ Programming Language by Bjarne Stroustrup, and the second is The C++ Standard Library by Nicolai M. Josuttis. You'll be wanting the most recent editions of both, 4th and 2nd respectively. These should be on every serious C++ programmer's bookshelf -- I buy mine in hardcover. Both of these books will give you a lot more depth than any one place on the internet will, especially if you're interested in history or theory.

 

For a very quick, but surface-level review of a language, I've had good experiences with O'Reilly's Pocket Reference books. They're small and inexpensive, but they'll hit enough of the high points to be able to re-familiarize yourself with the basics of features you don't use often. For example, when I've interviewed for jobs in the past where the gig uses a language I haven't actively used for awhile, I find these books to be a great, quick refresher, and since they're inexpensive (usually < $10) I can always just go buy the latest one.

 

After that, Scott Meyers' Effective Modern C++ (1st) and Effective C++ (3rd) are also something you should at least read, if not own. There's also More Effective C++ but its very aged at this point because it never got a second edition or update -- still, there are probably some gems of wisdom in there so I would say its a read if you can get your hands on it, but don't buy unless maybe you find a really cheap used copy -- Even Effective C++ is starting to age, but its 3rd edition is new enough to be a worthwhile addition to your bookshelf.




#5269900 Average revenue/dev time for mobile game?

Posted by Ravyne on 07 January 2016 - 01:47 PM

I'm convinced that at this point, they only way to break into the market (PC is more forgiving in many ways, but mobile especially) and reach a sustainable, worthwhile revenue stream is to plan that it will take you several well-polished games.

 

There are a lot of one-and-done developers out there who go in expecting to have cash just roll in -- and when they find that to not be the reality, or even close, they abandon their games and their users, fail to make updates, and -- if they make another game at all -- usually reach for something even more ambitious, and equally flawed. Those games are actually the majority of what's out there, hundreds or thousands per day.

 

But there's also a strong tide of good-quality, polished, fun games coming out all the time too. 10s each day, if not 100s, You have to match that polish, even if your game is simpler (contrary to appearances, a game like flappy-bird was highly polished). You have to compete with these guys to even begin to make a name for yourself, no one cares at all how the 1000s-per-day set-are slugging it out over nickels. Aim for minor-league, not beer-league.




#5269892 (yet another) best language to code a game?

Posted by Ravyne on 07 January 2016 - 01:27 PM

I think the answer, still, is to go with what you're comfortable with, if for no other reason than to eliminate the crossed wires of learning two things at once -- a new language, and a new (and very different) problem domain. Furthermore, games that push the performance envelope often lead programmers to bend the normal rules of good programming practice in whatever language, which can lead you to dark corners of this language that are going to be quite opaque if you're also learning that language just then, and also won't look like the "clean" example code you'll find in "normal" books and discussions in that language. If your game does not push the performance envelope, then you can just use "normal" coding idioms, but at that point its also probably true that any language you could reasonably choose is more than capable.

 

The pertinent part of your question is really about libraries and learning resources. C++, C#, Python, and Java all have plenty of libraries to give you what you need, and mostly (from the outside) those libraries will reflect the average complexity one would expect from the host language (they may be more complex than average libraries in their language, but relative to one another they are the same), and as well for performance. Just the usual considerations.

 

All things considered, my own choice would be C#, especially if I didn't already know C++ and especially if I *did* already know C#. I don't like Java as a language, period, but if it doesn't offend you as it does me, its libraries make it similarly suited for games as C#. For gaming libraries in C#, you have MonoGame (A well-maintained and expanded version of XNA 4, and is far from unimpressive if that's what you were talking about), and there are thin wrappers for Windows' gaming APIs through SharpDX, as well as other API interfaces for established game engines -- Plus, if you ever do pick up Unity3D, your enhanced C# skills are transferable.




#5268319 A funny way to handle Unique weapons

Posted by Ravyne on 29 December 2015 - 04:36 AM

I like the idea of having super-rare weapons (or other armor, relics, etc) as these kind of priceless artifacts, and that they can be dueled over. I don't especially like the idea that I have to log in on some arbitrary schedule to keep it. Firstly because life happens -- what if I'm under a deadline and stand to lose a client (or worse, a career) over missing it and I just don't have the time; or what if there's a death in the family? I just think its poor design whenever a game demands me to work on its own timelines.

 

If I'm not mistaken, it seems to be the case that this timed return is entirely an artifact of wanting these items to be rare, but also active in the world -- that is, they don't just languish in someone's keep or vanish to eternity when someone leaves the game. I wonder if these problems could be solved by giving ownership of these items to the guild/faction, rather than the individual, perhaps using a tournament to decide who will wield it next -- or if perhaps attaching these buffs you describe to a physical object (and thereby, a concept of ownership) is the wrong approach entirely, for example, perhaps instead you can complete a quest to gain the favor of a god/deity (and perhaps having to attach to a weapon/item of a high-quality), therefore side-stepping ownership of these rare buffs.




#5267831 Need hardware recommendation

Posted by Ravyne on 24 December 2015 - 03:00 PM

You really don't need the greatest, whiz-bang components to start out. Professionals get high-end kit in their jobs mostly because, when you figure in salary, software, and facilities costs -- and the opportunity costs of slower iterations -- it ends up being cheaper and more productive to lavish them with hardware rather than having them sit idle for 30 or more minutes each day, a few minutes at a stretch, waiting for more mainstream kit to get the job done.

Odds are, lacking in this way doesn't cost you the same, even if it would be convenient to not want for hardware resources.

Outside of certain guarantees provided by high-end software packages (as with Quadro or FireGL graphics cards) lesser hardware will do everything* that more expensive hardware will do, just less quickly.

* This is obviously not true of feature-sets or GPU feature-levels, but still the slowest of a given CPU or GPU family will usually do everything the flagship can do. That said, beware Intel's product differentiation strategy -- e.g. Celeron-branded and Pentium-branded CPUs lack, for example, AVX support even using the same core architecture of those that do (i3 and better support AVX, but always check your specific chip on Intel Ark).


#5261684 Armour penetration and firearms

Posted by Ravyne on 11 November 2015 - 04:52 PM


What should the community engaging outside of the game discuss if your game design is "too obvious"? How could the skillers and number crunchers show off if everything is easy to learn and grasp?

 

Unless your game is about the crunching I don't view this as much of a benefit -- you have the crunchers in deep conversations with one another, and you have more casual players listening in to see what they should mimic, but what does that really buy you? I doubt if that discussion appeals to anyone not already playing your game, so I'd wager its not bringing in hordes of new customers. The level of chatter maybe looks good, but if its not directed at a positive effect, that's all it is -- chatter. Perhaps if you have an IAP-driven game where the discussion helps drive sales it has a business impact, but if you're relying on subtleties, controversy, and differing opinions to stoke sales figures, you're fleecing your customers.

 

I'd personally much rather have player's engagement directed at playing the game, rather than playing the meta-game. Let them share their excitement about the game, not the meta-game. Let them make videos about how much fun the game is, not about how deep the meta-game is. Again, I've got some bias here since I don't like deep simulations, but I think its not much use to foster that kind of community unless it actually furthers what the game is about, and I certainly would not build extraneous depth into a game to manufacture it where it doesn't belong.




#5261418 Can a full program be stored in a photo image

Posted by Ravyne on 10 November 2015 - 02:58 PM

Just thought I'd point out how we've got two directions happening here in this thread -- the first is Steganography which is more about hiding information inside of other information -- for example, encoding a text message inside an image file in such a way that the original image is minimally-disturbed; the second are systems which use different techniques to just encode the data as another form of information -- encoding text as an image, such as barcodes, QR codes, and the systems Hodgman and I are talking about (though, I imagine steganographic techniques might be useful in the later to aid error correction and resiliency).






PARTNERS