Skip to main content
grammar and punctuation; removed blacklisted engine tag
Source Link
Gnemlock
  • 5.3k
  • 5
  • 30
  • 60

Swapping How do we enable the swapping of function definitions, at runtime?

I am developing ana cross-platform game-engine with a friend, using C++, OpenGL ( 2 +and 4 ), and some other Low Levellow level API provided by the platform. So far we've finished window initalisation and some rendering stuff like model loading and model generation ( Heightmaps, Skyboxes ).

  Recently the idea came up, how great it would be if thewe had an idea to adapt function definition adapt themselves at runtime. I meanFor example, e.g. Machine 1 provides only OpenGL 2,2; the engine will see itthat, and use only OpenGL 2 function,functions. Machine 2 provides OpenGl 4 as,as well, so the engine wilwill use OpenGL 4, instead.

Our problem with this is the implementation, and how should we should approach this? Ourit. On first thoughts werethought, we mightdecided to use functions pointerfunction pointers, but after trying for a bit, it led us into problems problems with the code. The code was unclean ( dirty ? ), hard to understand, and hard to both fix /and extend. The second approach we thought about was to replace the .DLL- ( Windows Windows) or .SO ( Linux Linux)- file  ( oror hot swapping  ). So far, we couldn'tcan not implement to worka working, stable build.

My question is, are there any similar, better aproaches to makeHow do we enable the engine change it selfswapping of function definitions, at runtime?

P.S.: Hopefully you understand what I am about

Swapping function definitions at runtime

I am developing an cross-platform game-engine with a friend using C++, OpenGL ( 2 + 4 ) and some other Low Level API provided by the platform. So far we've finished window initalisation and some rendering stuff like model loading and model generation ( Heightmaps, Skyboxes ).

  Recently the idea came up, how great it would be if the function definition adapt themselves at runtime. I mean, e.g. Machine 1 provides only OpenGL 2, the engine will see it and use only OpenGL 2 function, Machine 2 provides OpenGl 4 as well, so the engine wil use OpenGL 4 instead.

Our problem with this is the implementation, how should we approach this? Our first thoughts were, we might use functions pointer, after trying a bit, it led us into problems with the code. The code was unclean ( dirty ? ), hard to understand and hard to fix / extend. The second approach we thought about was to replace the .DLL- ( Windows ) or .SO ( Linux )- file  ( or hot swapping  ). So far we couldn't implement to work stable.

My question is, are there any similar, better aproaches to make the engine change it self?

P.S.: Hopefully you understand what I am about

How do we enable the swapping of function definitions, at runtime?

I am developing a cross-platform game-engine with a friend, using C++, OpenGL 2 and 4, and some other low level API provided by the platform. Recently, we had an idea to adapt function definition at runtime. For example, Machine 1 provides only OpenGL 2; the engine will see that, and use only OpenGL 2 functions. Machine 2 provides OpenGl 4 ,as well, so the engine will use OpenGL 4, instead.

Our problem with this is the implementation, and how we should approach it. On first thought, we decided to use function pointers, but after trying for a bit, it led us into problems with the code. The code was hard to understand, and hard to both fix and extend. The second approach we thought about was to replace the .DLL (Windows) or .SO (Linux) file (or hot swapping). So far, we can not implement a working, stable build.

How do we enable the swapping of function definitions, at runtime?

Tweeted twitter.com/#!/StackGameDev/status/422234338173124608
Source Link
LaVolpe
  • 1.8k
  • 3
  • 13
  • 18

Swapping function definitions at runtime

I am developing an cross-platform game-engine with a friend using C++, OpenGL ( 2 + 4 ) and some other Low Level API provided by the platform. So far we've finished window initalisation and some rendering stuff like model loading and model generation ( Heightmaps, Skyboxes ).

Recently the idea came up, how great it would be if the function definition adapt themselves at runtime. I mean, e.g. Machine 1 provides only OpenGL 2, the engine will see it and use only OpenGL 2 function, Machine 2 provides OpenGl 4 as well, so the engine wil use OpenGL 4 instead.

Our problem with this is the implementation, how should we approach this? Our first thoughts were, we might use functions pointer, after trying a bit, it led us into problems with the code. The code was unclean ( dirty ? ), hard to understand and hard to fix / extend. The second approach we thought about was to replace the .DLL- ( Windows ) or .SO ( Linux )- file ( or hot swapping ). So far we couldn't implement to work stable.

My question is, are there any similar, better aproaches to make the engine change it self?

P.S.: Hopefully you understand what I am about