SFML community forums

General => SFML projects => Topic started by: Infinity Squared Software on December 16, 2015, 10:18:33 pm

Title: My First SFML Game! A Game Like Space Invaders!
Post by: Infinity Squared Software on December 16, 2015, 10:18:33 pm
Hey Guys!
     I have been developing games for several years now with Unity 3D (http://unity3d.com/) and GameMaker: Studio (https://www.yoyogames.com/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  (https://www.microsoft.com/en-us/download/search.aspx?q=directx)since that is largely applied in the AAA game industry from my understanding.

Here is the Git Repo (https://github.com/InfinitySquaredSoftware/SFML-SpaceGame)
Here is my website - http://infinitysquaredsoftware.com/
Title: Re: My First SFML Game! A Game Like Space Invaders!
Post by: Yatan vesh 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??
Title: Re: My First SFML Game! A Game Like Space Invaders!
Post by: shadowmouse 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.
Title: Re: My First SFML Game! A Game Like Space Invaders!
Post by: Yatan vesh on December 21, 2015, 11:26:49 pm
Couldn't agree more
Title: Re: My First SFML Game! A Game Like Space Invaders!
Post by: shadowmouse 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?
Title: Re: My First SFML Game! A Game Like Space Invaders!
Post by: Yatan vesh on December 21, 2015, 11:30:57 pm
what can i say, you just taught me something great
Title: Re: My First SFML Game! A Game Like Space Invaders!
Post by: Infinity Squared Software on December 23, 2015, 02:08:05 pm
Thanks for the tips!
Title: Re: My First SFML Game! A Game Like Space Invaders!
Post by: Hapax on December 23, 2015, 05:04:49 pm
Hey Guys!
Hi!

Although I enjoyed SFML, I am going to learn DirectX  (https://www.microsoft.com/en-us/download/search.aspx?q=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 (https://en.wikipedia.org/wiki/List_of_OpenGL_programs)).

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
Title: Re: My First SFML Game! A Game Like Space Invaders!
Post by: Nexus 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?
Title: Re: My First SFML Game! A Game Like Space Invaders!
Post by: Infinity Squared Software 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.