NEStix: Programming (C++/SDL)

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Of course. No more flickering now...
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Oh, I just noticed Tvspelsfreak's explanation for that stuff in your .h file. Yeah, that's awesome.

thanks.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

I know you told me that we can do the blood engine later, JSL, but I decided to go ahead and keep working on it.

I've worked too hard to just brush it to the side. I changed the vectors back to linked lists and got the linked lists working as good as the vectors. Then, I noticed that yours wasn't drawing pixels, but instead 2x2 particles.

That really pissed me off, but I went through and changed it to 2x2 particles. I don't know about you guys, but linked lists was a pretty hard concept to grasp. I drew a diagram of how the program worked yesterday and I think that I FOUND the problem. When we remove a link from the list, the list is broken, I need to make the previous blood's next pointer point to the next one instead of NULL where the old one used to be.

I THINK that is what's wrong. I'm at school in C programming class now, so I can't fix it. I hope I know how to fix it....

But yeah, I also think something is wrong with the math, because JSL's Blitz one works different as far as the pattern goes than this. I'm definately making progress and I hope to make another huge achievement on the blood engine when I get home and finish this accursed homework...
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

The thing of it is..... blood spray is just a special effect. Games usually put in special effects last and work on the important game engine first. I just think you are spending too much time on one little thing.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Post by MarauderIIC »

Somebody wrote:Also, I noticed you like to put all the functions at the bottom of the page and init. them at the top. Is that your prefered preference? I will switch to that method now because it is easier to simply glance at the init. to see what the paramaters are. Good call.
What I personally do is mainly use classes, put function prototypes in the .h files w/ the class def. Define functions in a separate .cpp file. #include the .h file for the class I need. And global functions have their own .h file.

For example:

Code: Select all

player.h
class Player {
    ...int getX();...
};
.......
player.cpp
#include "player.h"
int Player::getX() {
    return xCoord;
}
.......
utilities.h
int dirToInt(string direction);
........
utililities.cpp
#include "utilities.h"
int dirToInt(string direction) {
 ...
}
.......
main.cpp
...
#include "player.h"
Player aPlayer;
if (dirToInt("NORTH-o") == 0)
    aPlayer.getX();
......
As a rough example.

Also, if you use vectors, it'll rearrange that kind of stuff for you. And I'd bet it's possible to upgrade your STL headers. When was your book written, JS? Since I've never seen anything against STL before :)
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Yeah, I can't say that I've ever heard anything but talk of STL goodness in the C++ book that I've purchased.

And good lord, where've you been, Mar? We've missed you!
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

I can’t find the year but it is very new. I’m guessing 2003 or later. It’s called “Data Structures for Game Programmers.” So I think it knows what it’s talking about. :wink:
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

I think that my book likes to use big words to ensure that the reader thinks of the writer as a man of utmost intellect. I think a quote from it would be something like:
t3h C++ Book wrote: And yes, programmings is *cough*polymorphism*cough* very good. Today's society needs more *achuu*object oriented programmage*sneeze* -- what, Oh, sorry [..]
Last edited by Falco Girgis on Tue Oct 26, 2004 8:37 pm, edited 1 time in total.
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

It does say that if you just must use STL, you can always download STLPort. I guess that is a more standard standard template library. :mrgreen:

But I really don't see what the benfits are.

Also, I finished the image splicer function. I'll try to post it at home. I also made an easy draw image function to make our lives a heck of a lot better.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Yeah, I began working on the blood engine again. Yesterday I went about and trashed the previous linked lists system. Then, I ran into another problem, and MarauderIIC and I stayed up until like 11:30 working on it.

The lists work perfectly now, and blood generates beautifully. We kept having crappy memory leaks and stuff, but now it's great. My math must be screwed up though, because it doesn't do it exactly like JSL's, but the physics are obviously correct.

Also, t3h engine will support any color of the rainbow (maybe even different combinations), cool color changing affects as the velocity changes (makes the blood look like it fades out), and also any size! The thing is seriously cool. Anyway, today I'll be cleaning up all of the redundant crap in the code and taking debug stuff out. I'm considering having different modes as well. As I mess with the equation, I find different effects with the particles. So perhaps different things call for different blood physics (not even blood, just general particles, there are infinate uses for this thing).

Dear god, without MarauderIIC's extremely hardcore self, this would've been hell. Thanks, Mar.

JSL, YES! Hook us up with your function! Hurry up with that level editor! Sorry to be such an ass, I know how terrible it must feel to have to code a whole level editor in BlitzPlus, but I'm really itching to make a level SO bad. I know that'll come really soon. Sooner than we all think.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Post by MarauderIIC »

Mmm.... C++ sin/cos use radians, not degrees... as for the rest, he'll have to update you.

My internet was out...

zz....
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Basically every day that I'd been working on the blood engine and thought I was going crazy, I wasn't. The C++ sin() cos() functions use radians, not degrees, so the blood acted completely different. Oh, thank god for MarauderIIC. Here, now the velocities look like this:

Code: Select all

blood->xvel = cos(relative_angle * 3.1415927/180) * (float)intensity/(float)(rand() % 14 + 10);
There are just a few more things that need to be fixed. Some problems just aren't there in the blitz one (I guess Blitz automatically takes care of divide zero errors for you instead of dieing?) and the fact that the blood is kinda blotching out at certain points. But yeah, hope to get that done today.

...so tired...
Tvspelsfreak
Chaos Rift Junior
Chaos Rift Junior
Posts: 272
Joined: Wed Sep 29, 2004 5:53 pm
Favorite Gaming Platforms: NES, SNES
Programming Language of Choice: C/C++
Location: Umeå, Sweden
Contact:

Post by Tvspelsfreak »

GyroVorbis wrote:Basically every day that I'd been working on the blood engine and thought I was going crazy, I wasn't. The C++ sin() cos() functions use radians, not degrees, so the blood acted completely different. Oh, thank god for MarauderIIC. Here, now the velocities look like this:

Code: Select all

blood->xvel = cos(relative_angle * 3.1415927/180) * (float)intensity/(float)(rand() % 14 + 10);
Actually... you'd propably want to change that code snippet to:

Code: Select all

blood->xvel = cos(relative_angle * (3.1415927/180)) * (float)intensity/(float)(rand() % 14 + 10);
...or it'll do some crazy stuff instead of converting it to radians.
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

Nope, Blitz Farts when you divide by zero... then it crashes. So what exactly are you dividing by zero? The blitz version didn't ever divide by 0.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

No, seriously. I don't remember where, but the engine does divide by zero if a variable equals a certain thing. I'm at school, or else I'd show you. I'm going to assume Blitz does something for you to make you not get an "unhandled exception"

Thanks, Tvspels.
Last edited by Falco Girgis on Thu Oct 28, 2004 5:00 pm, edited 1 time in total.
Post Reply