Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

What are you working on :

Recommended Posts

The last time I downloaded that player I didn't see a bone for the pistol. Could you add a bone at the end of the gun so that we can find it in code with FindChild() and use it as the starting place for bullets/laser like you have? That way we wouldn't have to manually adjust anything but just use that as the starting point.


I'd love to see your code for that laser too. I'd like to put it in my mini-game!

Link to post
Share on other sites

@Rick :

I just drag and drop in the editor , the long cylinder laser model to the Lef Hand of the character.

Than just adjusted the Laser roration and position to fit well when character is standing on the editor.


That way when you animate it, the laser just keeps it's offeset and rotation.

Just you Left or right hand, and place some Pivot as child in the editor if you need ot do more stuff by code also.




Any time you can hide / show laser or flashLight by code as they remain entities (or do other stuff)

Link to post
Share on other sites

Good point. I'm so used to doing things in code forgot about this. I'll play around with it as I need it to angle itself based on where I shoot.


Some tutorial on 3D art and mechanics like that could be good, if i have time i'll explain attaching this way.

Attaching is heavy used on characters, vehicles personnalisable , ships, tanks etc ...




Here is the laser model :


I don't have the script Raycasting to change it's lenght.

If you code that i would be interested (and i'll add it to workshop also)

Link to post
Share on other sites

Optimisation and LOD , i'll have to do for Lights and shadows.



It's really visible that dynamic shadows are not enought : at the bottom of columns there is no occlusion like the columns are floating upper the floor.

SSAO shader has a cost , could it be a cheaper technique ? like Pre Backed occlusion ?

There is Navigation Tool, i would see a good Occlusion prebaking tool for people wanting faster than real time SSAO.

Link to post
Share on other sites

Glowing is glowin, to emit e light ou neeed a real light instead of Glowing or some special shader and it will have a lot more big GPU cost.

Sometimes better find the good balance between eye candy graphics and good frame rate.

Nintendo games have not perhaps last gen graphics, but at least they got high frame rate for maximum gameplay sensation.

Link to post
Share on other sites

It would be nice to see the glowing parts of the texture actually emit light

OpenCL allows direct access to VRAM and can do scatter-writes, which are impossible in a shader. So this is one of the things that could possibly do, which would be pretty freaking sweet.
Link to post
Share on other sites

Don't using a pool, and calling each time Load for the prefab , yes there is some freeze of the game each time almost your fire. A game with frezzing even half second or less but perceptible is not playable like some smooth Mario bros games.


Not calling Load is also more optimized, as all bullets in my example are loaded already at game start.

The pool manages all bullets :

- what bullets are free for use

- fire a bullet at some position and direction


When the bullet has done the max distance or collides it just calls is own deactivate function.

When the player call the pool, the pool just search for non active bullets and fires it.

No need to waste CPU by calling Load each time

(The other advantage :the player code don't cares about bullets, it jus call BulletPool:Fire(params) )

Link to post
Share on other sites

A game with frezzing even half second or less but perceptible is not playable like some smooth Mario bros games.


I understand that, but there is no freezing happening in my game when I load the bombs at run-time, so you might have been doing something wrong if you were getting freezes when you were doing it. I just want to make sure you understand how instancing works. Was that bullet a model that you brought into the editor or were you using one of LE's primitive model creation functions?



No need to waste CPU by calling Load each time


Considering that it shares the exact same instance and everything else about the already loaded model, that's like saying no point in calling a function that makes a variable, which happens hundreds of times already in your game. Creating another instance of an already loaded model doesn't take any time at all. It's literally as instant as you can get, so I fear you've made this harder on yourself than it needed to be. Also, this method of pooling doesn't scale very well to games that require a ton of something on the screen at the same time. Any RTS for example wouldn't load hundreds of models at startup just in case, because that's a waste of resources.


So the trade off is CPU vs memory and in both cases they are very minimal from what I can see, so why make your life harder by having to manage a pool of anything?


I just think it's meaningless code and the only bug free code is no code. Meaning the less code you can write to do your task the better the chances of not having bugs.


(The other advantage :the player code don't cares about bullets, it jus call BulletPool:Fire(params) )


There is no advantage with that. You could have just as easily done the same thing and have the BulletPool:Fire() create the bullet at run-time and to the player object it still doesn't care about the bullet.

Link to post
Share on other sites


Thanks for explaining, i think you are totally right on number of points.

My freezing, i think is that i had some Sphere mode creation by code for debugging.


I will try without the poolManager i created.


When the bomb die do you use Relese() without no problem ?

But how to manage the max bullets i screen ?

A global maxbullets in some general script for variables attached to a pivot ?

Or in Player script a maxBullet and bulletCounter variables, that each bullet will update when created and when destroyed ?

Link to post
Share on other sites

In LE 2 I believe there was a copy command that you could use on LE primitives to make instances of them. There is this but it's crossed out so not sure if it'll work or if there is another way to do it. http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entityinstance-r173


You're a modeler why use LE primitives? :) Create your own model, add 1 to your scene and hide it under the ground, then load that model in your game when you need the bullet. Because 1 already exists in your game the engine is smart enough to know that even though you called Load() again, it'll just create an instance o the existing one in your scene.


I do call :Release() on the bombs and it's fixed now. Before this last update it would crash the engine but Josh took care of that.


If you use :Release() on your bullets when they collide or get to their destination, then you control the max number of bullets possible on the screen by your fire rate. This won't always be an exact number as sometimes bullets might travel farther before being released than other times, but it'll always be within 1-4 of a constant value probably.


Just think, if you allow your gun to fire 3 bullets a second, and each bullet lasts for about 2 seconds, you can see that this creates a max bullet range without having to worry about limiting with some max number somewhere.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Facebook Twitter Youtube Github Steam
  • Create New...