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

Author Topic: My First SFML Game! A Game Like Space Invaders!  (Read 6550 times)

0 Members and 2 Guests are viewing this topic.

Infinity Squared Software

  • Newbie
  • *
  • Posts: 8
  • New Mission: Decline this mission.
    • View Profile
    • Infinity Squared Software
    • Email
My First SFML Game! A Game Like Space Invaders!
« on: December 16, 2015, 10:18:33 pm »
Hey Guys!
     I have been developing games for several years now with Unity 3D and GameMaker: Studio. However, in a burst of motivation, I decided to learn SFML and make a game in it. I am pretty new to OOP in C++, so the code is pretty rough :-\. Although I enjoyed SFML, I am going to learn DirectX since that is largely applied in the AAA game industry from my understanding.

Here is the Git Repo
Here is my website - http://infinitysquaredsoftware.com/

Yatan vesh

  • Newbie
  • *
  • Posts: 17
  • Get busy livin',or get busy dyin'
    • View Profile
Re: My First SFML Game! A Game Like Space Invaders!
« Reply #1 on: December 21, 2015, 11:15:20 pm »
okay wow, awesome stuff you got going there. You might not wanna close the game every time the player gets hit by those things, that was pretty annoying. Gameplay was fast and enjoyable i give you that.
And yeah, object oriented approach huh.Your class implementation isnt great but yeah, not that bad either.

Consider moving all the enemy related lines of code in your main loop to a handler function of the enemyclass. That way, you could type in every game loop:
 Enemy1.handler(..parameters if reqd);//handler is d name i generally use
Enemy2.handler(..parameters if reqd);

even the GameWindow.draw(dsdfasf) calls should be present inside the handler function of enemyclass.
Now this aint a necessity but if you want your code to be as beautiful as your code, i think you should do that.

One last thing, you might wanna move the class declaration and definitions to another file(havnt learnt that yet? no worries)

And Why the heck havnt you uploaded any screenshots yet??
« Last Edit: December 21, 2015, 11:27:46 pm by Yatan vesh »

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: My First SFML Game! A Game Like Space Invaders!
« Reply #2 on: December 21, 2015, 11:25:37 pm »
Actually, putting both the updating and drawing of an object in the same function is generally a bad idea. Not only because it means you get update thing1, draw thing1, update thing2, draw thing2, which leaves a large gap between the updating of the things, but also because it means you can't decouple game logic and drawing. This is why you would usually have something like an update function as well as a draw function, or possibly updateLogic, updateAnimation, draw.

Yatan vesh

  • Newbie
  • *
  • Posts: 17
  • Get busy livin',or get busy dyin'
    • View Profile
Re: My First SFML Game! A Game Like Space Invaders!
« Reply #3 on: December 21, 2015, 11:26:49 pm »
Couldn't agree more

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: My First SFML Game! A Game Like Space Invaders!
« Reply #4 on: December 21, 2015, 11:28:15 pm »
even the GameWindow.draw(dsdfasf) calls should be present inside the handler function of enemyclass.
Now this aint a necessity but if you want your code to be as beautiful as your, i think you should do that.
Then why did you say this?

Yatan vesh

  • Newbie
  • *
  • Posts: 17
  • Get busy livin',or get busy dyin'
    • View Profile
Re: My First SFML Game! A Game Like Space Invaders!
« Reply #5 on: December 21, 2015, 11:30:57 pm »
what can i say, you just taught me something great
« Last Edit: December 21, 2015, 11:40:21 pm by Yatan vesh »

Infinity Squared Software

  • Newbie
  • *
  • Posts: 8
  • New Mission: Decline this mission.
    • View Profile
    • Infinity Squared Software
    • Email
Re: My First SFML Game! A Game Like Space Invaders!
« Reply #6 on: December 23, 2015, 02:08:05 pm »
Thanks for the tips!

Hapax

  • Hero Member
  • *****
  • Posts: 3385
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: My First SFML Game! A Game Like Space Invaders!
« Reply #7 on: December 23, 2015, 05:04:49 pm »
Hey Guys!
Hi!

Although I enjoyed SFML, I am going to learn DirectX since that is largely applied in the AAA game industry from my understanding.
It is a pretty big jump from creating "indie" games with SFML to using DirectX and creating "AAA" games with Direct X.

Firstly, DirectX is not required for AAA quality. Indeed, it's only for Microsoft-based operating systems and therefore limits your audience and you will need to do both so that it can be played on many other operating systems (for example, on a Mac). You wouldn't be a very good AAA game developer if you could only make stuff for Windows and Xbox, for example  ;)

Secondly, I disagree with the idea that all AAA games are/should be Direct X (example).

Thirdly, you would need a relatively large team of extremely skilled people to produce an AAA game. Chances are, you would joining one, not starting one.

Lastly, I've done some Direct X; it's not fun. SFML is fun. Pretty decent argument right there  ;D
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: My First SFML Game! A Game Like Space Invaders!
« Reply #8 on: December 23, 2015, 06:43:57 pm »
DirectX is a low-level graphics API, similar to OpenGL. It's not a game engine or anything alike. It can be a good choice if you want to understand what happens behind the scenes, or forcefully write yet another engine (don't). However, it's definitely not the best option if you want quick results and well-abstracted production code. Nowadays, DirectX is hardly used directly for AAA games anymore, the big players either use a third-party commercial engine or write their own.

For independent development (to which you belong, unless you're part of a huge company), it depends on what your goals are. What kind of games do you aim for? Is your plan to develop a game without wasting any time, or do you want to learn plenty of details about game development and graphics programming? And last but not least, what resources (time, skill, people) do you have at hand?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Infinity Squared Software

  • Newbie
  • *
  • Posts: 8
  • New Mission: Decline this mission.
    • View Profile
    • Infinity Squared Software
    • Email
Re: My First SFML Game! A Game Like Space Invaders!
« Reply #9 on: December 24, 2015, 05:05:04 am »
Thanks for the opinions for DirectX. There may be a misunderstanding. I will be using Unity and GMS for actual games, but I wanna learn DX just for fun. I don't know why, it's just I saw a cool looking boook and I wanna try to make a emulator and a game engine one day on the far future. Also, I am in highschool and have taught myself everything, so I am not looking to make "real" indie games. Just side stuff. Thanks for the tips, though!

Oh! and BTW Nexus, I thought your SFML book was really cool. I got it for Christmas a couple years ago but never looked at it till I made this game.