Jump to content

  • Log In with Google      Sign In   
  • Create Account

Writing a game engine


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
117 replies to this topic

#101 turbello   Members   -  Reputation: 115

Like
1Likes
Like

Posted 15 December 2011 - 08:04 PM

You are right.. :(

I should better listen to experienced people like you and accept the advice. And yes being stubborn is a bad attitude because I'm arguing with experienced people and thinking I'm right when I'm not..
I should better team up with other students so we can compare our code and learn from each other.

You're right about everything, except that I'm doing this just to show off.
It was not my intention to show off with the sentence "I worked 'that many' hours for that game'. I was trying to tell that I'm not a stupid programmer that can't even program.
Maybe it doesn't sound much that I haven't done AI, pathfinding yet but 'm not trying to do everything at once.

I send a mail last year to the person who made the game Kitten Cannon, no response.
I send 3 mails already to blizzard if I can use their sprites, no response.
There is a difference between copyright and trademarks. Kitten cannon don't have any trademarks but Blizzard definitely will have trademarks. That's why I need their permission that I can use those sprites.

I read the article a couple of days ago and I understand writing my engine is useless. I might never use this engine again after this project. But, strange to say, I still want to write it. It would be cool to expand my engine as a hobby after this project.
Last year I was programming 2 weeks in OpenGL and so I was using all those methods. And each time I wrote a method of that library I wondered how the code behind that would look like. And that's the little reason I want to write the Win32 code. The OpenGL library is better and more efficient with their code because those people already have years of experience. But I, a simple game programming, want to know how to write that code. Just because.. No idea.. I just want to do it. :mellow:

Have you ever had the feeling you needed to do something but you don't know why? Well that is the feeling I got now.

Sponsor:

#102 L. Spiro   Crossbones+   -  Reputation: 14271

Like
2Likes
Like

Posted 15 December 2011 - 08:04 PM

I'm not stealing it!!
As long as I don't use that art for commercial usage it's not stealing. And we can hardly make our own sprites for a game can we?! I'm not an artist. :blink:


It absolutely is theft. If Nintendo (or whoever’s art was ripped) finds out about it, they have legal grounds for prosecution.

Naturally, they won’t, because the damages to their reputation would be more than the gains of suing a kid, but they do have legal rights you are violating.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#103 turbello   Members   -  Reputation: 115

Like
0Likes
Like

Posted 15 December 2011 - 08:09 PM

So strange our teacher lies to us on such an important thing :o
Why would he say we can just pick some spritesheets of other games and use them :huh:
Maybe they won't prosecute us but suppose they would. Then it's all the fault of our teacher that is lying to us.

( I always think the teacher spoke the truth but apparently not. Thank you both for telling me this )

#104 Telastyn   Crossbones+   -  Reputation: 3730

Like
2Likes
Like

Posted 15 December 2011 - 08:51 PM

Enh, Fair Use likely applies to the sprites if you're using them for teaching/scholarship. The profitability of your project doesn't come into play for US copyright law at least.

And even if you're legally in the right, that doesn't mean they can't sue the pants off your ass.

#105 Hodgman   Moderators   -  Reputation: 31851

Like
3Likes
Like

Posted 15 December 2011 - 09:29 PM

Copyright infringement isn't "theft", it's "copyright infringement". Calling it "theft" is like calling drug-dealing "poisoning" or calling non-vegetarianism "murder", or calling verbal assault "rape". There's a huge legal distinction between infringement and theft - using the same word for both is an emotion-based fallacy.

To infringe copyright, you've got to actually distribute something (so do not put your games on the interwebs, even for free). If I draw a spider-man comic in the privacy of my own home, I'm ripping off their character, but I'm not infringing their rights. If I choose to give away copies of my comic in the street, then suddenly I am infringing their rights.

Moreover, as mentioned above, limited distribution within an educational institution for the purposes of teaching is largely protected.

Your teacher isn't lying - they're probably just mistaken. The majority of people are mistaken when it comes to copyright, it's a very misunderstood topic.

#106 L. Spiro   Crossbones+   -  Reputation: 14271

Like
2Likes
Like

Posted 16 December 2011 - 12:25 AM

That is correct. I did not put much thought into my choice of words.

Fair use may protect your scholarly endeavors, but what I want to point out is that it is not illegal only once you start selling it. That is, just because it is free it is no less of an infringement (unless of course protected by the fair-use caveat, which your personal works will not typically be). This is the most common misconception among legal matters, and I want it to be made clear.
http://en.wikipedia....no_Resurrection

Additionally, infringement is not the only thing out for which to look. The End-User License Agreement may place other restrictions on you that fair-use does not resolve for you. Typically they disallow direct extraction of resources from their archive files or from RAM, though again scholarly endeavors may be protected, if and only if specifically stated inside the EULA. You may avoid a copyright infringement on the left just to run into a EULA violation on the right, so be careful as to how the images were obtained as well.


And my last bit of advice is not to take advice from people who are not lawyers.
There is a legal section on this forum where many legal professionals are causing their F5 buttons to fade away specifically waiting for your questions.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#107 turbello   Members   -  Reputation: 115

Like
0Likes
Like

Posted 16 December 2011 - 03:15 AM

I never heard of 'fair use' before.

So as I can read of your posts I can 'lend/use' all sprites I can find on the internet for personal use but not for commercial use. That seems fair for me.
But that's only for games that don't have trademarks.
When a game got trademarks you are not allowed to use it for commercial nor personal use. They can sue you if they know you are doing this. But yes.. there is a little chance they will do that for their reputation.


I rewrote my whole engine by the way. I'm not using inheritance anymore. I know it's better to avoid many objects. But when I was writing my GameRender class that must draw everything that came up in my mind there were to many methods I could handle with only 1 object in the whole application.

I got 4 classes that will help my GameEngine. ( GameWindow, GameLoader, GameInput, GameRender ).
Then I got 3 more classes for the objects ( Images, Audio, CollisionMeshes ).
My Entry

I think this is more looking like an engine. I got many inputs. And I got many rendering code.
I just need a copy-constructor for my Images/Collisionmeshes.
And thereafter I'm going to learn Pathfinding.

#108 swiftcoder   Senior Moderators   -  Reputation: 10369

Like
2Likes
Like

Posted 16 December 2011 - 09:39 AM

So as I can read of your posts I can 'lend/use' all sprites I can find on the internet for personal use but not for commercial use. That seems fair for me.

Negative. You can use them for nonprofit educational purposes purposes (note the 'educational'). If you were to use them for personal projects outside of academia, that would not be covered under fair use.

But obviously, IANAL

Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#109 Kyall   Members   -  Reputation: 287

Like
1Likes
Like

Posted 17 December 2011 - 04:16 AM

I see everyone is complying with turbello's wish to close this thread, by spiralling it out of control and hating on the dude.

KKKKKK, your planned methods look good turbello, you should be okay with that, that being said, all of the primitive drawing functions, might be unnecessary for your project, so just leave them unimplemented until you actually need them for something.

I would say something about the need for primitive drawing functions for debugging here, but it's a 2D game so you don't really need much of that kind of debugging.

Your lecturer knew and didn't care.

"I got 4 classes that will help my GameEngine. ( GameWindow, GameLoader, GameInput, GameRender ).

<br style="color: rgb(28, 40, 55); font-size: 13px; line-height: 16px; text-align: left; background-color: rgb(250, 251, 252); ">

Then I got 3 more classes for the objects ( Images, Audio, CollisionMeshes ).

<br style="color: rgb(28, 40, 55); font-size: 13px; line-height: 16px; text-align: left; background-color: rgb(250, 251, 252); ">My Entry"

I'm always a fan of unifying as many objects as possible into one object, for the purposes of preventing sphagetti code. But what you've set up there, in the event that game engine has (window, loader, input, render) is a good enough structure, as well as game object has (image, audios, collision) is probably good enough since it's close enough to how it's done in the real world anyway.

Of course in the real world it's messy fucking pointers or handles more oft than not. Reference class objects people, PLEASE! And so ends my contribution to getting this topic out of control to cause the requested thread close.
I say Code! You say Build! Code! Build! Code! Build! Can I get a woop-woop? Woop! Woop!

#110 Hiiri   Members   -  Reputation: 111

Like
0Likes
Like

Posted 17 December 2011 - 10:32 AM

I guess you might be able to pull out doing both game engine and the game on top in given time, which in my opinion isn't few months when its 7-8 months. From the previous posts I got the idea, that your project must be completed like somewhere around February or something, which obviously isn't a long time. I still think in general it would be good habit to learn to use, what you're given. Anyways I wish you a good luck on your project.

#111 turbello   Members   -  Reputation: 115

Like
0Likes
Like

Posted 17 December 2011 - 10:46 AM

Well my engine can do a bit more now then the given engine. ( I'm not trying to show off now )

Except the given engine got buttons & textboxes but I don't want to have them. ( They are ugly )
I'm using images for 'Buttons'. If the image looks like a button and you can press it: it is a button.

And I'm using threads for my networking to receive information of the 2 players without any lag. I did some changes to my Image class so I can copy the image. This will save me a lot of time. ( an other possibility is making a static Image )

My engine is almost finished for the stuff I want to do. A student said to me to implement xinput, xml, databases, matrices, videos, Direct2D, joystick, lvl editor, etc.
I'm not going to do any of these because this would take a lot of time to implement all of this.
But I might want to implement the possibility to play videos. Always nice to show the intro movie. :)


Kyall, I'll put all code I don't need out the engine when I'm writing the game then. It's saves a lot of time when debugging yes. :)

#112 Kyall   Members   -  Reputation: 287

Like
0Likes
Like

Posted 18 December 2011 - 07:42 AM

My engine is almost finished for the stuff I want to do. A student said to me to implement xinput, xml, databases, matrices, videos, Direct2D, joystick, lvl editor, etc.


xinput: not really
xml: not really
databases: not really
matrices: hell yeah
videos: if necessary
Direct2D: will give a big improvement on performance over Win32, if your game is chugging in Win32, make sure you're not wasting resources with offscreen drawing, then if still slow swap to direct2D. I think direct2D is pretty easy to set up and use.
joystick: not really
lvl editor: NO WAY IN HELL

A level editor is can be a massive undertaking and a huge drain on your resources, for your game you should be able to achieve what you want for level editing if you give yourself a free camera and a grid, use the free camera to view your level, and use your grid to see what you need to move. Your grid should have a legend that is visible no matter where you move, like A1, A3, B2, B8 etc. Use a note pad to take notes so you can edit as much stuff that needs editing per pass as possible. Also a tip about making games in general: consistent scale and grids, if you had a level editor, you would use consistent scale and grids anyway.

How ever if you're going to be working with level designers, I'd recommend doing some tools and export scripts for an already popular editing tool that can export the data in a fashion that is usable for the game like blender or 3ds max or something.
I say Code! You say Build! Code! Build! Code! Build! Can I get a woop-woop? Woop! Woop!

#113 turbello   Members   -  Reputation: 115

Like
0Likes
Like

Posted 18 December 2011 - 02:23 PM

Well I think I want to implement videos.
I'll add math when my game is finished. Warcraft 2 don't need physics so I don't need math now.

And so I've been trying to add videos to my engine but I miss something.
I wrote all the code, I can load a video ( I only can't receive the resolution of the video, I don't know how to do that ),
And when I try to play the video I can hear the sounds but no video.. :unsure: The position of the video is x=0 y=0.
This is the message I get:
Posted Image


When look how big the resolution was and changed those variables manual. Maybe that's the problem?
How can I receive the width and the height of a video. Using mciSendString(...);

I'm controlling my sounds and videos with mciSendString so I'm not using external library's.


B. Jonathan

#114 Strychnine.213   Members   -  Reputation: 156

Like
0Likes
Like

Posted 18 December 2011 - 02:53 PM

I understand that you like to take some risks, as that is how most programmers learn, but I am going to tell you what everyone else has said; you can not do it. I do not mean to be rude, or discourage you in anyway, but building a game engine takes an unbelievable amount of development time to get anything usable. I recommend that you bite your pride and use the schools engine, as it is more than likely tried and true. It has more than likely been recoded and added to many times, and is probably stable.

I'll be able to write an engine in a month

The first game engine I wrote took me 3 years of development, and this was while I was building the game that used it. At that point I had 6+ years of C++ and 3 years of Assembly based programming. As I said before; I am not trying to be rude, but you can not write one in a month.

EDIT: If you are really mind set on building your own game engine, I can offer some advice. First off know what the engine has to do specifically. This requires that you build the engine with your game. Because of your time deadline, I would not recommend using anything fancy (by fancy I mean techniques such as Singleton patterns (which are great, but can cause hurt)). Only implement what is required for by the game. A quick glance at your design looks like it will work for a small project.

math when my game is finished

Depending on what kind of game you are building, this is going to be needed first. I do not recommend writing your own math library with your time constraint. Use open-source, or pull from the DirectX libraries.

A level editor is can be a massive undertaking and a huge drain on your resources

As someone else stated; do not even try it. Game engine tools are a massive undertaking, in part because they require a working game engine. I have heard of people using a modeling package such as Blender or 3DS MAX for level design. This is the route you should take.

As far as your video problem goes, I am not sure what you are using, but I can take a stab based on the error message. It is saying that it can not find the decompresser. This usually means that your code is wrong, or something is missing such as a (.dll) file, or an extension that the code is trying to call.

#115 turbello   Members   -  Reputation: 115

Like
0Likes
Like

Posted 18 December 2011 - 03:05 PM

I already told that I can do more then the provided engine we got from school. You are taking the words 'game engine' to big.

The provided engine can not go fullscreen, can't mirror/scale images, can't play videos, don't have any math, don't have any multi-threading.
I got all the things that engine got + fullscreen + scaling/mirroring + multi-threading.

I'm now trying to implement videos in it. My Game Engine is very very basic. But it is more then the provided one which was even more basic.
So it would be nice to help me with my previous question instead of telling me what I already heard many times in the past 2 weeks. :)


Edit: don't worry about that level editor. If I do that I know i'll fail for my game.
About that code for the video.
// Open the video
	if (end == _T(".avi"))	
	{
		sendString << tstring(_T("open \"")) + path + "\" type avivideo alias " + m_Alias + _T(" parent ");
		sendString << (int)m_hWnd;
		// This won't add a new window
		sendString << _T(" style ");
		sendString << 0x40000000;
	}

// Set the time format
	sendString.str(_T(""));
	sendString << tstring("set ") + m_Alias + " time format ms";
	mciSendString(sendString.str().c_str(), 0, 0, 0);
	
// Receive duration of video
	sendString.str(_T(""));
	sendString << tstring("status ") + m_Alias + " length";
	mciSendString(sendString.str().c_str(), buffer, 100, 0);

	sendString.str(_T(""));
	sendString << buffer;
	sendString >> m_iDuration;   // hold the duration 


// Showing the video
	tstringstream buf;
	buf << _T("put ") + m_Alias + _T(" window at ");
	buf << m_PosX;
	buf << _T(" ");
	buf << m_PosY;
	buf << _T(" ");
	buf << m_iWidth;  // I didn't calculated the width because I don't know how, so Just entered a number .. Someone know how to get the width of the video? 
	buf << _T(" ");
	buf << m_iHeight; // The same like the width
	m_CommandQueue.push( buf.str() );



// Play method
void Video::Play()
{
	if( m_bPlaying == false )
	{
		m_bPlaying = true;
		m_bPaused = false;

		tstringstream buf;
		buf << _T("play ") + m_Alias + _T(" from ");
		buf << 0;
		buf << _T(" notify");
		m_CommandQueue.push( buf.str() );
	}
	else if( m_bPaused )
	{
		m_bPaused = false;
		m_CommandQueue.push( _T("resume ") + m_Alias );
	}
}


// Tick method
void Video::Tick()
{
	if( !m_CommandQueue.empty() )
	{
		mciSendString( m_CommandQueue.front().c_str() , 0, 0, 0 );
		m_CommandQueue.pop();
	}
	
	if( m_bPaused == false && m_bPlaying == true )
	{
		++m_iCounter;
		if( m_iCounter*10 >= m_iDuration ) // When the video is done, replay?
		{
			m_bPlaying = false;

			if( m_bRepeat == true ) Play();
			m_iCounter = 0;
		}
	}
}

EDIT::
Well this is odd. The extension of the video is (.avi) which I want to give an 'avivideo alias'. This is not working.

BUT If I give to that same .avi video an mpegvideo alias it works !!! :blink: This is strange, really strange :blink:


B Jonathan

#116 freeworld   Members   -  Reputation: 329

Like
0Likes
Like

Posted 20 December 2011 - 01:55 PM

if (end == _T(".avi"))
{
sendString << tstring(_T("open \"")) + path + "\" type avivideo alias " + m_Alias + _T(" parent ");
sendString << (int)m_hWnd;
// This won't add a new window
sendString << _T(" style ");
sendString << 0x40000000;
}


What are you trying to do there? What is sendString, is it just a char buffer? while do you fill it with

open \"C:\MyVideos\" type avivideo alias ".avi parent


That's assuming, path is a string equaling "C:\MyVideos" and m_Alias is a string ".avi"

Then continue to pump it full of

open \"C:\MyVideos\" type avivideo alias ".avi parent 0xFA3C56C style 0x40000000


Some explanation of what your variables actually are might help.
[ dev journal ]
[ current projects' videos ]
[ Zolo Project ]
I'm not mean, I just like to get to the point.

#117 turbello   Members   -  Reputation: 115

Like
0Likes
Like

Posted 21 December 2011 - 05:56 AM

sendString is a: stringstream sendstring;
And I fill it with this: "open \"Video1.avi\" type avivideo alias video1 parent (int)hWnd style 0x40000000"
So I give the type,alias,parent and style of the video when I open the video.

- Each times I do 'new Video(..) I increase a static number. My alias of the video I'm allocating at that moment is the path + that static number. So each time I create a new video I'll have as alias: video1, video2, video3, etc.

- My type depends on the extension. If it's .avi = avivideo, if it's .mpeg = mpegvideo, etc

- Wen I tried without that style "0x40000000" I always got a new window for the video, what I don't want. And my teacher said I could use that code so there won't be made a new window. With our without it, it don't solve that strange alias problem.

I can't write it in 1 line. Video is a class and I need to be able to allocate a few videos.
Video* m_pVideo1;
Video* m_pVideo2;

m_pVideo1 = new Video( "path1.avi" );
m_pVideo2 = new Video( "path2.mpeg" );

So I need to open, play, stop, repeat some videos that has a different path, alias.
But it's very strange that my .avi don't want to accept a .avivideo type. I'll try to use as type: .avi, .mpeg without that 'video' at the end.


B. Jonathan

#118 freeworld   Members   -  Reputation: 329

Like
0Likes
Like

Posted 21 December 2011 - 01:30 PM

I can't write it in 1 line. Video is a class and I need to be able to allocate a few videos.

Video* m_pVideo1;
Video* m_pVideo2;

m_pVideo1 = new Video( "path1.avi" );
m_pVideo2 = new Video( "path2.mpeg" );


Video fooVideo("barVideo.avi")

There it's on one line, and doesn't have to use pointers.
[ dev journal ]
[ current projects' videos ]
[ Zolo Project ]
I'm not mean, I just like to get to the point.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS