making a game's engine moddable

Started by
20 comments, last by shurcool 21 years, 8 months ago
we''re making a game, and it''d be nice if the engine would be able to support mods. what i mean is how to about making a 100% moddable engine. one where a mod is not just some replaced sprites, new levels, etc. but a whole different game! i think those are called TCs (total conversion). one way that i know, which half-life uses, would be to make a mod dll. the engine loads that dll which over-rides all the necessary functions, etc. that makes sense. the only problem is not only this half-life approach moddable, it''s also hackable. they suggest that the whole engine >> possible hack >> mod dll thing is the problem here, but i''m not sure. i mean, is that really what makes it so vulnerable to hacking, or it something else? so my question is, what other methods are there to make a moddable engine with the game as a "default mod"? and moddable meaning that you can write your own code. thanks for all the help. ps. how do they do mods for q3? ---
shurcool
wwdev
Advertisement
Well, I know specifially that Jedi Knight II and Return to Castle Wolfenstein (both based of the Q3 engine) have mods created for them. They were made because the companies that made them released the source to the public. It would be pretty hard to make a game moddable short of allowing people to alter code.
The problem is with the dll linking approach. The problem is that cheaters/hackers can impose a pass through dll between the engine and the game code. They can then alter messages between the two.

IIRC, Quake 3 uses a virtual machine to run compiled mod code, which makes ''dll hooking'' a bit harder.

Another approach, followed by Tribes 2 , is to write all of the code in script, and write a script engine into your game engine. That even allows people to mod your game with a text editor. (No compiler required!)
quote:Original post by Erunama
Well, I know specifially that Jedi Knight II and Return to Castle Wolfenstein (both based of the Q3 engine) have mods created for them. They were made because the companies that made them released the source to the public. It would be pretty hard to make a game moddable short of allowing people to alter code.


two questions.

first of all, i don't have q3 (i played the demo, but nothing more), so i don't know how it works. i have half-life, so i know all about that. u open the game, go to custom game, select your mod, press activate and you're there. i also know that installing a mod for unreal tournament is a pain. you have to run a separate exe, etc. so how does it work in q3? is it all nice and you do it in the main menu, like in half-life, or?

ok, make that three questions. if i release the source to my game, it'd be possible to make a mod, no problem. but the problem comes when you try installing that mod. do you replace the original game? can you have two mods installed at the same time? etc. i want this all to be handled nicely in main menu. i don't want many executables, etc. i remeber that in serious sam they did exactly that. in the main menu to go to mods, then you could select different mods there (it was a demo, so there was only "default mod", but you get the idea). does any1 know how they did it?

edit: ok, i don't think this is an option because it will make the game very easy-2-hack.

and last question... :D i just noticed it's a question for CheeseGrater. what's a virtual machine (don't bother answering, i'll look at google anyway)?

edit: from what i found out, it looks like some sort of compiled code which is also portable. so it's some sort of specialized script that gets compiled? is it a good approach? if yes, how would one go about doing it?

---
shurcool
wwdev


[edited by - shurcool on July 24, 2002 1:09:04 PM]
quote:Original post by shurcool

first of all, i don't have q3 (i played the demo, but nothing more), so i don't know how it works. i have half-life, so i know all about that. u open the game, go to custom game, select your mod, press activate and you're there. i also know that installing a mod for unreal tournament is a pain. you have to run a separate exe, etc. so how does it work in q3? is it all nice and you do it in the main menu, like in half-life, or?


It looks about the same as HL from the launcher menu.

quote:
ok, make that three questions. if i release the source to my game, it'd be possible to make a mod, no problem. but the problem comes when you try installing that mod. do you replace the original game? can you have two mods installed at the same time? etc. i want this all to be handled nicely in main menu. i don't want many executables, etc. i remeber that in serious sam they did exactly that. in the main menu to go to mods, then you could select different mods there (it was a demo, so there was only "default mod", but you get the idea). does any1 know how they did it?


Just like half-life: Make a sub directory for each mod. When your game runs, look for mod subdirs under your game directory. For each one that you find, you make an entry in the mod list. You would load the mod by loading the dll/scripts/virual machine compiled file/whatever in the selected directory.

quote:

and last question... :D i just noticed it's a question for CheeseGrater. what's a virtual machine (don't bother answering, i'll look at google anyway)?

edit: from what i found out, it looks like some sort of compiled code which is also portable. so it's some sort of specialized script that gets compiled? is it a good approach? if yes, how would one go about doing it?


If you're using a VM, you compile the sourcecode to some intermediate format (usually called bytecode) The bytecode is the '.exe' of your new system.

The VM is basically a computer simulated on your computer. The VM reads bytecode instead of machine code. This is nice, because people can write programs to run on the VM, and they will work on any system that the VM has been ported to. (PCs, Macs, Playstations, whatever)

Virtual machines are how Java achieves platform independance.

It's by no means easy to write a virtual machine based system from scratch. If you're interested in giving it a go, read some books on Theoretical operating systems and Compiler Design.

I'd go with either dll linking or a script engine myself... Virtual Machines are pretty much overkill unless you plan on Mac/Linux/Console versions of your game.

[edited by - cheesegrater on July 24, 2002 1:22:25 PM]
The easiest way I''d say would be to have a script based game. Then just include a script editor that compiles the scripts.
yeah... i guess VM is too good for my game.

so i''ll probably go w/ either DLL linking or a script engine then. i''m wondering, just how flexible can a script engine be? depends on how i write it, or is there a limit? what if i were to use one, like Lua or such? is that a good idea? would it be too slow? would it be too hard to make a game in it (my game is a real-time multiplayer 2d game, like Worms by team17)? or a mod?

haha, i know i asked too many questions, but please try to answer some of them! thanks...

---
shurcool
wwdev
I''d go with the script approach too. That''s what I plan on doing. I''m going to bundle a toolset, like Neverwinter Nights, although not nearly as complicated or polished. Just enough with some documentation to allow a user to update various game controls and events.

-----------------------------
kevin@mayday-anime.com
http://games.mayday-anime.com
-----------------------------kevin@mayday-anime.comhttp://www.mayday-anime.com
I''ll go with the script approach, too. But I want to use flow charts instead of simple text scripts, because flow charts are much easier to understand, more fun to create and even executing these flow charts could be easier...
I guess, scientifically spoken these flow charts are a kind of finite state machines and these were used by Quake for UI and AI.
So this stuff shouldn''t be too bad, what do you think? (I mean I didn''t start coding this yet, so if you think (or better know) that this is complete crap, you could save me a lot of work.... ;-) )

-Philipp
I think scripting would be the way to go, that way anyone can modify the game, and they wouldnt need a C/C++ compiler either.

The only problem is that making a stable scripting engine is HARD! I''ve made several attempts at it and failed. I''d recommend that you check out some of the several scripting languages that are out there today: Lua, Python, java-script (spidermonkey at www.mozilla.org), etc.

But if you want to make your own scripting language, there is an on-going series here at GameDev (I like this one the best) and theres a full series of tutorials over at flipcode.

This topic is closed to new replies.

Advertisement