I’m currently programming a First Person Shooter. I’m looking for the best way to implement the missions. This includes objectives, briefings, etc. I have tried several times to implement a system, however, it is difficult to code and not portable or extendable. I do not want to use any visible scripting tools, as they increase my project size and as this is a side project I have a very limited budget.
Does anyone know a manageable system? I’d prefer an object oriented system to avoid hassles, and so I can attach various scripts to game objects to assign their roles.
Has anyone coded something like this before? I’d very much appreciate assistance.
heres one super mega powerfull uber tool ------ its called ---- HUMAN BRAINS - USE THEM!
write your code, none of those assets will meet your needs, make it your self!
Just for reference:
A good implementation, in my mind, would be a base class for each mission that contain basic information about it, like completion status.
Then each mission, or kind of mission(e.g. Capture x), you create new derrived classes of this. you can then accept all missions in the same way, for instance with mission.Execute(); while the actual mission code is different.
I don’t have time, and won’t, just give you a complete piece of code. Just look at the microsoft C# documentation to find information about deriving classes.
I actually know about deriving classes. What I first did was create a class called MissionController and created an extension called MissionOneUpdater for the first mission. The program contained a method called UpdateMission() that would update the mission and perform any necessary tasks, such as playing a narrative audio clip. The problem was I couldn’t think of a way to do this when an external object was destroyed.
I nearly tried almost twenty different approaches to the problem, all similar; none working.
You can compare the destroyed item was the one you need, or else do nothing. This would also work for a destroy 10 boxes kind of mission. This is de way I would do this, not sure if it’s the “best” one.
Do a class mission that has all properties you need . Make serializable. Try xml and save an array of mission then load it in the application . Make a for loop on each of them calling the abstract method updatemission for instance. The xml file contains missions you have not completed yet.
I would just send a message to a manager when an ondestroy was called for the mission object, or whatever, when an object was triggered, etc. If you make it from a generic class or something, it will probably feel generic in a short while. The missions should be individual.
This is a complex topic. First up there is no best way to do anything in coding. The best way depends a lot on your needs and the scale of the project. That said here is a mental dump of ideas to play with.
I would suggest creating a class for your mission manager. This can contain a list of all currently active missions, and call there various interfaces from there.
Create a mission class (or multiple) that implements interfaces for everyting you need. Use an Enumerator and MoveNext to cycle through objectives. Keep this class relatively generic. Give it properties for everything you need, but don’t hard code any mission data.
Create an objective class that contains the relevant details of an objective. This maybe the place to contain your checking for objective completion stuff.
Don’t hardcode any mission data. Use a serialisation technique to load this at run time. If you want you can also create a small mission editor to eliminate mistakes in writing the data files. You’ll find the level/map editors released with most games were actually built to help the developers make levels, and got shipped as an afterthought.