Jump to content
  • Advertisement

xinfinite33

Member
  • Content Count

    18
  • Joined

  • Last visited

Everything posted by xinfinite33

  1. xinfinite33

    2D Arcade Fighter Game

    Hello aanthonyz1   I've also been thinking about how to handle collision detection in fighting games, so I did some research about it and I found some pretty cool results. Some games use the pixel perfect approach as DpakoH mentioned, But there are others who use a collection of "Hit Boxes" for each frame of animation. The fighting game Skullgirls uses the Hitbox method. Here is a link so you can get an idea of how it works.   http://wiki.shoryuken.com/Skullgirls/Hit_Box_Ref   While hitbox detection is most often faster than pixel perfect collision detection, you have to manually create the hitboxes for every single frame ,of every single animation and for every single character in your game, while the pixel perfect method only needs the image data. But in my opinion I think hitbox detection is the way to go. It makes it very easy to specify which parts of your character are Hurt areas (Areas that can be hit by attacks, such as the torso, head ,etc.), and which areas are Attack areas (Areas used in attacking, such as, fists, legs, weapons, etc.). Though the downside is that it will most likely be tedious to set up, unless you make some kind of external program to make editing the hitboxes for your characters easier. But then again the same thing could be done with pixel perfect collision detection if you use a separate set of images along with the original image data that specifies the hurt and attack areas. For example you could color the hurt areas blue and the attack areas red. Then when you do the collision detection, you just get the color of the pixels that are colliding and determine if its a successful hit or not. But this would make your game take up more space due to the extra image data.
  2. hello everyone! I made a simple game and I came across a problem, editing levels. I made my game so that it stores the level data in text files, so levels have to be built manually by directly editing the text file, this was rather tedious so i started working on a level editor and I'm having one problem, the GUI. I would like to  create a GUI system that can create windows with buttons, sliders, check-boxes, etc. and I've been trying out different methods but its harder than I thought it would be. I don't want the GUI code to be platform specific so I chose not to use third party libraries. can someone give me an idea of how a GUI system should be structured or point me to some articles/tutorials about the subject? any help at all would be greatly appreciated.
  3. xinfinite33

    Custom window GUI system

    so far you guys are only pointing me to libraries. are there really no tutorials / discussions on how to go about creating your own GUI system? id rather learn the basic idea on how they work and then design around that because if i ever decide to use another language for a project and need a GUI system, i can have enough knowledge to create a fairly basic one, then if i need more advanced features that i cannot create myself, then id use a GUI library. i just need an understanding of how a system would be structured, so i could add on the individual tools such as the buttons, checkboxes,sliders etc. myself.
  4. xinfinite33

    Custom window GUI system

    im using C++ and SFML
  5. xinfinite33

    smoothed lines

    ive been trying to find a way to take a set of points and draw a "smoothed" line that passes through all the points. i tried bezier curves and they do a good job at smoothing the line, but the line doesn't pass through the points,it passes between them. so is there a simple algorithm i can use so that the line will actually pass though all of the points but at the same time make it so that the line is smooth and not rigid?
  6. xinfinite33

    CodeBlocks and SFML Confusion?

    I also had alot of trouble getting SFML running the first time. what i had to do was rebuild SFML using a program called Cmake. It fixed everything and it works fine now. if you mean that you had trouble understanding how it works, and not trouble getting it running, i suggest reading the tutorials on the SFML website.
  7. xinfinite33

    2D tile map collision detection

    the way i would do it is to just do a bounding box collision check, then if there was a collision i would correct on the axis with the lowest penetration value. the penetration value is how far one bounding box has penetrated another . so you get the penetration value of both the x axis and the y axis. and correct for the smallest penetration value. you can get the penetration value by taking the distance from the center of the bounding box to the edge of the bounding box "width/2 or height /2". for both bounding boxes, and then subtract it from the distance from the center of box 1 to  the center of box 2:   int Xpenetration=( ( Boundingbox1.width/2 + Boundingbox2.width/2 ) - (Boundingbox2.centerX-Boundingbox1.centerX) ); int Ypenetration=( ( Boundingbox1.height/2 + Boundingbox2.height/2 ) - (Boundingbox2.centerY-Boundingbox1.centerY) );     then you compare the absolute value of both the Xpenetration and the Ypenetration, and just correct for the smallest value:   if( abs(Xpenetration) > abs(Ypenetration) ) { // correct on the y axis using Ypenetration value. } else { // correct on the x axis using Xpenetration value. }
  8. xinfinite33

    smart pointer trouble

    I've been trying to work with smart pointers pointers and i'm having trouble.  if you have an object that has a pointer to another object, for example, my object stores a pointer to the closest object relative to itself, this makes a pointer cycle ,object 2 pointing to object 1 and object 1 pointing to object 2. how can i make it so that if an object gets deleted, all pointers pointing to it get set to NULL? iv'e tried this with shared pointers and auto pointers but i cant get anything to work how i want it. here's some code for a better understanding. #include <iostream> #include <memory> using namespace std; class person { public: int value; shared_ptr<person> buddy; static int Count; person(int v) { this->value=v; Count++; } person(const person & other ) { this->value=other.value; this->buddy=other.buddy; } ~person() { Count--; } }; int person::Count=0; int main() { shared_ptr<person> test(new person(5)); shared_ptr<person> test2(new person(37)); test->buddy=test2; test2->buddy=test; cout<<(test->buddy)->value<<endl; cout<<(test2->buddy)->value<<endl; test=NULL; //destroy the first person and set all pointers pointing to it to NULL here. how do i do that? if(test2->buddy==NULL) { cout<<"null pointer detected. do nothing"; } else { cout<<"person detected, print value: "<<test2->buddy->value; //this shouldnt happen, it should detect null because test 1 was destroyed } return 0; }      
  9. xinfinite33

    Need some advice...

    lol hey there. well just so you know. don't expect to be creating anything of borderlands quality as a beginner. things like that take teams of people and alot of time. but yeah i  would suggest unity. that would be  the easiest way to get to where your'e going. start off with smaller projects and work your way up. lots of beginners make the mistake of starting too high and getting discouraged. I should know, as im also a beginner lol. But yeah, ive used unity before and its pretty solid. but i moved to c++ because i like the thought of building "from the  ground up" and understanding whats going on so i can tailor my game engine to do exactly what i want. But if you're looking for an easy to use 3d engine then yes unity is definitely what your'e looking for. 
  10. xinfinite33

    static std::deque inside of template class

    Yeah I know its buggy, I was mostly experimenting with templates and pointers as a way to make my own memory management system. It failed, miserably. I guess i should research things a bit more before jumping in head first  . The "rule of three" and the "non-copyable" articles were helpful, as I had no knowledge about those either. But thanks for the comments and suggestions! 
  11. im having a problem with a static deque inside of one of my classes. i know that you have to initialize static members of a class before you can use them but i cant figure out how to initialize a static deque inside of a template class. a little help please?   #include <iostream> #include <deque> using namespace std; template <typename T> class jar { public: T * value; static int jars; static deque<jar*> jarlist; template<typename S> jar(S obj) //constructor { this->value= &obj; jars++; jarlist.push_back(this); } void destroy() //destroys a jar { { typename deque<jar*>::iterator iter; for (iter=jarlist.begin();iter!=jarlist.end();iter++) { if(*iter==this) { delete (*iter); jarlist.erase(iter); } } jars--; } } }; template<typename T> int jar<T>::jars=0; template<typename T> deque<jar*> jar<T>::jarlist; // <---------------------PROBLEM HERE--------------- int main() { int integer=3; jar A(integer); cout<<*(jar::jarlist.front())->value); return 0; }   any help would be greatly appreciated
  12. everyone whos interested feel free to add me as well on Google talk. xinfinite33@Gmail.com looking foward to talking with you guys on monday
  13. hi guys. Well the problem I'm having is that I have been trying to create a simple function that takes in 2 points and determines the direction from one point to another then displays the direction as N,NE,E,SE,S,SW,W,NW Like a compass. I found a very simple way to do this for 4 directions by subtracting point 2's coordinates from point 1's coordinates. then I get the absolute value of the x distance and the y distance and determine which axis's distance is greater. if the Y distance is greater, then point2 is either North(negative) or South(positive) of point1, and If the X distance is greater, then point2 is either East(positive) or West(negative) of point1. This method is very fast, But as you see this only provides 4 directions. Is there a simple trick similar to this one that yields 8 directions instead of 4? I know I could just go the angular route and divide 360 by 8, then find the angle of point A to point B and see which range it lies in, but i'm trying to find a simpler solution that doesn't use division or other expensive operations, just for the sake of tiny optimizations lol. Any ideas?
  14. xinfinite33

    simple 8 way direction finding algorithm?

    loool I know it Isn't that much of a difference when it comes to optimizing since we can do millions of operations a second. I cant remember where but I read somewhere that division was the slowest operation out of all the others, excluding the case where your'e multiplying numbers less than one, then division is faster. I apologize for my novice assumption as I am still fairly new to programming .
  15. xinfinite33

    simple 8 way direction finding algorithm?

    thanks for the replies guys! @SiCrane thanks for the suggestion about precalculated normals. I'm surprised I didn't think about that sooner. @ifthen thanks for your reply, as well as the advice about premature optimization. and yes I coded my own simple vector class "which wasn't as hard to do as I thought lol". this is my first time seeing the method you suggested before. I'll benchmark test it a few times and keep it for future reference! thanks @Álvaro Thanks for the code! That's a very elegant way to handle it lol. and since Sine and Cosine can be precalculated that makes it even more useful. and again thanks a lot guys!
  16. xinfinite33

    simple 8 way direction finding algorithm?

    Thanks SiCrane. thats a really nice way to do it, even tho you have to use division and square root to normalize a vector, but its much cleaner than the way I was doing it. thanks alot!
  17. xinfinite33

    Game states?

    Hi there! I'm also working on a state based engine and the way I'm doing it is that when I call my engine's ChangeState() function it accepts a gamestate object and an integer value as an argument ex: Function ChangeState( CgameState * state, Int i). each state can use this value how it wants. for example if I pass in the "in-game" state, I use the integer value to specify which level I want to load.The levels themselves are stored seperately as "level" objects, not as states. With this method, Loading/Switching to level 3 is as simple as calling Changestate(inGame,3). If you want to keep data that is constant between states, I would suggest creating a class that holds the game data. Whenever you load a new level you just read the data from the GameData class. I hope This helps
  18. Hi there and welcome to the forums! this is also my first post. I'm also learning c++, SDL, and openGL and it has been quite difficult for me as well and i think it would be cool to have a sort of study partner. Unfortunately I don't run Linux as I have Windows 7. That seems to be the only problem. I have a small amount of experience with c++ and sdl and it isn't that difficult, however openGL is a totally different beast and I get discouraged from learning it lol. But anyway if the fact that i'm running Windows doesn't bother you I'd be happy to learn it with you . Would be nice to have someone on the same level and learn together and share ideas.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!