bergerkiller Posted October 2, 2010 Report Share Posted October 2, 2010 By accident I found out that you can make an actual laserpointer inside Battlefield 2! This is how: Clone the "UniqueTarget" (they are in weapons\targetobjects) and rename it to: "LaserPointerTarget". Set the "timetolive" of the targetobject to 0.1 else it stays visible after you died. Addtemplate a "glow effect" to the targetobject. You can also make your own effects for this. I added: ObjectTemplate.addTemplate glow4 Note that glows are quite large, you might have to re-make one smaller glow for this Next, add the following LPTargetComp to a rifle: rem ---BeginComp:LPTargetComp --- ObjectTemplate.createComponent LPTargetComp ObjectTemplate.target.maxDistance 9999 ObjectTemplate.target.setTargetAtMaxDistance 1 ObjectTemplate.target.targetSystem TSWireGuided ObjectTemplate.target.targetObjectTemplate LaserPointerTarget ObjectTemplate.target.disableGuidanceOnReload 1 rem ---EndComp --- You could even make a projectile follow the laser like some of the laser guided AT weapons. Only downside is that it doesn't create "laser beams", but those aren't visible in daylight anyways. It does create awesome pinpoint effects on your target, for example, you can make a dot appear on a soldiers' head. Quote Link to comment Share on other sites More sharing options...
DEVILMAN Posted October 3, 2010 Report Share Posted October 3, 2010 Quote Link to comment Share on other sites More sharing options...
bergerkiller Posted October 3, 2010 Author Report Share Posted October 3, 2010 Nice one, but it's not going through buildings n such, does it? That's the problem everyone has. Quote Link to comment Share on other sites More sharing options...
Cobra_SFX Posted October 3, 2010 Report Share Posted October 3, 2010 Excellent, maybe a game of FreezeTag like Mefy made for MOH? Quote Link to comment Share on other sites More sharing options...
bergerkiller Posted October 3, 2010 Author Report Share Posted October 3, 2010 Found a nasty downside...the targetobject is not destroyed after the player dies/weapon is changed. Not sure how to fix that. Quote Link to comment Share on other sites More sharing options...
UberWazuSoldier Posted October 4, 2010 Report Share Posted October 4, 2010 (edited) Yeah, well, the classic way (as demonstrated by DEVILMAN) to do it is really flawed, where you put it on the model (only the 1p so it wont go through the walls). I really like this new idea though, it's a shame it has that dying problem, but unique targets aren't used very much anyway so it doesn't seem like a massive downside. Very nice work, definitely an improvement on the old way. And having the glow object definitely makes a lot more sense than having a big red stick protruding from your gun model, since as you said; you're going to see the reflected light, not the beam itself. Edited October 4, 2010 by UberWazuSoldier Quote Link to comment Share on other sites More sharing options...
bergerkiller Posted October 4, 2010 Author Report Share Posted October 4, 2010 (edited) Thats the awesome thing, you could transform it into a weapon inside a vehicle! Maybe car lights are now possible. And what about searchlights O_O! EDIT Currently making a video of a "gun with flashlight" in a chopper Sigh it does work, but the light just sits there when the gunner leaves Guess the only cool thing you can do with this are "indestructable flashlights in camps", else this "target stays" bug just remains. Also, the target disappears when its timetolive is 0 and the weapon is destroyed. (it stayed longer because the weapon remained in the kits) Edited October 4, 2010 by bergerkiller Quote Link to comment Share on other sites More sharing options...
BEEX Posted October 4, 2010 Report Share Posted October 4, 2010 i dont know if either of these will work but its worth a shot. try adding the below line of code to all soldier.tweaks...armour comp... . ObjectTemplate.armor.hideChildrenOnSpectacularDeath 1 . in theory this should remove the issue of objects being left behind after death. . also something like ClearOnExit might resolve the issue of the pointer being left behind after exit. Quote Link to comment Share on other sites More sharing options...
bergerkiller Posted October 4, 2010 Author Report Share Posted October 4, 2010 Nah thats not the problem. The targetobject stays there as long the firearm exists in any way in the game. So, if a soldier dies while aiming, the weapon stays in the kit and is not destroyed until the kit "fades" away, then the weapon is destroyed and the dot disappears. Same for vehicles, as long the vehicle exists in any form it is not destroyed. It is useful for a permanent flashlight though. Quote Link to comment Share on other sites More sharing options...
mschoeldgen[Xww2] Posted October 5, 2010 Report Share Posted October 5, 2010 Carlights have been possible for along time. In XWW2 we also have a pocket (flash-)light. But the lighting in BF2 is flawed unfortunately so that hitting a building or other static with the light looks odd sometimes. Its better with bundledmeshes ... Quote Link to comment Share on other sites More sharing options...
bergerkiller Posted October 5, 2010 Author Report Share Posted October 5, 2010 BTW this kinda looks like the "sandbox" mod, I added a hotel and can make the hotel appear at the specific point I aim. Pretty awesome Quote Link to comment Share on other sites More sharing options...
UberWazuSoldier Posted October 5, 2010 Report Share Posted October 5, 2010 (edited) ' date='05 October 2010 - 11:17 PM' timestamp='1286277454' post='101217']Carlights have been possible for along time. In XWW2 we also have a pocket (flash-)light. But the lighting in BF2 is flawed unfortunately so that hitting a building or other static with the light looks odd sometimes. Its better with bundledmeshes ... Wouldn't that be spreading out in all directions though? DICE has removed spotlight support from the game, and the shaders only support Gouraud shading for them (which further suggests it was removed), also none of the mesh types actually use the spot light stuff. One thing that's been bugging me about lights is how Battlefield 2 doesn't have shadows for any lights other than the sun. Battlefield 2 could look as good as Call of Duty 4 if they hadn't set their terrain to use a separate pass for lightmaps (so I can't generate normalmaps and have the lights illuminate them), also the terrain doesn't get any information on light direction, so there is no chance for specular lighting. But most annoying is that lack of shadows for point lights, it would have made the game so much better - their crappy culling system keeps culling lighting when you face directly away from it, and doesn't cull skinnedmeshes and bundledmeshes at the same time (so sometimes your soldier is illuminated but not your gun, and sometimes the other way around). Like I mentioned earlier, they also broke point lights for bundledmeshes (no colour for them), and skinnedmeshes (they used the wrong function so the light doesn't drop off properly). Point lights may be the only way to do it, but that's far from ideal. Edited October 5, 2010 by UberWazuSoldier Quote Link to comment Share on other sites More sharing options...
BEEX Posted October 5, 2010 Report Share Posted October 5, 2010 i wish dice would fix all the broken stuff and make an update for high end systems,there would be a handfull of people running bf2 on a 5yo machine. . "limitations",we need to accept it doesnt work 100%. Quote Link to comment Share on other sites More sharing options...
mschoeldgen[Xww2] Posted November 26, 2010 Report Share Posted November 26, 2010 (edited) Wouldn't that be spreading out in all directions though? DICE has removed spotlight support from the game, and the shaders only support Gouraud shading for them (which further suggests it was removed), also none of the mesh types actually use the spot light stuff. ... Point lights may be the only way to do it, but that's far from ideal. Sorry for the late answer but i'm struggling with net connection here in my new home. I use non-damaging projectiles with lightsources attached to them to work around the spotlight limit. The projectiles are emitted very fast ( lightspeed would be ideal but is too fast for the engine ) The TTL of the projectile determines the range of your lightbeam. Making the light emitter ( headlights or the pocket lamp ) a weapon also has the advantage of being able to shut it down again . The downside is that it takes away one fire button in vehicles for the 'light operator' which is usually the driver. As they are projectiles they are stopped by the first object in the firing line which mostly gets rid of the 'lights through walls' problem. Edited November 26, 2010 by mschoeldgen[Xww2] Quote Link to comment Share on other sites More sharing options...
bergerkiller Posted November 26, 2010 Author Report Share Posted November 26, 2010 But most annoying is that lack of shadows for point lights, it would have made the game so much better I hope you understand the basics behind the generation of dynamic shadows It has to do a pixel-to vertice translation for every single pixel in every static that is affected by the light source. Then, it has to determine the impact spots of every vertice, make a shadow volume out of this and actually cast the shadow onto the meshes using some planes. In an example I found it even lags if you have 3 light sources and 3 objects rendered...so I pretty much understand they only use the sun as lightsource Indeed, on these machines it is quite easy to render multiple light shadows, but at the time it was a new thing and hard to do efficiently. Mind the "hard shadows" casted by the engine. Quote Link to comment Share on other sites More sharing options...
rhysm_08 Posted December 9, 2010 Report Share Posted December 9, 2010 Hehe Bergerkiller, i see that you have gained some insight about game engines from your VB game project Quote Link to comment Share on other sites More sharing options...
UberWazuSoldier Posted December 19, 2010 Report Share Posted December 19, 2010 (edited) I hope you understand the basics behind the generation of dynamic shadows It has to do a pixel-to vertice translation for every single pixel in every static that is affected by the light source. Then, it has to determine the impact spots of every vertice, make a shadow volume out of this and actually cast the shadow onto the meshes using some planes. In an example I found it even lags if you have 3 light sources and 3 objects rendered...so I pretty much understand they only use the sun as lightsource Indeed, on these machines it is quite easy to render multiple light shadows, but at the time it was a new thing and hard to do efficiently. Mind the "hard shadows" casted by the engine. Don't worry, I'm quite familiar with the process. 3 light sources ought not to lag with 3 objects. Battlefield 2 is one of the last FPS games to not have shadows for point lights. Using a shadow volume is a way to get very accurate shadows, but they look very sharp and it's definitely a sub-optimal way to do it. A far more typical setup for newer games consists of rendering onto 2 or 6 planes with a simple shader, and then doing a pass for the objects to compare the calculated depth to that of the depth buffer. If it is within a certain margin of error, it is assumed to be illuminated, otherwise it is in shadow. Because of the simplicity of the shaders and the fact that the shadow buffers don't need to be all that big, it doesn't have a particularly massive impact on performance if used sparingly. BF2 clearly already had systems in place for this, and it's clear they had planned to have conical lights and such. Indeed, there are rudimentary shaders lying around which make it seem as though DICE started down that path. So yeah, the two-plane approach is using paraboloid mapping, and the six-plane would be using cube mapping. Either way, it allows for 360 degree shadow mapping. Conical shadows are the easiest, as they involve only one plane. The actual transformation of vertices is no trouble for any hardware, and you don't need to create and destroy surfaces because you can just recycle the same ones each frame. So no, I would disagree with you about the performance being a huge factor. I suspect it's more of an effort thing, and DICE probably didn't initially plan to have night maps (so no need for headlights or flashlights). Edited December 19, 2010 by UberWazuSoldier Quote Link to comment Share on other sites More sharing options...
Chael Posted December 20, 2010 Report Share Posted December 20, 2010 Ever get this laser pointer to work over the network? I tried adding networkables to everything, but it just wouldn't work. Oh and I swapped out that glow effect for a small sphere; works a lot better and doesn't disappear inside walls and things. With a little neon glow it would be pretty awesome. Quote Link to comment Share on other sites More sharing options...
bergerkiller Posted December 21, 2010 Author Report Share Posted December 21, 2010 I'm not sure if it works over the network, but afraid it isn't. Guess DICE never sends targetobject information over the internet. Added to a networked object is no problem, but when it's stand-alone (like in the target comp) I guess no info is sent over. (why would the other guys want to know on what you are aiming with your eryx?) Quote Link to comment Share on other sites More sharing options...
UberWazuSoldier Posted December 22, 2010 Report Share Posted December 22, 2010 I suppose that makes sense... By the way, I REALLY have to try this out, it seems exciting. Quote Link to comment Share on other sites More sharing options...
Lauryxy Posted January 15, 2011 Report Share Posted January 15, 2011 Cool! I'll try it out, but how to give it that red color? Quote Link to comment Share on other sites More sharing options...
bergerkiller Posted January 16, 2011 Author Report Share Posted January 16, 2011 Just make/use a red glow. You can clone an existing glow and change the texture of it, or you can model your own. Problem with some standard glows is that it "disappears" when looking at it in a certain angle. Glows are in Objects\Common\Glow. You just change the addtemplate in your target object: ObjectTemplate.create TargetObject FlashTarget rem ObjectTemplate.setNetworkableInfo LaserTargetInfo ObjectTemplate.createdInEditor 1 ObjectTemplate.timeToLive 500 ObjectTemplate.targetType TTUnique ObjectTemplate.addTemplate glow_red I'd say clone and rename the "glowshit" glow to "glow_red" and change the texture of the bundledmesh (also clone bundledmesh) to Objects\Common\glow\glow5.dds. The standard glow5 is extremely large (some sort of sun-like glow), so add-tempalting the glow5 wouldn't do for a laser target. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.