NEStix: Programming (C++/SDL)
Moderator: Coders of Rage
- Falco Girgis
- 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:
- Falco Girgis
- 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:
- Falco Girgis
- 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:
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...
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...
- JS Lemming
- Game Developer
- Posts: 2383
- Joined: Fri May 21, 2004 4:09 pm
- Location: C:\CON\CON
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
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.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.
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();
......
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.
- Falco Girgis
- 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:
- JS Lemming
- Game Developer
- Posts: 2383
- Joined: Fri May 21, 2004 4:09 pm
- Location: C:\CON\CON
- Falco Girgis
- 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:
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.
- JS Lemming
- Game Developer
- Posts: 2383
- Joined: Fri May 21, 2004 4:09 pm
- Location: C:\CON\CON
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.
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.
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!
- Falco Girgis
- 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:
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.
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.
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
- Falco Girgis
- 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:
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:
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...
Code: Select all
blood->xvel = cos(relative_angle * 3.1415927/180) * (float)intensity/(float)(rand() % 14 + 10);
...so tired...
-
- 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:
Actually... you'd propably want to change that code snippet to: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);
Code: Select all
blood->xvel = cos(relative_angle * (3.1415927/180)) * (float)intensity/(float)(rand() % 14 + 10);
- JS Lemming
- Game Developer
- Posts: 2383
- Joined: Fri May 21, 2004 4:09 pm
- Location: C:\CON\CON
- Falco Girgis
- 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:
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.
Thanks, Tvspels.
Last edited by Falco Girgis on Thu Oct 28, 2004 5:00 pm, edited 1 time in total.