There will come a time when you will need to change a vertex buffer every frame, either to animate something or to do clipping.
You will think, “Well, I could create the vertex buffer at the maximum possible size and then just write data to it every frame, but that would waste memory. It’ll be so much better if I actually delete the old buffer, create a new buffer at the correct size, and then fill it with the new data every frame instead.”
Do not (repeat not) do this, because it causes some video cards to go “Oh, hey, what’r you – wait, I need that – no don’t – AGH I CAN’T TAKE IT ANY MORE!” and crash.
Instead, just create the vertex buffer once at the largest possible size, and then simply write new data to it every frame. Yes, you will waste a little memory, but everybody will be much happier.
I wasted two weeks on that bug. Sigh…
On a happier note, remember Cybermage? That awful, awful game from Origin that I used as a Name That Game! a few weeks back? Well, have I got a present for you.
See, you may ask yourself when you play old games, “Why does the voice acting suck so badly?” Well, it’s because the developers couldn’t hire professionals, so they had to make do with whoever they could find. And while the people they used may not have been impressive, the alternative was something like this.
And yes, I have been assured by an old friend at Origin that the guy giving that take wasn’t joking. He was dead serious. He really thought that performance might get him the part of Necrom. This friend told me that the guy was a bodybuilder and actually did a set of squats inside the recording studio to “get himself ready”.
Obviously he should have done one or two more.
Awesome. He certainly sounds serious. But compared to this, I should be receiving awards for my own voiceovers in Shlongg. See, Indie developers STILL can’t afford to hire professionals 😉
Actually.. I’ve had this idea of making a speech synth that’s NOT a text-to-speech thing, but aimed at being a voice actor. The developer can “tune” the speech to sound “right”.
The main problem with this approach (apart from the fact that bleeding edge speech synth is still pretty much in the stone age) is that it would be aimed at developers who have either budget problems (can’t afford voice talent) or size problems (like mobiles, or downloadables). i.e. markets where developers have no money.
The other possible target market would be placeholders, but any old TTS system would work there.
You aren’t actually wasting ram. Sooner or later, you’re going to need the full-size buffer. At that moment, if you don’t have enough ram, you will fail. It’s better to fail up front than in the middle of your game.