Jump to content

  • Log In with Google      Sign In   
  • Create Account

Bregma

Member Since 09 Dec 2005
Offline Last Active Yesterday, 04:02 PM

#5282954 How can I locate a memory leak?

Posted by Bregma on 23 March 2016 - 01:48 PM

Where I work we rely on a tool called 'valgrind' that tells you how much is leaking and where it was allocated. Also reports use-after-free and double-deletion. And other stuff. Very useful. We run all our CI tests under valgrind.


#5282878 Local hash

Posted by Bregma on 23 March 2016 - 08:24 AM

i took my first programming class in 1977 as a sophomore in high school.  i eventually went on to take software engineering at OSU. and now, 39 years later, i still have yet to use a hash table in a real world app.

Seriously? I find this bizzare, have you never used a dynamic language like python, ruby, or lua? These use hash tables idiomatically lots.

I don't find it bizarre. I've been a professional developer since the early 1980s and I have never explicitly used a hash table outside of academic exercises. I've never used Lua or Ruby, and if Python uses hashtables to implement its dictionaries, it's completely invisible and that's OK.

I've used a *lot* of std::map<> in C++. It's usually faster than a hash table for most things I need and has the strict weak ordering property, which I also usually need.


#5282466 Naming conventions, software documentation and version control

Posted by Bregma on 21 March 2016 - 05:18 PM

What naming conventions to follow? Is this all opinion based? Is there a/an common/industry standard style?

Yes, it's all opinion based.  Follow the one(s) you are comfortable with.  There is no industry style.  It might be informative to look at the naming conventions used in the standard library (defined through an ISO standards document) or through your favourite or most commonly-used toolkit.
 

How to keep proper backups?

Github, or even just a local git repo, or both, is perfect for single-developer projects.


#5281180 how could unlimited speed and ram simplify game code?

Posted by Bregma on 14 March 2016 - 05:52 AM

Yeah, we already have seemingly unlimited speed and memory.  What has it got us so far?

 

My first electronic computer had 256 bytes of memory and a 1 MHz (approximately) clock.  At my high school computer club they debated whether you could ever fill 4 k of RAM.  In the mid-1990s the company I worked for had a client that had an art database with over 1 terabyte of data, which was more storage than existed in the world when I was an undergrad, and now I can go to the local Staples and pick up a couple of terabyte drives for my home.  At the same time we got a server with a CPU that ran at 770 MHz, almost an order of magnitude faster than  everything else in the office, and it was 64 bits at a time when most software was breaking because it couldn't make the 16-to-32-bit transition.

 

So what's being done now with what would appear to someone from 30 years ago to be infinite CPU speed and memory?  Well, each generation seems to be the first to rediscover all the problems experienced by their predecessors, and reinvent all the same solutions.  I've been reading about this new concept introduced on the computer people carry in their trouser pocket called "multitasking" in which more than one program can run at the same time...  brilliant idea.

 

One of the problems that I meet every day in my current job is that people want to run all kinds of modern software on their modern hardware ("this tablet sucks, I tried to run my pirated copy of Adobe Photoshop and it was too slow and the screen was too small!!!1!!").  Turns out all those techniques I learned decades ago for running on slow processors with limited storage are still applicable and are still being rediscovered.  Those m-way external tape sorting algorithms, for example, are now called map-reduce and apply nicely to "data cubes".  Still, most of the problems we have are the same, except bigger.

 

Enough curmudgeonly ranting.

 

What if we had infinite-speed CPUs?  Then infinite loops would run much faster.  What if we had infinite fast storage?  We'd store more useless crap and have more trouble finding it.




#5280765 Right way to handle people complaining about price?

Posted by Bregma on 11 March 2016 - 01:33 PM

 

Or $3million if you value them at a competitive game developer's salary of $80/hr...

 

I'm not in the industry myself, but I think $80/hr would be a pretty small minority of game programmers. $50/hr would be closer, and many indies without years of professional work experience would be much less. Game Industry Salary survey - 2014

 

As a project manager when I costed a project, I used the nice round figure of $200/manhour as the baseline.  That covers the developer's salary, plus benefits employment taxes, plus non-developer staff, plus heating and lights and server time and licenses and capital depreciation and...  well, you get the picture.

 

It's been 20 years since I did project costing, so I would assume the baseline rate has gone up.




#5280160 Use of UML in Game Design

Posted by Bregma on 08 March 2016 - 07:24 AM

UML is a tool.  It has its appropriate uses.  Only you can decide where you will benefit from its use or if it's wasting your time.

 

Remember, UML, like Agile, is a commercial product developed for commercial purposes and has been promoted to that end especially through the high-return-on-investment academic channel.  It's a pretty good tool for helping you organize your thoughts and communicate your ideas, but it's no silver bullet and end-users do not play UML diagrams.




#5279251 Cross-platform API design

Posted by Bregma on 03 March 2016 - 07:12 AM

I want to use C++ as if it's C, but I'd like to to reinvent C++ again. Any suggestions?

You're on the right track with putting the platform-specific source in a separate storage area ("folder"). To take advantage of that, the method that was developed in your granparents' day was  to define a platform-independent API (in the C language, this is a header file) and provide platform-specific implementations called "libraries." Each source storage area contains code that will generate a platform-specific library that implements the defined interface, no need for #ifdefs.  That way, your separate source area gets built into a separate binary module that can be tested separately and mocked easily, compiled only where appropriate, and linked in to your final program.

 

You can handle the platform-specific stuff in your platform-neutral code by using opaque objects.  That is, you pass them around by pointer, and use API calls to construct and destroy the objects and to perform operations on those objects.  For a classic example of using platform-independent opaque objects in the C programming language you need look no farther than the C standard library's stdio module and the FILE type.

 

You can use struct composition in C to reimplement C++-style inheritance by placing the "base" struct at the beginning of the "derived" struct.  The language does guarantee the order of member data, so a pointer to the "derived" structs will be a pointer to the "base" struct.  An excellent example of using the C programming language to reinvent C++ classes is the gobject library.

 

Good luck and enjoy your adventure.




#5278177 Trailing return type

Posted by Bregma on 25 February 2016 - 03:51 PM

I tried your code under GCC 4.8.4 (with -std=c++11) and it compiled cleanly.




#5277864 Manufacturing chain for paper

Posted by Bregma on 24 February 2016 - 05:28 AM

(1) hygiene product are an enormous paper end-product: toilet paper, disposable diapers, feminine products (see other thread on YA games), paper towels, medical supplies, etc ... I wouldn't dismiss those so quickly

 

(2) the newsprint industry used to account for over 70% of all paper produced:  it's still there and still legit in a game

 

(3) wood pulp is widely used to make rayon, so it can feed the textile/clothing industry




#5277285 operator overload fail

Posted by Bregma on 21 February 2016 - 07:55 AM

Is the problem due to ambiguity?  Your t4dpoint is a t3dpoint (which does not really make much sense, I don't think inheritance is the right trick to use here) so when the compiler goes to resolve which function to call, it can't.

 

I'm going to go ahead and guess that you're making these binary operators member functions.  I recommend you start by taking the widely-accepted advice of always making binary operators non-member functions.  Then, move on and avoid using inheritance when it does not model an is-a relationship.  Your problems may just magically get solved.




#5275998 Pointers: "type* var" versus "type *var"

Posted by Bregma on 16 February 2016 - 12:41 PM

This has been coming up a few times a year for decades.

 

The C convention is to put the dereference operator next to the variable name (int *a) to show that, when dereferenced, the variable a is of type int.

 

The C++ convention is to group emphasize the type (int* a) to show that variable a is of type pointer to int.  C++ puts more emphasis on type because it's a more strongly-typed language than C, although it's all relative.

 

People who write C code to be compiled by a C++ compiler usually use the C convention.  Bjarne Stroustrup discusses these conventions in his seminal reference work "The C++ Programming Language" (and several other works), why they're used, and which he prefers.

 

If you're writing C++, I would suggest you lean towards the "std::string const& var" convention, it will make understanding templates and compiler error messages a little easier.




#5275319 Windows 10 - OpenGL Version

Posted by Bregma on 11 February 2016 - 01:38 PM

Just to clarify, since this is For Beginners:  Microsoft ships an ancient version of the OpenGL libraries with its Windows operating system.  Most graphics card vendors ship their own OpenGL runtime containing what is often their latest up-to-date implementation.  Applications built to use OpenGL will open the available library at runtime and query what functions are available, and use those that are there.  Most people will use something called a 'wrangler' library, for example, GLEW, to do that check and provide the calls.

 

So, you build your OpenGL application using a wrangler library, and at run time it just magically uses OpenGL 3.5 (or whatever) even though Microsoft only ships OpenGL 1.1.  Simple, no?




#5275113 Visual scripting vs Coding?

Posted by Bregma on 10 February 2016 - 05:34 AM

Visual tools are not scalable and do not produce long-term maintainable programs (although as the tools mature, that last may be remedied a bit -- source control integration for example).

 

There's nothing wrong with them for small simple things that do not need to live very long.  The kinds of games most beginners write will fall in to this category, so I can only see them as a good technology for introducing people into the world of programming.




#5274974 Why are there no AAA games targeted towards the young adult audience?

Posted by Bregma on 09 February 2016 - 07:00 AM

Yes, the sexism and prejudice is strong in these comments.  I think it's pretty clear from that that it's the people making the games or writing the books that are foisting their preconceived notions of what categories of people want onto the market and that's the determinant of what's available.




#5274653 Why are there no AAA games targeted towards the young adult audience?

Posted by Bregma on 06 February 2016 - 08:08 AM


YA which tends to be a bit more even gender wise

YA books tend to be targeted to adolescent and preadolescent women, because that's who reads them.  Like any genre fiction, most of them are cookie-cutter plots (young female teen protagonist suddenly thrust out into the cold cruel world without parental support, often having responsibility for some dependent, and some powerful but hidden secret) but there are some notable breakouts.  YA books are not targeted at young adults, don't get confused by the marketspeak.

 

So, by and large, a lot of video games are targeted at adolescent boys and feature fantasy men as protagonists, and a lot of YA literature is targeted at adolescent girls and feature fantasy women as protagonists.  When I talk with kids in the youth groups I work with, they tend to fall into these categories (boys play games, girls read books) but lines get crossed, and the type-A people tend to do both.  The question that comes to my mind is: do boys play games and girls read books because of how they're written and marketed, or is the writing and marketing reflecting actual preferences?






PARTNERS