Proton Beam


(fitz301) #1

Hi guys,

I’m hoping you BGE experts can help me figure something out, or at least point me in the right direction with what I’m trying to do.

What’s the best way to do a Ghostbusters (1984) style animated proton beam, for a fps game in the BGE? Can animated curves be used in the BGE?

I would like for one end of the beam to “lock on” to the intended target and have the beam dance around wildly between the target and the barrel of the beam thrower.

How would this be done, if it could be done at all?

I’ve been playing around with some ideas on how to do this, by all failed miserably.

TIA
fitz


(Monster) #2

There are several ways to do that.

A) Play sprite animations. Track the target and scale the size it ends there. Pretty simple and effective. Dependent on the view angle it might look flat (as it is flat).

B) Curves - no - not supported.

C) Particles. Have one or more emitters that track to the target and are scaled to end there (similar to A). The emitters should emit particles (objects) between origin and target. This can be done by letting emitter objects play curve animations.

D) Python calculation: manipulate the vertices of one or more meshes via Python.


(BluePrintRandom) #3

ok

start  = player_weapon.worldTransform*Vector([x,y,z])
End = player_weaponRay.hitPosition
p2 = ( (start * 3 )+ end)/4
p3 = (start+end)/2
p4 = (start +(end*3))/4

# this is start, 1/4, 1/2, 3/4, target 
list = [p1,p2,p3]
#then we do
for point in list:
    y_offset = -Range*.5 + (bge.logic.getRandomFloat()* Range)
    z_offset = -Range*.5 + (bge.logic.getRandomFloat()* Range)
    point += weapon.worldOrientation.col[1]*Vector([0,y_offset,z_offset]) 

#now simply connect the dots.
bge.render.drawLine(start,p1,color)
bge.render.drawLine(p1,p2,color)
bge.render.drawLine(p2,p3 ,color)
bge.render.drawLine(p3,end, color)

this is what it looks like in practice

we can place 3d object at start point, and stretch to end point for each point in chain also
use more or less points based on distance etc.


(BluePrintRandom) #4

Attachments

zap.blend (462 KB)


(fitz301) #5

Thanks for the quick responses, the videos were very inspiring… looks like I’ve got some python to learn.

Is there a way to add thickness to the beams or would that open a can of worms not worth dealing with?

Thanks alot!
fitz


(cuervo1003) #6

for some reason i feel like giving this a shot. Ill help figure it out. I like blue prints video, but the blend didnt work for me. i may keep the code for later. thanks.

About the proton pack rays. I do have an idea using my old curve file. seems like it needs 2 objects the red sine wave like center, and a more conventional electricity look , but in a beam like form. I do have a way to do it but lets see. ill get back to u later.


(BluePrintRandom) #7

you have to left click to activate the code cuervo*


(cuervo1003) #8

@Blueprintrandom I got it. just read the console. error on vector. its cool. works


(cuervo1003) #9

its comming along. just need the lightning around the red beam. the hard part is done.


(cuervo1003) #10

Done. Well at least the proof of concept. its using the same script twice, not good, but my ac is broke n time to get some air. n drink a beer. lol

I will fix it with all the dazzle later.

Attachments

photon_blaster.blend (1.78 MB)


(cuervo1003) #11


here. just got back n a lil buzzed so… do i fix it or forget it? lol

if u guys like it n need it, ill jazz it up a bit, but this is pretty close to the idea of the proton pack stream.

dont ask it just works. hah


(fitz301) #12

That’s EXACTLY what I was trying to do, you guys are definitely way better at the BGE than I am - all these are great!


(fitz301) #13

I’ve been messing with your photon_blaster and trying to figure out how the code works, but I can’t seem to get the lightning to work like in the screenshot.

Is it just an animated texture? I can never get animated textures to work properly and I don’t want to break the rest of the beam animation, is there some things I need to change. I tried turning on the animated textures in the UV editor, but that didn’t work and anything after that I am not familiar with as I don’t mess with the BGE that often.

Thanks again for the .blend file.
fitz


(cuervo1003) #14

can u send a pic of what is happening?

this new file has no errors for me so send image of console for errors.

This is the newer file i put all both meshes to use the one shader code.


the file should just work when u press p. Here is the latest file.

Attachments

photon_blaster2.blend (1.81 MB)


(fitz301) #15

The most recent .blend works perfectly, I was referring to the previous one.

These look really fantastic.


(Nick Manchul) #16
  • under what conditions can I use this file? Tutorial, free reference, in commercial terms?

(cuervo1003) #17

I dont care how u use it. when i put stuff out its for free use. if u get rich off it let me know. lol

go sub to my channel.
https://www.youtube.com/user/carlosandlexi/videos?view_as=subscriber

I’m assuming u liked it?


(Nick Manchul) #18
  • recently I watched the video on Youtube, there was missed one punctuation mark, and this was the reason for breaking the multimillion-dollar contract … somewhere in Canada.
  • you have a good channel, good graphics in games. Also a good shader …But probably I will use my experience with a possible future project.

A good solution (especially for shaders) can be officially sold (copy) - 1-5 percent of the game for a few shaders (weighty), or by other arrangements.

A simple scheme:

  • free to download, it does not mean free to use
  • free to download and free to use, it does not mean - free to commercial use or free to editing

and… The Law says so - if you downloaded someone’s scene (resources) without specifying a license, then a full copyright for the owner. CC BY 3.0, GPl - these are not empty words.

Thank you.

p,s and Super Mario Galaxy is not a brand (тм)? Just stupid will later work on someone … In what country do you live (work), why did your intelligence not warn you?

The key to successful freelancing (individual creativity) is the use of fully licensed software (resources, names).
And if your hands are folded behind your back when you are walking around and think - the spiritual world, it is also your spiritual slavery for your theft … and you are unlikely to go to your project (final).
In a place where nothing can be seen or heard, everyone knows, and mechanics works irreproachably.


(cuervo1003) #19

@ Nick So i come and decide to help my fellow blender users, mostly because i feel obligated as a vet user i have been helped so much by the blender artist community. Kinda sux to see that is how u feel. I do understand what ur sayng but i don’t care about it. I enjoy just playing my game and am a true fan of mario. I have thought of rewraping it as my own game( new models same code). I see it as constructive criticism as if feel i only get shit because its obvious i can make any game i wanted. I tend to make librarys of my code for later use, and my format for SBG is made to suit these needs. Its basically a learning experience n even though i havnt finished SBG i have matured enough to know making anything else is possible and how to handle people that are negative towards something i’m passionate about.


ps: that electric proton pack shader benefited for this project and was able to be changed from a ride-able vine to the proton pack in a less than a day. I wish i could have showed it off in my game but i took it out and went out of my way to do it for u guys so… Now u can use in for what ever you choose thanks to me and i have to wait till i get to show it off in my “failed” game. ur welcome i guess.


(Nick Manchul) #20
  • I may not correctly understood, but I have no complaints about you - you have everything beautiful. But extra caution, as well as respect for someone else’s copyright - superfluous does not happen.
    And I also feel there is a need to share my examples - I also learned a lot on this forum - a little gratitude for the help.

Thank you for attention.