Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit) (+1)

So far the best thing to do is to move the wall sprites where the player is looking with the help of "rays".  And I also reduced the number of "bases" and wall sprites.  There is an example of this optimization:

there are only ~ 700+ (wrong in the first time) bases and 720 wall sprites.  Sorry for my English))

(+1)

I tried using distance and raycasting but it didn't go very well for me, it made the lag worse. perhaps the raycasting was too broad? I've not used it before (raycasting) so perhaps I wasn't using it the best way.

I really like the idea of using  a single base to make multiple wall sprites.

i experimented with rays:

(The project file here: 

https://drive.google.com/file/d/1jJyTYdmz-OF-YaZR92Z7nWxZ6ngkFcKC/view )

And to create many sprites on one "base" i used "sprite points"

(2 edits)

For me this example didn't work as good, it is a slight drop in frame rate (1-2fps) compared to no raycasting. [edit] correction, there was a vast improvement in fps. I was using the example improperly. When I changed the animation to the textured wall it improved dramatically. Amazing work!

I haven't tried to make a projectile yet but I've thought about it quite a bit.  

I'm curious what you mean by sprite points. Do you store the coordinates in object variables for the walls to be created? [edit] I looked more at your new example and I think I see what you mean. You're using the sensor to create the necessary objects when it hits the walls. I think this is what you mean?

I had thought of making 4 types of wall base for walls facing north, east, south, and west, then creating 8 at a time in a "repeat" condition

(1 edit) (+1)

This example is "dead end" since texturing with bugs. I just wanted to show you how to create "rays". By "sprite points" I mean this:

I think I still need to learn a great deal more before I can understand it. But it's fun to tinker with. 

I notice I've been able to have up to 48fps in this version but as you say it lacks some consistency. I notice for me the place it has the hardest time is when you get close to walls, particularly corners.

I wonder if  a perimeter around the projected walls to keep the player from getting too close to get a more consistent fps.

In this example, slowdown occurs when close to walls due to the placement of the "wall sprites". There are 181 rays and 181 "wall sprites". A "wall sprite" is "attached" to the end of each ray, therefore, when you come close to the wall, all the "wall sprites" are practically at the same point, since the rays "flow around" the obstacles that you create in the editor in 2D view.

Maybe it would help to make an object to thin the amount of rays sent out when you approach the wall would minimize the issues? Like if you are in collision with an object near the corner you send out 50% amount of rays.

Perhaps, but today there is no time to check. Try testing the second optimization. I have sent a private message to the Gdevelop forum

I recieved it :)

So I abandoned this method

(2 edits)

It may not be ideal for what you are doing. Yours is a first person shooter. For what I'm doing, I don't need a lot of action components. I made a perimeter around the walls, and took out all of the extra stuff. I was able to maintain an almost consistent frame rate ~38-41.

I am going to try and see next if I can figure out how to broaden the ray to give a wider perspective, and see how that acts.

[edit] upon trying the broader perspective I am unsatisfied with the gaps that appear from the thinning rays. I may try wider tiles. I'm undecided at this point. I do like to experiment with it; it is a vast improvement over the previous method.


(1 edit) (+1)

Yes, the perspective can be changed using the number of rays and the variable "Angle_step" For example, in the screenshot, the perspective is set to 180 degrees. If you take 181 rays and a variable of 0.5, then there will be 90 degrees, etc.

It's hard for me to explain, English is not my language. I will post a simplified example of the second optimization method and you will look at the frame rate