Game Programming Team

Pages: 123456
closed account (N36fSL3A)
Don't use OOP and you're going to end up shooting yourself in the head once it gets complex.
Lumpkin:
Don't use OOP and you're going to end up shooting yourself in the head once it gets complex.


You sure seem to like bashing non OOP languages. Tell me just how many non-OOP languages have you actually worked with?
Protip: [quote=author]

Hey look fancy formatting for you wrote:
C++
johny31 wrote:
I want to gather a team of c++ programmers (with at least 1 / 2 years of experience) to create a game.

Have you actually created any game so far? And what are the libraries you are currently familiar with? And if there's still space to join, my decision depends on it.

Lumpkin wrote:
Don't use OOP and you're going to end up shooting yourself in the head once it gets complex.

I'd advice you to read this post : http://www.aaroncox.net/tutorials/2dtutorials/sdlclasses.html

Here, the author demonstrates with simple code that how to code in procedural and object oriented way and how objected oriented programming is always better. And its for C++/SDL.
You guys decided to go ahead with SDL? I'd have preferred SFML; it's easier and FASTER !
The illusionist mirage wrote:
objected oriented programming is always better

That's a dumb thing to say.
I am just starting to learn SDL2.0

Do you mind if I poke my nose into what you are doing? Maby I will be able to contribute...
For me we would go with SFML but altought I started this project it's a democratic system for the choice of library. So if the bigger part want's SDL we'll have to go with SDL.

But if everybody is up for it I think we should go with SFML: EASIER, FASTER and PRETIER
At Jonhy...

What do you mean prettier? I thought 2d programming was sprite dependent. Doesn't that mean it is really in the art work and not the coding itself?
It's not the graphics. The code syntax is pretier and simpler to understand
chrisname wrote:
That's a dumb thing to say.

Can you please explain why? All this while I thought OOP is better. I'd like to know more elaborately.

Thanks
Last edited on
Procedural, OO, functional programming: they all have their pros and cons.

There is C, which does not support OO programming.
There is Java which tries to force you to use OO solutions.

Both languages are widely used and popular. To say that one of them built on bad and useless idiome is incorrect. To say that one is always better than other is incorrect too.

And if I would need to write a program which will need to check if string matches some regex, I almost surely will not create a single class for that.
closed account (3qX21hU5)
The differences in the code from SDL and SFML come from that they are made for two different languages. SDL is a C library so it makes heavy use of C style programming whereas SFML is a C++ library.


For example here is two examples that are kind of similiar.

SDL - This loads a .bmp image to the screen and that is about it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*This source code copyrighted by Lazy Foo' Productions (2004-2009) and may not
be redestributed without written permission.*/

//Include SDL functions and datatypes
#include "SDL/SDL.h"

int main( int argc, char* args[] )
{
    //The images
    SDL_Surface* hello = NULL;
    SDL_Surface* screen = NULL;

    //Start SDL
    SDL_Init( SDL_INIT_EVERYTHING );

    //Set up screen
    screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );

    //Load image
    hello = SDL_LoadBMP( "hello.bmp" );

    //Apply image to screen
    SDL_BlitSurface( hello, NULL, screen, NULL );

    //Update Screen
    SDL_Flip( screen );

    //Pause
    SDL_Delay( 2000 );

    //Free the loaded image
    SDL_FreeSurface( hello );

    //Quit SDL
    SDL_Quit();

    return 0;
}


SFML - Draws a simple texture on screen (Won't work unless you specify the filename for a image) and sets up the main game loop.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <SFML\Graphics.hpp>

int main()
{
	// Create the window
	sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Example");

	//Creates a texture object to hold the texture and do some error checking
	sf::Texture texture;
	if (!texture.loadFromFile("filenamegoeshere.png"))
		std::cout << "Failed to load texture";

	// Creates a sprite to draw with (The sprite class is much more light weight).
	sf::Sprite sprite(texture);

	// Enter the game loop and check for close events and draw the screen.
	while (window.isOpen())
	{
		sf::Event event;
		while (window.pollEvent(event))
		{
			if (event.type == sf::Event::Closed)
				window.close();
		}

		window.clear();
		window.draw(sprite);
		window.display();
	}
}



Even in these very minor examples it is easy to spot the differences in programming with each library. The SFML example is actually doing quite a bit more work then the SDL example also (Sorry my SFML bias coming through there).

In the end both are good libraries (By that I mean SDL 2.0 and not 1.2) and you can't really go wrong with them for just starting out. So give them both a try and see which fits your group better I say.

Also realize that any knowledge you gain in either of the libraries will mostly be transferable to most other libraries. The syntax is easy to learn it is understanding the different aspects of game programming that is hard and once you know them it won't really matter to much what library you use.
Yea I agree both are good. I myself used SDL. But one day I came across SFML and since then have been using SFML for game programming.

This is my view and in case I'm wrong please do correct me :-
But while comparing one must keep in mind that SDL and SFML made their appearance at different periods of time; so SDL was written keeping in mind hardware and OSs back then whereas SFML is a recent entrant in the field and tries to use modern hardware and OSs efficiently.
The illusionist mirage wrote:
Can you please explain why? All this while I thought OOP is better. I'd like to know more elaborately.

Because different programming paradigms, like object-oriented or procedural, are simply different approaches to solving problems in computer science. I like OOP for things that can be easily conceptualised as multiple objects interacting (hence "object-oriented"), but that's not always suitable. Procedural programming is more suitable for tasks that lend themselves to being conceptualised as a series of steps, something which OOP would be less suitable for. I do think OOP lends itself to a larger number of projects than procedural programming does, because most programs model the real world in some way and the real world consists of interacting objects and not a series of states or steps, but that isn't always the case. Sometimes you really just have to tell the computer "do these things in this order" and that's exactly what procedural programming is. Also, don't ignore that all other paradigms are essentially abstractions of procedural programming. The computer is only reading symbols in the order they're presented to it.

[edit] That being said, I do agree that SFML is better than SDL (better than SDL 1.2, at least) but that's not because SFML is object-oriented and SDL is not. SDL is object-oriented: it manipulates objects like SDL_Surface, SDL_Color, etc.

SFML is better because it's a unified library (everything comes with one distribution with one interface), yet modular (e.g. you don't link the audio/networking/graphics module if you don't need audio/networking/graphics); while SDL is a fragmented library (there are different distributions with different interfaces, e.g. SDL_Image/Mixer/TTF), yet not modular (the video, audio, input, etc. subsystems are all in one piece). With SDL, the parts that are not included are things you will almost certainly need if you're using any of the things that SDL actually does provide, and yet you can't get rid of the things you don't need. It's a stupid design. I can't speak for the performance difference but in terms of design SFML is clearly better.
Last edited on
let the op decide and everyone else goes with it or drops out.
@chrisname

Thanks, it's pretty queer that it didn't come to mind that different problems have different approaches to sovle them. While some are done with OOP, some are better off with POP(procedural programming).
Ok for those who want in on this project it's SFML 2.1.

REASONS

-SFML is written for C++ and SDL is written for C

-SFML is a unified package

-From what was discussed on this topic the majority of the people afirm that SFML is better than SDL
Wow I thought I was at least a little bit unique for trying out a 2D game with SFML, seems pretty popular.
You mean your game idea, or the idea of making a 2D game in SFML?

Because SFML was kind of designed with 2D games in mind...
Pages: 123456