• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
ill

Loading Dlls as mods (Similar to idtech and source)

5 posts in this topic

I was thinking about how to make my engine moddable. I could use lua and scripting of some sort, but I just don't feel like going through the trouble of learning lua and adding yet another random feature to my engine.

Something that seems pretty doable is to just load dlls like idTech engines do. On windows, a mod might come with gamex86.dll. I'm a bit fuzzy on the details though. If I have a mod that overrides a tiny thing in the base game, does the gamex86.dll need to be completely recompiled from the source of the original game's dll or can I layer the mod dlls on top of each other some how? Knowing what I know now about dlls, I'm pretty sure that's impossible.

I could still easily let other things be moddable, like weapon stats, graphics, sounds, etc... if it's data driven and not compiled into the dll.
0

Share this post


Link to post
Share on other sites
In my opinion it depends on the type of changes you are planning to allow the end user to make.


For example, instead of having all the particles float up, I write a mod which makes them float down.

You make an interface to the particle system which has a virtual function called OnUpdate(). I write my DLL using your interface and change the OnUpdate to my own custom particle update.

When starting the editor it reads the file names of a specific directory, loads my mod using LoadLibrary, and gets a pointer to the virtual function OnUpdate. When the particle update loop comes around if you have a valid pointer to an external OnUpdate method you use that one. If not, you simply update particles as normal.

This way the original compilation is already configured to accept mods and no changes to the original source are needed.

Of course it would need to be refined to a system that works to your needs, but you have to decide what exactly you want the end user to be able to change. If you wanted them to be able to add their own networking code the above would work. The user would just give the plugin to their friends/users along with the game.

However if you are looking for a more 100% ability to change anything I think a scripting language would work best. Edited by iheartyyouxo
1

Share this post


Link to post
Share on other sites
A scripting engines main advantages I think are ease of implementation (supposedly, I have no hands on experience here) and that a new script can be rewritten on the fly. In game even you could well have the debug console linking straight into the scripting engine.
1

Share this post


Link to post
Share on other sites
To replace data files, I'd go with with something like PhysicsFS.
They have this exact example on their main page I believe.
0

Share this post


Link to post
Share on other sites
Yeah I already use PhsyicsFS. It's wonderful and makes life easier. I have some data driven configuration that is easily overriden by mods.

I'm not sure how easy it is to integrate a game engine with something like Lua.

Quake and Halflife Modding seems to have been working just fine for those games by relying mostly on C/C++ written mod dlls. I'm just fuzzy on the details of what's possible.

Like can I load gamex86.dll from mod 1, then load gamex86.dll from mod 2 and have a class like Soldier that was defined in mod 1 be overriden by mod 2's implementation of Soldier without too much work on my part? Or does mod 2's dll have to be a complete recompile of the whole base game dll and include everything, and have only 1 dll loaded at once?
0

Share this post


Link to post
Share on other sites
[quote name='ill' timestamp='1344508106' post='4967704']
I'm not sure how easy it is to integrate a game engine with something like Lua.[/quote]

Once you learn Lua and its C interface, it's very easy.

[quote]
Quake and Halflife Modding seems to have been working just fine for those games by relying mostly on C/C++ written mod dlls. I'm just fuzzy on the details of what's possible.

Like can I load gamex86.dll from mod 1, then load gamex86.dll from mod 2 and have a class like Soldier that was defined in mod 1 be overriden by mod 2's implementation of Soldier without too much work on my part? Or does mod 2's dll have to be a complete recompile of the whole base game dll and include everything, and have only 1 dll loaded at once?
[/quote]

Not quite. The approach id used with Quake is not amenable to making minor modifications. The gamex86.dll [b]is[/b] the game and only one instance of it will ever be loaded at a time. In this case, the executable file is the game engine (renderer, audio system, resource loaders, etc...). It loads the game DLL at runtime, then hands control over to it. Engine functions are called by the DLL via function pointers in a struct instance that the engine passes to the DLL at load time. This approach is fine if you want to allow total rewrites of your game. But for minor modifications, like a new soldier type, it's quite a bit of overkill.

If you want to use DLLs for minor mods, then you would be better off taking a plugin approach. In this case, you can put the core game code in your executable and just define an interface that mod DLLs can use. At runtime, you can scan a designated mod directory for DLLs and load them in, looking for specific functions in each one and responding appropriately to what you find.

I'm guessing that this probably gives you more questions. And it's a bit too complex to describe in a forum post if you don't already understand what's going on under the hood. So if you do want to go either way with a DLL mod system, what you need to study up on is how to dynamically load DLLs at runtime and how to implement a plugin system. Google should be able to point you in the right direction.

A much more sane approach is to use a scripting language like Lua. The advantages over using DLLs are big. For one, it doesn't require modders to already know C or C++. For another, mods can be compiled and executed at runtime from within the game, without having to compile a C codebase and restarting the game each time. And a really big one is that they are safer, as you can prevent mods from having access to system calls. This is a big deal. It would suck for a player to download a DLL mod for your game that, when initialized, downloads and installs a backdoor, or erases the harddrive. Guess who's going to get a good portion the blame when that happens.

I highly recommend using a scripting language instead of a DLL-based mod system. Getting up and going with Lua isn't difficult and there are plenty of resources online that show you how to get it to interoperate with your program. Spend a some time experimenting with just that and you should be able to learn most of what you need to know relatively quickly.
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0