Dynamic modules in a game?
I''ve come to the conclusion that modularity is a Good Thing and can be very useful in many cases.
Let me tell you what I mean. Say, for instance, I''ve written a nice little driving game, but I want to be able to release loads of extra cars via the internet. I need to compile the cars into some sort of module. This module wouldn''t just contain model data and a few variables to say how it handles. Say that this car was unique in that it could fly, say. I would include some code in the module to make it fly, using the API provided within the game.
Really what I want to do is (although alternatives are welcome) to write the flying code in C/C++, compile it, then get the main game code to import and run this module dynamically. The thing is, I''ve got to make calls to the API functions I''ve provided in the game code from the module code, and vice versa.
Got no idea how to do this: any ideas?
=> Arfa <=
=> Arfa <=
this sounds like you want to create some sort of a COM interface, i believe.
Sorry, but i can''t help you there.
Sorry, but i can''t help you there.
One solution is to release the cars as dll files (or data files with a dll controller). The DLL contains a Update(myState) function that returns physics and whatnot for the car. This allows for every car to have its own tweaked physics.
well, if you really want to do something to wow the rest of the world, right your own scripting engine.
Its an advanced topic, of course, but the result is really cool. Look on Flipcode for a tutorial.
===============================================
"Tell brave deeds of war."
Then they recounted tales, -- "There were stern stands And bitter runs for glory."
Ah, I think there were braver deeds.
Its an advanced topic, of course, but the result is really cool. Look on Flipcode for a tutorial.
===============================================
"Tell brave deeds of war."
Then they recounted tales, -- "There were stern stands And bitter runs for glory."
Ah, I think there were braver deeds.
This is my signature. There are many like it, but this one is mine. My signature is my best friend. It is my life. I must master it as I must master my life. My signature, without me, is useless. Without my signature, I am useless.
Thanks guys.
All three solutions would probably work. I think the best one is COM, but it''s a huge topic to learn. Plus, if I was ever going to make the game run under Linux, say, I''d have to learn COM and CORBA.
Another idea: how do WinAmp plugins work?
=> Arfa <=
All three solutions would probably work. I think the best one is COM, but it''s a huge topic to learn. Plus, if I was ever going to make the game run under Linux, say, I''d have to learn COM and CORBA.
Another idea: how do WinAmp plugins work?
=> Arfa <=
=> Arfa <=
Well OOP is your answer. Just make dynamic table which takes in that module and reads it and melts it to your code.
Also in this case you should put all needed funtions to your code. I think there aren''t much things that car can do? Just basic options, jumping, flying, shooting, and other things like that. Read that file to dynamic table and then just use it...
Also, you can patch all needed files so that it makes that car fly...
Also in this case you should put all needed funtions to your code. I think there aren''t much things that car can do? Just basic options, jumping, flying, shooting, and other things like that. Read that file to dynamic table and then just use it...
Also, you can patch all needed files so that it makes that car fly...
I think you can best look at the X11AMP source code (it''s the winamp open source version for linux)...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement