• Content count

  • Joined

  • Last visited

Community Reputation

184 Neutral

About DavidWolfire

  • Rank
  1. Help creating the ground for a 2D game

    Here is a video I made deconstructing the art assets of Aquaria -- it's not my game but might help you understand how modern 2D levels are constructed.
  2. 'averaging out' the colour of a texture?

    Yeah, high-pass filter does exactly what OP is looking for -- preserving high frequency details while removing low-frequency color variations. Here is how it looks if you combine the high-pass details with the average color of the original texture:     Tiled four times:  
  3. Unity Unity 3D: When to animate, when to script

    Scripting tends to give more direct and analog control, while animations are easier to deal with for complex motions (like a walk cycle or martial arts move). Airplane motions are simple and analog, so I would use scripting. You could set it up to have a hierarchy like:   Plane - fuselage - rudder pivot (empty) -- rudder - elevator left pivot (empty) -- elevator left - elevator right pivot (empty) -- elevator right   And then you can just alter the rotation of the pivot objects as needed. It would also probably be possible to do it with animations by setting an additive blend layer for each movement, and combining them as needed, but I'm not as familiar with the workflow for that in Unity.
  4. I found it helpful to try to relate every class to game development somehow, to make them more interesting. In the case of art history, that is not even a stretch! It is useful for picking an art style for a game, or at least being literate enough to work with artists effectively, and generally helps build awareness of the context in which players live their lives. A lot of visually distinctive games get their look from picking unusual art styles that you might learn about in art history, like Braid, Bioshock, Okami, Journey, and Incredipede.   Since you have no choice in the matter, you might as well make the best of it, and to do that you need to find something in the class that can hold your interest. Otherwise it really is a waste of time and money!
  5. Deleting value stored inside a pointer

    If you call delete(ptr[5]), it is telling the OS that you no longer need the memory pointed to by ptr[5]. However! delete() will not re-initialize that memory for you. You can think of it like a sand castle -- when you call new(), you draw a square on the beach to mark off the area you will use for your castle. Inside the square, the sand starts out in some random state, all lumpy with footprints from everyone else walking all over the beach. Then you use a constructor or initializer to shape the memory, forming your sand castle. Since you have your lines drawn in the sand, everyone else avoids your sand castle, and only you are allowed to touch it.   When you call delete(), you erase the lines in the sand. Your sand castle is still there, and you can still point to it, but it is no longer marked as off limits for others. Eventually people will start walking through it and claiming that sand for themselves, and moving pieces of your castle around to make their own. You can still point to the spot your castle used to be at, but your castle may or may not still be there -- it could also contain bits and pieces of random castles created by other people.   In this metaphor, your question would be "How do I make my sand castle perfectly flat when I'm done with it?" You could do that using something like memset(ptr[5], 0xDD, sizeof(MyClass)), to overwrite all the memory used by MyClass to 0xDD, so that you can more easily detect if something is trying to access freed memory. This is a fairly advanced memory debugging technique though, which is only really useful if you are trying to track down a memory corruption error. Otherwise, re-initializing memory when deleting a pointer is a waste of developer and execution time.   You should also be aware that nobody else is re-initializing their memory when they free it, so whenever you block off some memory with malloc() or new(), it will start out in a random state -- it will not be nicely zeroed like you might expect. If you call int* test = new int, then *test will usually not equal zero. It will probably be some strange number, like -842150451, because that's what it was set to when some other function or program freed it.