Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 10 Mar 2008
Online Last Active Today, 12:55 AM

#5302059 Polygon Selection

Posted by JohnnyCode on 22 July 2016 - 07:34 PM

You still do not need a BSP spatial atomizing, just examine what AABSs (axis aligned bound spheres) or AABBs ( axis aligned boundig boxes) are penetrating unlimtited ray, and do test those geometries in detail afterward.

If you can even pre examine by the depth/distance order of them, you are well saved of arbitrary scene complexity influencing a ray cast test :)


If your scene objects does not cary a trivial information of its AABS (4 numbers, 3d postion and radius) forget about BSP trees at that very point.


#5302035 What Makes A Game Look Realistic?

Posted by JohnnyCode on 22 July 2016 - 03:35 PM

I think that.... lightning illuminates something. And that we pay too much atention to the lightning itself only, omiting what we illuminate. Normal map is a picture! A constant set of data (an identical thing under angles is identical thing to human observer).

Seeing all the time the very same thing under angles, while it would have been changed radicaly in reality!

This is blocking the actual interactive realistic video experience. We need to have volatile surfaces, normals, etc. Games can produce realistic stills, but if you move in them- Ups!


#5302032 Copyright

Posted by JohnnyCode on 22 July 2016 - 03:22 PM

In the movie one of allien races will be called Orcs. Is that right because as far as I know there is dozens of movies and games that use orcs as their race name and they are all almost the same.


Literaly, if you use something very exclusive of something you got inspired by, it is trouble, but, if you use something that is not exclusive to the forgery, you are all set at the very basic sense totaly.


Orcs are not exclusive, even Ogres are not exclusive (to Tolkien, etc). But as it has been mentioned, Klingons are exclusive subject, originaly defined and described in Star Trek series.


If some of situations and happenings get similiar to some other happenings and situations, this is out of question too I'd very strongly assure- there is no patent for being hit, stolen from, or blowen the monastery from :)


You should explore the exclusivity of things you wish to have. But in general, 100+ years existence of a thing, means it is not copyrighted or authorized, wheather it is Davinci's Michelangelo, or the Basilic of St. Peter, etc., (though catholic church may get uncomfortable by some iritating usage, but since we are not in any fundamental society, it'd be imposible to persecute you in any legal manner)

#5298321 Is using one the switch statement better then using multiple if statements?

Posted by JohnnyCode on 27 June 2016 - 08:40 PM


Performance is a question of your run-time branching, performed instruction saves, navigating, not at all a question of wheather it was an if or a switch. But frankly, I cannot spot when and how switch can have outperformed proper conditionals in any way on any platform- and by my logic I conclude it cannot.

The reason has already been covered in this very thread: switches are easy to convert to lookup tables in machine code.

Well, let me get in here. (compile time look-up)


This is true only in case that "case" expression are equality checkings of alternatives of a switched value -of an integer value. And in case of that being true - what prevents you from an array indexed function pointers/delegates/whatever imidietaly acquired? Too much more comforming, or not? If not, why?


I am not bashing switch as is, I am just saying that an impotent c++ feature recomendation based on performace blasphemy is too ridiculous?


It is wheather you check any subjective object in program for some exexution that is sufficuent, then end (a return?). Or any other.


Bashing on people with compiler time pro\missed look-up table is a huge non-sense. But they will trust you and abuse this. I know.


I like a saying "If you're playing with fire, you're gonna get burned". Enough of micro/pseudo (de)optimizations, the only proposition that seemed reasonable to me here is SOTL , elsewhere- we are just missleading beginners and trusters.

#5298251 Is using one the switch statement better then using multiple if statements?

Posted by JohnnyCode on 27 June 2016 - 09:56 AM


Better how? Switch-statements can be way faster then if/else-chains, specifically if there are many items to check for.


The compiler is free to optimize the switch-statement as he pleases. For a small number of items, the compiler might just produce an if/else-chain in the background. However, if you have like say 20-30 items, then the switch can ie. be converted to a table-lookup, which is way cheaper than having to check perform up to 30 if-conditions.


A reason for using multiple if/elses is mostly if you cannot use a switch, ie. if you are comparing strings, or other non-literal types.

First, you misslead the readers on what switch is. Since switch is named so improper, switch is not a switch, unless there is break keyword instruction in every sub-block of condition .
What switch does is that it evaluates all conditions in their order and executes their subblock if they are true. Logicily switch is equal to this

{// the escape block

 if (A){}


if ©{}

{} // the default:


 If you are sure that A and B and C will always be exclusive by being true, break will save you of only their conditional checks. You can omit default option, or place it in any roder, or you can break only in some code, not other, and create intent enigma hell for any reader of your code, as you have stressed readibility- there is no obvious readibility to switch (just a little hope there is break at every spot, or return, or continue).


Performance is a question of your run-time branching, performed instruction saves, navigating, not at all a question of wheather it was an if or a switch. But frankly, I cannot spot when and how switch can have outperformed proper conditionals in any way on any platform- and by my logic I conclude it cannot.


And to advice beginner programmers with switch for "readability", or "always use"- is a very bad service to them. I know we experienced programmers can even justify GoTo/Label, but doing so in production of your employer will get you fired. The paradox.







#5296948 Artefacts in triangle mesh

Posted by JohnnyCode on 17 June 2016 - 06:29 AM

To add up how you could correct it without manipulating the exact trace, since, you will need new vertex to connect through those triangles if so.

1-go to edge edit and use "remove" on all edges on both sides of the peek triangle pair, meaning you remove the edges that has the neighboring vertex that does not continue with an edge through the two peak triangles, like the entire ring.

(you should be correct now already)


#5295329 My Bspline Surface Illumination is strange

Posted by JohnnyCode on 06 June 2016 - 12:36 PM

If recomputed normals do not have the issue, you have simply wrong normals on the mesh. You computed flat normals, you need to have smooth normals to have gradienting light like in picture 2. This is done by averaging all flat (triangle) normals that are on triangles that vertex is a part of.

#5295319 Do you usually prefix your classes with the letter 'C' or something e...

Posted by JohnnyCode on 06 June 2016 - 12:08 PM



I've started suffixing (as opposed to prefixing) my classes with the word Class.

I just threw up in my brain :(

At least the suffix is at the end of the name not the start so it doesn't mess up autocomplete :)



I do not understand this argument for autocomplete messing in particular. Prefixes do not help autocomplete in your opinion? How are you going to see this member of a class you forgot the name of, but you know it is a member? Randomly type letters or bother with class name content study?


I like to distinguish classes ©, member variables (m), locals (no prefix) as it makes me more search-replacing safe. If I am to rename a class, I do not witsh to blow some arbitrary code, and also I can see unformatted search outputs more readable.

#5289648 Should i learn Win32 or UWP?(C++, Directx)

Posted by JohnnyCode on 01 May 2016 - 06:27 PM

Win32 is the actual base of entire OS, it is the native run time, that even managed runtime (entire C#) works over. C# and c++ native runtimes are interchangable for programer as well, with CppCLI modules. 


Though CLI should be used sparsely. It is c++ that will always get your way, though in much higher difficultly. That is why more light weight and practical layers get introduced, what is UWP as well.

#5289241 Which alignment to use?

Posted by JohnnyCode on 29 April 2016 - 08:54 AM


So "Component" is a user-defined class, derived of a BaseComponent-class. This BaseComponent has a member "m_parent" that stores a handle to the owner of the component, which needs to be preserved (ie. in the move-assignment-operator). Now some of the derived classes might have custom copy/move-operators/ctors. The problem turned out that if you override the move-operator in the derived class, the operator of the base-class is not called anymore, and so I ended up with having incorrect parent-handles in my components, specially after deleting one component from the middle.


After I understand your measures in more scale, which is quite a "big bounty" like, I  would stop speaking about pointers, pointers are guarenteed to point to a memory that does not change its position, a heap allocated T *p=new T().

That is not a case in your pooled objects in vector, but you definitely could achieve all those measures by using indexes of vector contained objects instead.


One viable way I see, is to use vector as "instead of heap manager" and use it with conjunction of a linked list of the very indexes , to achieve this hierarchy/arbitrary pointing structure you want to have.


You could even delay the erase operations of the vector, to not process memory movement of it at every trivial freeing, while still able to keep adding new objects, and call erase in some more-wise condition, like GC.


Something like this:


-LinkedList of structures that contain :[real index to vector, real index to the owner- in vector]

-erasing from LinkedList will trivialy remove the node, keeping all vector real indexes in objects in LinkedList still intact, since real removal is not called, +update the owned object owner index to magic value of none. Add the free index to an integer array Fr. (thus the linked list becomes the immediate structure of your program to access the objects, or manipulate them)

- If in FR array is a bigger continous amount of values (indexes), call erase with this one enough large interval (vector::erase has overload for interval removal)

- Before you do this real erase on vector- you are already being viable to update the linked list real indexes- you see my point, so you call linked list update on idexes first, then vector erase-with the interval.

-now you can have external references around your program, wheather in private or public-managed sections, even if real objects gets moved in vector management


Of course, the fact of linked list, though of very small structures, is a certain performance hit, but it provides this measure to safely use and access your objects even if they get moved by managing vector.

#5285984 Assembling A Large Dev Team

Posted by JohnnyCode on 09 April 2016 - 04:28 AM

Well yes, very first and best step would be to acquire a person that has been involved in an entire production proccess of a game and maintaining it (QA director, producer, lead programer maybe, etc. positions). This person will answer all pile of knowledge misses you might have as investment donator and game designer (I'm not saying ultimately tho).

#5283836 Learning Animation/Illustration for Video Game Art Questions

Posted by JohnnyCode on 28 March 2016 - 07:05 AM

Dude, no school will make you learn art, the thing school might do to you is make you procrastinate less and practice more, which is what you need to get good at art

But it will teach him to produce art. Producing art and capturing art is nothing trivial.


You can be "greatly competent" for making art even without talent, if you happen to gain knowledge about art, wheather it'd be producing, resulting and effect/critic.


For an artist/designer, it is very benefitial to obtain a school. If it would happen to be some great uni, you cannot be turned away possibly from no one who wish to hire an artist or someone to work at artisitic results.


Without a school, you will never get proffesional in art production, you simply cannot- there will be too many competitors with school on every damn position.

#5283143 How can I locate a memory leak?

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

I'm inclined to agree with Khatharr. RAII is in my experience the way to go (and again to reinforce, if you think RAII means std::shared_ptr/std::unique_ptr then you have completely missed the point of RAII). Sometimes getting a good RAII concept (including some potentially backing infrastructure) for a problem going takes a bit of time and work. But in my experience the time, work and most especially nerves you save by that are well worth the price.

Yes, it is actualy a great(correct) technique of coding, but in my understanding, it will not protect you from exceptional accesses, uncomforming data passes between modules, etc. and in my experience, those unlucky events are the most common source of leaks.

#5283130 slerp of two pairs of vectors

Posted by JohnnyCode on 24 March 2016 - 07:54 AM

If there are two unit orthogonal vectors A and B, and they slerp to two orthogonal unit vectors C and D, indivdualy but by the same factor value, do they preserve the orthogonality on entire way?


I cannot imagine it well enough to provide me a decision, weather positive or negative, so I try to state a proof to , but I am not sure, here it would be:


A . B=1 and C . D=1 , is A1 . B1 =1 for all t<0.0,1.0> if



h=acos(A . C)

j=acos (B . D)


Please, help me crack this proof/statement.

#5280025 How to find the cause of framedrops

Posted by JohnnyCode on 07 March 2016 - 11:07 AM

Have you compiled release version, without dx debug runtime libraries linked, debugging disabled, and possibly code optimization enabled?

Without code optimization, you can sometimes face ridiculous cache breaks etc.

Do that, and you can also start windows in safe mode, start your release version, with possibly dx redistributable drivers deployed up again.