Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 04 Jan 2013
Offline Last Active Private

#5224138 Contours and Cluster Algorithm

Posted by wintertime on Yesterday, 03:01 AM

There are other clustering methods like hierarchical bottom-up and top-down clustering. They may be a better fit for your problem.

Though research has so far not found a method nearly as sophisticated as the human looking at the picture and "seeing" all clusters immediately, if anyone did he/she could write a paper, which would be read eagerly, by scientists and all those big data people.

#5222192 Starting Using OpenGL Or DirectX?

Posted by wintertime on 09 April 2015 - 03:14 AM

If you used the search you would have found like 100 threads about this on gamedev alone and each time it gets into an endless discussion, which boils down to:

- check which works on the platform you use now (and maybe later)

- if both, as they have both the mostly same functionality, look 1min at some tutorial websites to see which API calls look more ugly to you or just throw a coin

#5222025 Detecting if 2 Iterators point to the same thing?

Posted by wintertime on 08 April 2015 - 02:59 AM

I wish I could find the place where I read it again (although it could have been in a C not C++ context or relational operators), but I remember comparing pointers to separately allocted objects being pointed out as not well-defined in the standard.

Lining your path with traps for which you need to be a language lawyer is one of the things making C/C++ annoying.

#5222017 Detecting if 2 Iterators point to the same thing?

Posted by wintertime on 08 April 2015 - 01:32 AM

I would think the standard also makes Servants solution undefined behaviour, as its comparing 2 pointers to possibly disjoint memory regions, although it often would succeed.

reinterpret_cast<uintptr_t>(&(*itA)) == reinterpret_cast<uintptr_t>(&(*itB))

That could reduce the theoretical possibility of a crash, but might still allow for an undefined result, therefore I think you should avoid doing any of this.


If you are not satisfied with the result of *itA == *itB you should just override the operator== for the data objects class.

#5221645 preventing system crash or power outage from wiping savegame: best methods

Posted by wintertime on 06 April 2015 - 10:32 AM

Or simply dont touch the old saves and add a higher number to the filename of the next save?

#5221328 SFML render many sprites...

Posted by wintertime on 04 April 2015 - 08:40 AM

No, a std::list of pointers is bad. Use sf::VertexArray or a std::vector<sf::Vertex>, fill it with all stuff needing the same texture and do a single draw.


#5221281 How should systems pick which entities to process? (Entity Component Systems)

Posted by wintertime on 04 April 2015 - 03:49 AM

I'm seeing some comments in this thread suggesting that like components should be in an array (and not stored on the entity that they "belong to"), so that they will be laid out sequentially in memory to take advantage of spatial locality when they are processed each game loop. Is this a premature optimization, or is this an important design decision to make? If the data is stored in component objects, will it make a difference anyway (won't the references to those objects be stored sequentially, and not the actual data)?

The "premature optimization" quote is the quote which is most often misquoted and taken out of context, here.

Making a high level architectural choice of where to put some data (in this case because the code gets simpler to write, when you wont discard the type information for components and there is no useless typechecking in the entity to make up for it), is a completely different thing than obfuscating a function to microoptimize it before you know it was needed (what the quote is about and in later sentences is relativating).

#5220771 Anyone got any ideas where 4k a sec is coming from?

Posted by wintertime on 01 April 2015 - 12:39 PM

Task Manager is not a profiler or memory analizer. The numbers you see in there mean different things and can change when the Windows OS is moving pages, without a cause in your program.

#5218847 How to initialize a class member variable when using compositon?

Posted by wintertime on 24 March 2015 - 11:58 AM

Seriously, if a single, simple method would do easily, it is weird to add a whole another class for it.

#5218423 String replacing

Posted by wintertime on 23 March 2015 - 04:42 AM

Well, first place to look in such cases: http://en.cppreference.com/w/cpp/algorithm

There are several algorithms which could be used, but with some complications, because of the 2 element match you are looking for.

Though you could just write your own loop.


Its just find next '\\' (copying everything which did not match), check if 'n' is behind, push_back a '\n' in the output string (or use an iterator), else a copy of the character, increase iterator according to what you found, check for one before end and loop, then copy the remaining character. Could also be done in place if you keep 2 iterators and resize when done.

#5217885 The programmer's personal journey and changing tastes

Posted by wintertime on 20 March 2015 - 10:54 AM

You should be happy to be back at the build-something-useful-stage. Obsessing about details is like the worst, and probably not that uncommon. Like, one moment you think about programming a game, next you wanna know how that compiler and linker works, next what the OS and graphics driver does, then what that BIOS is for, what happens the very moment the computer gets turned on, how those logic gates fit together to make a CPU, what types of transistors there are and how they make a gate, how a transistor works, what chemicals there are inside, how those holes and electrons inside can jump the impassable terrain, and before you know you are reading about electric fields, subatomic particles, then quantum theory, how it relates to the theory of relativity, and finally arrive at string theory and loop quantum gravitation and wonder if there is anything more to know and how that could happen.huh.png


#5216676 Migrating an existing fan base to your game.

Posted by wintertime on 15 March 2015 - 12:27 PM

You would probably just have these people for a moment until they realize they have max. stats/level already and have no more need to actually play your game.

They would miss out on seeing most game content you produced, which would normally be different than on the other game, even if you cloned the game mechanics.

You would then probably be better off just adding more content to your older game (assuming it is your game, otherwise you had no data access and people would send you photoshopped screenshots to prove having stuff they never had and other people will feel cheated and run from your game).

#5216672 How to limit FPS (without vsync)?

Posted by wintertime on 15 March 2015 - 12:00 PM

Whats the obsession with so many people not wanting v-sync? Its automagically doing what you want, preventing the gpu doing useless frames you only see a fraction of, without any tearing. I would just use that glfwSwapInterval call.


If you actually turned it on and it does not work check your driver settings to allow vsync.


If you measure that its not working when starting your game, then you might warn about it and are stuck with sleep. But dont just always do sleep(1); measure the time, check if its necessary and use it for the call, after calling timeBeginPeriod (which is usually not a recommended call as its a global setting that wastes energy and only justified when really needing these short sleeps which still would result in an overall saving). Dont forget timeEndPeriod if your game is paused.


#5216425 Simple RPG design structure. ( ECS or inheritance hierarchy )

Posted by wintertime on 14 March 2015 - 06:42 AM

Seems you are cought up in fiddling with details trying a bottom-up design with much of unnecessary inheritance.

I think it would be easier for you to go top-down.

Start with a gameloop, set up graphics, add a map, draw it, add player character, draw it, have it move, add items, add inventory, add monster, add fighting mechanics and so on adding one feature after the other.

See how the code evolves - cleaning it up a bit inbetween new features to keep it maintainable and see if there is really duplicated code written which can be split out and reused.

#5216008 C# Interview test "failed"? Why?

Posted by wintertime on 12 March 2015 - 03:04 AM

There is most likely just a - missing between x and 1. Then its the bittwiddling trick to find if its a power of 2.