Jump to content

  • Log In with Google      Sign In   
  • Create Account

game programming with librarys


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
5 replies to this topic

#1 Zxdeiy   Members   -  Reputation: 100

Like
0Likes
Like

Posted 03 July 2011 - 01:26 PM

hi i know this will sound pointless but i feel the answer is going to give me a better understanding of game programming
if you program a game with one graphics library could you change to another library with a minimal amount of recoding?

thanks
Dave

Sponsor:

#2 KazenoZ   Members   -  Reputation: 152

Like
3Likes
Like

Posted 03 July 2011 - 01:32 PM

That really depends alot on the libraries in question, and the way you format your code.
For the most part, if your code is well written, you should have functions that will contain all library related code in them, and keep minimal touch with the rest of the non-methodized code, and it'll evantually only come down to replacing each line of code with the respective one from the new library(Keep in mind it won't always go smooth since not all libraries function in the same manner, and it's always possible that you'll have to rewrite your code from scratch in the extreme cases)

In the end, it's always viable to change your library, but there's no set amount of difficulty or time or recoding that you'll have to do, it all really depends on what you have, what you want and how you did it.

Since you're only asking in theory though, I'll go ahead and say this: Always program with the mindset of that there's a chance you'll have to replace your library if something doesn't quite work, work from the get-go with the purpose of keeping clean and well commented code, as well as one that's well seperated between game mechanics, distinct objects in the game, the main function and external library code you'll need.

Hope this could help. =)

#3 Zxdeiy   Members   -  Reputation: 100

Like
0Likes
Like

Posted 03 July 2011 - 01:47 PM

Thanks reading thats has been really helpful :lol:

#4 Sage Gerard   Members   -  Reputation: 276

Like
1Likes
Like

Posted 04 July 2011 - 10:59 AM

You might be interested in the distinction between an interface and implementation in object-oriented programming: Write your interface, which is nothing more than the system you interact with under the impression things get done. As long as your implementation (the thing that actually does the work), still does what it is supposed to do, it can use whatever libraries it damn well pleases.

Say if you have an interface with a method called Render(). Rendering to a frame in Direct3D uses different code than in OpenGL, but the task is still rendering to a frame! The interface, and the person who uses it, does not really care what is happening as long as it works, and works well.

#5 Nanoha   Members   -  Reputation: 300

Like
1Likes
Like

Posted 04 July 2011 - 11:08 AM

If you look at something liek Ogre3d, it works with a number of things (opengl, diectx and more). All through a common interface. There's also no need to rebuild anything when switching between different API/libraries. I think it would be alot of work to get to that point though.

#6 Zxdeiy   Members   -  Reputation: 100

Like
0Likes
Like

Posted 11 July 2011 - 07:57 AM

You might be interested in the distinction between an interface and implementation in object-oriented programming: Write your interface, which is nothing more than the system you interact with under the impression things get done. As long as your implementation (the thing that actually does the work), still does what it is supposed to do, it can use whatever libraries it damn well pleases.

Say if you have an interface with a method called Render(). Rendering to a frame in Direct3D uses different code than in OpenGL, but the task is still rendering to a frame! The interface, and the person who uses it, does not really care what is happening as long as it works, and works well.


Thats a nice way of doing things thanks Sage im going to start implimenting that in my games.:D




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