Rendering

Pages: 12
I have refused for some time now to use a pre-made game engine so, with that said, will anyone help me make the rendering part for a 2D game engine? A big thing to ask for sure, but any help is very welcome.

- Kyle
Why not use a low level graphics library like SDL (http://www.libsdl.org/ ), Allegro (http://alleg.sourceforge.net/ ) or SFML (http://www.sfml-dev.org/ )? They will take care of rendering, audio, user input, threading and networking (SFML only), and they are cross-platform. You would still get to build the overlying engine, while letting a library wrap OS dependent calls.
Sure, that would be easy, but for some reason I get mad when I use tools like that. I believe that it has something to do with not compleatly understanding the stuff behind it, that is why I want to make a renderer in VC++ from scratch. Thank you.

- Kyle
for some reason I get mad when I use tools like that.


That's something you need to get over. It's stupid.

I believe that it has something to do with not compleatly understanding the stuff behind it


Do you completely understand the stuff behind iostream (cin/cout)? Because I don't, and I've been coding C++ for over 15 years now.

iostream is another library just like SFML/SDL/etc. Zero difference. Yet I'm willing to bet you don't have any anger at yourself when using it.

that is why I want to make a renderer in VC++ from scratch


You never do anything "from scratch" in C++.

Libs like SFML/SDL make calls to libs like OpenGL.
OpenGL communicates with device drivers.
Device drivers perform various hardware register i/o to perform the desired task.

Everything is in layers. Unless you're doing core systems development (read: nothing at all to do with game development), you never do anything "from scratch"

Suck it up and use a lib like ModShop suggested. You have to. There's no way around it. The only question is which lib to use.
Last edited on
First of all, dude, that's harsh. Second, wow, I have been coding for under a year, six months of that in C++ and I understand cin and cout. Finally, you know what the heck I mean!! Please leave this thread. Anybody else?

- Kyle
Last edited on
If you want to build your own 2D graphics library, then do it - but don't ask other people to do it for you (or "help" you do it, as you chose to phrase it). If you have specific questions about the topic, you can ask them.
Getting some pixels to end up on the screen where you want them is no real challenge even for a beginner, but getting them there as fast as SDL and SFML manage to do it is more of a challenge.
Dissatisfied with that? Then use an existing library as most normal people do.
and I understand cin and cout

I'm pretty sure by "completely understanding iostream and what's behind it" Disch didn't mean "cout is like, for output and cin is for input or something".
Disch was only being harsh because this is an idea that a lot of new programmers get caught up on.

I'm not trying to get you mad but you said that it only took 6 months for you to become comfortable with the iostream, that's comendable. How long did you give the other libraries? A few days? A week? Be honest with yourself. You have to use something in order to understand it. Frustration is part of this hobby so yell if you have to, throw things, but don't just give up.
KyleMiles wrote:
First of all, dude, that's harsh.


You're right. I'm sorry. I'm too abrasive sometimes.

Second, wow, I have been coding for under a year, and I understand cin and cout, six months of that in C++.


I'm sure you understand how to use cin and cout. But do you really understand how they work?

Here's a snippit from istream on my machine (which is included by iostream). If you really understand what it does I'll be very impressed:

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
	bool __CLR_OR_THIS_CALL _Ipfx(bool _Noskip = false)
		{	// test stream state and skip whitespace as needed
		if (ios_base::good())
			{	// state okay, flush tied stream and skip whitespace
			if (_Myios::tie() != 0)
				_Myios::tie()->flush();

			if (!_Noskip && ios_base::flags() & ios_base::skipws)
				{	// skip whitespace
				const _Ctype& _Ctype_fac = _USE(ios_base::getloc(), _Ctype);

				_TRY_IO_BEGIN
				int_type _Meta = _Myios::rdbuf()->sgetc();

				for (; ; _Meta = _Myios::rdbuf()->snextc())
					if (_Traits::eq_int_type(_Traits::eof(), _Meta))
						{	// end of file, quit
						_Myios::setstate(ios_base::eofbit);
						break;
						}
					else if (!_Ctype_fac.is(_Ctype::space,
						_Traits::to_char_type(_Meta)))
						break;	// not whitespace, quit
				_CATCH_IO_END
				}

			if (ios_base::good())
				return (true);
			}
		_Myios::setstate(ios_base::failbit);
		return (false);
		}



I'm not saying you should understand that. You don't need to. That's kind of the point of libraries. You can just use them without having to understand everything they're doing.


Finally, you know what the heck I mean!!


I don't really. Libraries are libraries. You want to write your own renderer, but the only way to do that is to use libraries. Yet you are arbitrarily dismissing some libraries for no apparent reason.

I'm just trying to point out the flaw in your logic and save you some trouble.
Last edited on
@ Athar:

If I could do that, I would be fine; I would not be asking for help. However, taking in to account that I am 13 years old, I need a bit of help.

@ Computergeek01:

Thank you!!! The first kind and encouraging words from this website!
__________________________________________________________________________

Does any object to me not responing to Disch's post?
__________________________________________________________________________

Thank you.

- Kyle
Does any object to me not responing to Disch's post?


I don't =)

I was out of line in my first post and I realize it. Again I apoligize.

You are certainly free to do whatever you want, but I honestly do think you are making things unnecessarily hard on yourself by rejecting libraries that are specifically designed to do what appears to be exactly what you want.

But like I said .. do whatever you like.

EDIT:
In the spirit of actually being helpful, if you feel SDL/SFML/etc are too high level, you can try a lower level lib like DirectX or OpenGL. I personally prefer OpenGL because it is cross platform (and I find easier to use).

The DirectX SDK is available on Microsoft's website. OpenGL also has its own website where you can get it.

DirectX and OpenGL tutorials can be found all over the web. I don't have any links handy immediately, but knowing the name of the lib can be a good starting point.

Good luck.
Last edited on
Using OpenGL or DirectX is about as close to "from scratch" as you are going to get. You can do just about anything you want with them. You mentioned, though, that you want to make something 2D. I am doing that too with GDI+. That is the standard graphics library on Windows. It isn't made for games so don't expect too much performance but if you are making something simple, it isn't too difficult to use. I would recommend starting with that and making a simple game. After you have figured that out, you can try to learn DirectX or OpenGL and make something more impressive.
Just as Druzyek here said, if you want to start 'from scratch', use OpenGL or DirectX.
They themselves are not game engines at all, are just tools to make a game engine.
They have functions for the simplist of the simple problems, most useful to save time when writing the game engine.
Not using those to make a game engine is like not using STL to make a large program. It's a joke.
At least at 13 you have plenty of time to waste re-inventing the wheel! Enjoy it while it last though because eventually you WILL come to the realization that standing on the shoulders of the programmers who came before you is the ONLY way to compete in this field. Don't get me wrong, if you want to make your own game engines, renderer, or whatever then good for you. But at least learn what others have done before you so you don't repeat their mistakes. I can't think of a good reason for your attitude unless it's just too big an ego (esp. for your age).
@ Disch:
Uh, thank you, I suppose.

@ Druzyek:
Oh, ya, OpenGL and DirectX just appeared out of thin air but thanks all the same.

@ Nexius:
I don't have much to say, not personal.

@ cnoeval:
I agree that I probably would not be doing this if I didn't have time on my hands, then again, being a programmer is all about having time. As for my attitude, it's mostly about the fact that people keep telling me I will fail.


- Kyle
Last edited on
KyleMiles wrote:
Sure, that would be easy, but for some reason I get mad when I use tools like that. I believe that it has something to do with not compleatly understanding the stuff behind it, that is why I want to make a renderer in VC++ from scratch. Thank you.


This doesn't make much sense to me. For one, SFML, SDL, Allegro etc... are hardly easy to use(at least for a beginner), which is probably why you get mad when you use them. Personally I (and most experienced users here) would just keep learning to use the toolkit. I'll apologize if any of this sounds harsh, but if you are having trouble using a ready made "easy" library do you expect creating a renderer from scratch will be less difficult? I don't necessarily think you will fail, but I do feel it is likely an exercise in futility. Be ambitious but I'm afraid your setting yourself up for failure or at the very least frustration.
Disch you shouldn't apologize for telling him the truth.
I just want to make a renderer. For what reason, does it really matter?

- Kyle
<troll>Why don't you design your own hardware, write your own kernel and build your own OS while your at it. Maybe you will have some kind of tangible result before your 25.</troll>

While having a low level understanding of how everything works is certainly invaluable knowledge, actually building these low level mechanisms is pointless. Did you build your own compiler and IDE? I'm assuming you haven't, so why build your own renderer? Just use whats already there, built, debugged and stable.
Last edited on
I just want to make a renderer. For what reason, does it really matter?

Then just do it. The relevant keywords were already mentioned. If you want to use hardware acceleration, you need to use DirectX or OpenGL. If you think you can do without it, then you can use GDI.
The rest is studying on your part.
Last edited on
Pages: 12