Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: What now ?  (Read 7149 times)

0 Members and 3 Guests are viewing this topic.

Broken

  • Newbie
  • *
  • Posts: 26
    • View Profile
What now ?
« on: January 20, 2010, 05:57:56 pm »
Hi until now I learn SFML from tutorials now when I finish with them what now ?
Sorry this is first API which I learn so should I learn from documentation,SFML wiki tutorials or something else ?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
What now ?
« Reply #1 on: January 20, 2010, 06:07:06 pm »
Do you learn it for fun, or do you have a project? What's your final goal?
Laurent Gomila - SFML developer

Broken

  • Newbie
  • *
  • Posts: 26
    • View Profile
What now ?
« Reply #2 on: January 20, 2010, 09:37:02 pm »
I am going to some kind of programming school and I decide to programming simple game for my last work. And the answer is, yes it is for my project.

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
What now ?
« Reply #3 on: January 20, 2010, 11:35:36 pm »
After doing the tutorials I suggest to play with SFML by yourself.

Starting from small things, always thinking on your project, you'll find answers about how to start implementing the game.
Like a prototype. Imagine that you want to do a character moving in a nice way, and it will be defined by some complicated class. You start by making just a sprite in the main function, moving somehow, improve it a bit, then you think "ok, this works :), the complicated character class will work like this somehow".
When you get enough comfortable with it, leave the prototyping away and start really implementing your project.
That's how I do when I try a new API.

SFML tutorials covers everything you need to know, so there isn't much more to learn, hands on it ;)

If you didn't think about what game you want to do, you should do it soon ;-)
Pluma - Plug-in Management Framework

dunce

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
What now ?
« Reply #4 on: January 21, 2010, 09:03:28 am »
Try to make a simple and well known game like Tetris or Worm. They require neither a lot of assets nor a lot of coding. It won't take you much time to finish one of them, and you'll get good practical skills in using SFML api in a real project.

Broken

  • Newbie
  • *
  • Posts: 26
    • View Profile
What now ?
« Reply #5 on: January 21, 2010, 10:30:37 pm »
Ok, thanks on advice me,I will try bulid some clone like snake,tetris or pacman and when I stuck with coding I'll need your help  :roll:

Broken

  • Newbie
  • *
  • Posts: 26
    • View Profile
What now ?
« Reply #6 on: January 31, 2010, 05:24:32 pm »
Hi I decided to make Space Inviders clone. And I know put background, fonts ,sound, and image(space ship) but I don't know collision detection, how to make other ships which my ship destroys and how to make that my ship fire missles?
So if there is someone who could help i would like it.

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
What now ?
« Reply #7 on: January 31, 2010, 06:01:22 pm »
space games are the best ones to start in my opinion, good start point  :).

You can see spaceships as circles: they have a center and a radius. That way it's easy to test collisions between them, it's intersections between circles, basic geometry formulas. If you're not familiar with it search for circle intersections or something.

Ok, I suppose you have a class for the spaceships, and you store your spaceships on some container. You need to do the same for missiles. When you want a spaceship to fire, simply create a new Missile instance in front of the spaceship, and put it on the missiles container, so that the game cycle can iterate over all missile instances on the container to update their position, test collisions and draw them.
A missile colliding with a spaceship can be simply test if it's center, a point, is contained on the circle (geometry again). If yes, missile is destroyed as well as the spaceship. You may not want to add animations yet, so simply remove the missile and spaceship from the respective containers.
Pluma - Plug-in Management Framework

Samyboy

  • Newbie
  • *
  • Posts: 19
    • View Profile
What now ?
« Reply #8 on: February 01, 2010, 09:29:14 pm »
Quote from: "gsaurus"
space games are the best ones to start in my opinion, good start point  :).

You can see spaceships as circles: they have a center and a radius. That way it's easy to test collisions between them, it's intersections between circles, basic geometry formulas. If you're not familiar with it search for circle intersections or something.

Ok, I suppose you have a class for the spaceships, and you store your spaceships on some container. You need to do the same for missiles. When you want a spaceship to fire, simply create a new Missile instance in front of the spaceship, and put it on the missiles container, so that the game cycle can iterate over all missile instances on the container to update their position, test collisions and draw them.
A missile colliding with a spaceship can be simply test if it's center, a point, is contained on the circle (geometry again). If yes, missile is destroyed as well as the spaceship. You may not want to add animations yet, so simply remove the missile and spaceship from the respective containers.


Hello, I am very eager to learn more about simple collision detection using a circle.

So for the actual formula I will use google, of course. I have another question:

How would you go on testing if a missile is colliding with another Sprite? I mean the forumula is all good and fine, but do you save all your sprites in a Vector and iterate through them every Frame? Am I understanding something totally wrong?

Some piece of example code would be very appreciated!

Thanks and have a nice day :D

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
What now ?
« Reply #9 on: February 01, 2010, 10:14:24 pm »
Quote from: "Samyboy"
How would you go on testing if a missile is colliding with another Sprite? I mean the forumula is all good and fine, but do you save all your sprites in a Vector and iterate through them every Frame?


Yeah that's fine, really!  :) Unless you have thousands of objects on the screen, which I don't think is the case  :lol:
Pluma - Plug-in Management Framework

Samyboy

  • Newbie
  • *
  • Posts: 19
    • View Profile
What now ?
« Reply #10 on: February 01, 2010, 10:23:19 pm »
Quote from: "gsaurus"
Quote from: "Samyboy"
How would you go on testing if a missile is colliding with another Sprite? I mean the forumula is all good and fine, but do you save all your sprites in a Vector and iterate through them every Frame?


Yeah that's fine, really!  :) Unless you have thousands of objects on the screen, which I don't think is the case  :lol:


Well, what about all my projectiles flying around? :p

Is there really no better way?

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
What now ?
« Reply #11 on: February 01, 2010, 11:14:34 pm »
I have done several space games before with lots of projectiles and checking every pair of objects worked perfectly.

But you can still spatialize the objects by areas if really needed, and check the collisions between objects that are in the same area.
For example imagine you have a matrix representing the screen. Each time an object is created or it's position changes, you test what cells of the matrix the object is overlapping, and inform these sells that this object is there.
Doing this you have separated all objects by areas.
Then, every frame, for each object, you check collisions only for the objects that intersects the same cells as the one you're testing. That reduces substantially the number of collision checks. Don't do a too thin matrix or you'll have tons of cells to check :wink:

I would say: go with an easier collision test first, If you notice that it's compromising the gameplay, improve collisions by implementing a more complex method  :wink:
Pluma - Plug-in Management Framework

Samyboy

  • Newbie
  • *
  • Posts: 19
    • View Profile
What now ?
« Reply #12 on: February 02, 2010, 08:06:10 am »
Quote from: "gsaurus"
I have done several space games before with lots of projectiles and checking every pair of objects worked perfectly.

But you can still spatialize the objects by areas if really needed, and check the collisions between objects that are in the same area.
For example imagine you have a matrix representing the screen. Each time an object is created or it's position changes, you test what cells of the matrix the object is overlapping, and inform these sells that this object is there.
Doing this you have separated all objects by areas.
Then, every frame, for each object, you check collisions only for the objects that intersects the same cells as the one you're testing. That reduces substantially the number of collision checks. Don't do a too thin matrix or you'll have tons of cells to check :wink:

I would say: go with an easier collision test first, If you notice that it's compromising the gameplay, improve collisions by implementing a more complex method  :wink:


Hello,

Thanks for your advice, will google for the circle formula.

So basically I'll treat every object as a circle? That's cool!

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
What now ?
« Reply #13 on: February 02, 2010, 08:55:53 pm »
If projectiles are small, they can be considered as a single point :wink:
Pluma - Plug-in Management Framework

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
What now ?
« Reply #14 on: February 02, 2010, 09:41:32 pm »
An important point concerning collision detection with circles: Don't compare roots (euclidean norm), but compare the squared distances of two points, since this is faster.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: