![]() |
#1
|
|||
|
|||
![]()
Scripting experts...
A few days ago I started to learn how to script and got alot of help from FG28_Kodiak, my personal "scripting swami" as it is (thanks alot mate ![]() I only started to fly CloD some week ago and so far I have managed to complete the offline British campaign. One thing I sorely missed, from first to last flight, is a living breathing world. There where no cars on the roads, no trains, no animals grazing the fields of the green and pleasant land I flew over. The sea was just as empty unless the individual script said otherwise. So, as a first scripting project I gave myself the task of breathe some semi-dynamic life into. Mainly it was just a good starting point. I spent a full day of explring, experimenting and coding before it was done but it seems to work quite well. As I fly over the British countryside I now see traffic and wild life automatically. But now I'm not sure if my solution is optimal and worth using as I move on. Maybe it will turn out to be worthless once I start learning how to build campaigns and/or online missions? Perhaps I should have solved it differently? So I thought I'd present the solution here and have all you scripting gurus give some feedback and maybe a few good suggestions on how to move on. I call my little project "LiveMap" and it works like this: It's based on a class -- "LiveMap" -- that tracks the movement of a "reference actor" and automatically loads sub missons as that actor moves across the map (the reference actor is assumed to be the player but can be any AiActor for experimental/debugging purposes). The logics is based upon FMB sections (the map grid) and as the "reference actor" enters a new section the LiveMap class automatically looks for and loads all missions covering that sector. (LiveMap can also be configured to load all adjacent sections if that is to be preferred.) Each "LiveMap mission" is found using its file name so it's important to name them correctly using this format: "livemap_<X>_<Y>*.mis". For example, the mission covering section X230,Y250 can be called "livemap_230_250.mis". If I would like to separate different types of "life" into several missions covering the same sector that's ok too. Ships, for example, can be put into their own file called "livemap_230_250_ships.mis". Now, since there is the potential to have the system on its knees if too many sectors are activated the LiveMap class automatically discards sectors after a set period of time (configurable). Also, since some traffic probably should be allowed to live it is possible to overrule the "dispose rules" at runtime using custom logics. Typically large ships and perhaps trains would be allowed to live throughout a full mission. If you see a large tanker heading north off the coast of Ramsgate you'd expect it to still be out there somewhere when you return 20 minutes later. There's more (dealing with mission re-use, life time and dynamics) but hopefully this will give all you scripting experts enough of an idea to give critisicm. I will have to spend some additional love on making those canned missions seem more dynamic. Otherwise I will start noticing how the same train seems to always head off from the same station every time I fly into a certain sector. But it's a start. Now, pros and cons as I see it... PROS: 1. Each sector being covered by a separate mission can be tailored individually to suit the kind of terrain it covers. I would expect alot more car traffic flying over a London suburd than would I over Salisbury for example. 2. Anyone with some FMB competence can contribute to the "LiveMap" project. CONS: 1. Potentially alot of work producing "sector missions". 2. Each sector is basically static (can be remedied by code to some extent) Now, let's hear it. Is this an ok solution for adding "life" in a semi-dynamic fashion. Will I be facing problems as I move on to building more advanced stuff like dynamic or online campaigns?
__________________
Core i7 3930K @ 4.8GHz; 16Gb DDR3 (Vengeance); nVidia GTX580; OS disk: 150Gb 10000rpm; SIM disk: 300Gb 10000rpm; Windows 7 x64 Ultimate |
|
|