j0schi's Forum Posts

  • I Finally found it shortly after posting here: So in short: For some reason the array is filling up and i did not notice... so over time the array becomes bigger and bigger and generates the level millions of blocks in front of the player... Finally i found the reason for the lag haha :D

  • Hi, maybe this points you in the right direction: you can compare the X of the source to the x of the player. Then subtract or add (depending if left or right from the source) the distance where there should be full loudness. After that adjust the loudness depending on the distance picel value.

    Kind regards

  • I am testing a game concept for mobile, on very weak cpus. While doing that i noticed a strange behavior.

    Creating and destroying the same objects over a while creates some kind of overhead which eats more and more CPU!

    And that goes without haveing more objects on the screen. After letting the generator run for like 4 minutes the game becomes on playable on mobile.

    Does anyone have an idea what this could be? I checked everything and there is nothing filling up or anything that could cause this behavior.

    In the beginning the object creation takes about 1% CPU and after a few minutes its already 6-7%

    The objects get destroyed when they behind the player, there are never more than 130 objects on the screen.

    The only possible cause for me would be multiplying bigger numbers for position, could that be the issue?

    This is the complete object creation code (no, the array does not have more than a few entrys at any given time, as long as the cpu can keep up:

    This is how it looks like: gyazo.com/0abb10141bf6ac799fbfa26df554f4fd

    This is the CPU Usage on a ryzen after 10 minutes: gyazo.com/6beed8369ee3aa9d22a9397f9a7076f9

    What am i doing wrong here?

    Kind regards

    Patrick

    Quick update: I removed the distance calculation from the single objects and do it now in the beginning once for all objects. it takes like no cpu time at all even after Minutes of running. So something with the object creation / Placement must be wrong here...

  • Maybe its related to this? github.com/Scirra/Construct-3-bugs/issues/5510

    But my devices are not "Old" :(

    Update: It seems like a bug to me, this is how it looks if i make the fog red on my tablet: gyazo.com/92d2e3f5a16f94d5e4812b5a8e32d13a

  • Hi, in my testdevelopment i use volumetric fog to "hide" the spawning of the level:

    you can see how the blocks spawning is hidden in in the distance by black fog:

    gyazo.com/a77b1d67e984d593b677e22f7e6349f2

    however the effect does not work on both my mobile test devices.

    I have an redmi note 8t which just does not show the fog at all, and on my tablet its just hard cut off at the edge where the fog starts: gyazo.com/bf07aa143022d1989bc061b58e1efb1c

    Does that effect do not work on mobile at all? The tablet is a new mid range device:

    Lenovo Tab P11 Plus

    If this effect does not work, is there any alternative?

    Kind regards

    Tagged:

  • No, unfortunately its not fully solved and i have given up for now, i might look later into this again, but i dont think there is a straight forward solution. Maybe the approach to rotate the layer after spawning the sound sources there might be correct, but that makes for a lot of extra uneccesary objects...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The basic audio possitioning does not work for fps (speaking of first person shooter) as it does not take the looking angle of the player into account. so it works only if he looks "up" on the layout.

    for bulluts flying straight its really easy to do, you just set the z elevation of the bullet and laet it fly with the bullet behavior using normal x - y. like this i think: gyazo.com/5cf5926ead353947bcff2b45160a64bd OR you mean something else and i dont get it, in this case i am sorry. The more difficult thing to do is letting the bullet fly "up and down" on z taking the player looking angle into account...

    Edit:

    Had to read again, sorry, you mean straight up, not straight from an fps view...

    jea idk, i havent tested this yet. sory, i thought you meant shooting straight from an fps view... from his point of view to the enemy...

    I might try this...

    Edit2:

    gyazo.com/c745a253c312ca993fdeaf1fb43eb65f

    now the bullets fly up also, isnt that what the op wants?

    Set ZElevation to Self.ZElevation+1/3DCamera.ZScale

    if you have an idea for the audio positioning i gladly take it into account, here i describe the problem: construct.net/en/forum/construct-3/how-do-i-8/rotate-audio-relative-166583

  • So here are my newest findings, i still cant get a formular from this logic tho :( why i am bad at math? XD somehow one have to do an angle correction depending on the player position relative to the sound object.

    So if one uses this formular:

    x+cos(angle)*distance, y +sin (angle) *distance you can take the looking angle and correct it by:

    if source is on the right side its +90

    if sound source is below its +360

    if soud source is on the left side its +270

    if sound source is above its +180

    i am actually doing this by tryial and error, and i still havent figured out what if the source of the sound is for example on the top right of the player... I am sure there is a way to calculate this... Even better would be if someone of the construct team could confirm that there is an intended way to do this or at least that there is something in the making? :D

    Kind regards

  • From my experience the suggestion of Sami424 is actually correct.

    1Z elevation is 17.4px. So if you wannt to raise the bullet 1px/tick you set the z elevation to self.zelevation+1/17.4 also you should take deltatime into account... you can then check the zhigh of an object against the zheight of the bullet and determine if they collide or not at a given point. How fast the bullet raises or falls is determined by the angle, but i have no idea how to calculate that, let me know if you can figure it out :D i would do some trial and error... but must be quite complicated. shooting straight is no problem tho.

    But as you are making a shooter, have you come up with an idea how to determine sound positions? this is quite important for an fps but with the current system C3 has for audio pos its very hard to do...

  • I ralized this only works if the player is left oft the object, if he is right of the object you have to subtract 270degrees, but it still sounds of with above and below. It patitially works correct now, but my thinking must be still somewhat wrong. Does any one have an idea how to solve this? There must be a solution in playing sounds relative to the player? Am i missing something?

    Kind regards

  • So i realised i can calculate the position of the sound somehow. because, i know xy of the player, the looking angle, and xy of the sound source. So with this i should be able to calculate the same position of the sound based on the player angle... I am sure it has something to do with cos and sin but shool was long ago :D Any help on this? :D

    How does the engine actually handle position changes, so what if the player moves or turns arround while the sound is playing? lets say there is a looong zombie moan, i think when the player moves it changes position while moving, but when the player turns, it should not change position, correct? That might be another porblem. I am thankfull for any suggestions, but according to the missing feedback it might just not be possible with constrcut just yet to do it correctly? After all the 3D features are quite new :(

    Something like this might be correct...

    Edit: Solution by newt from discord:

    just reverse the direction and you should get the right sound position:

    visualized result:

    gyazo.com/d77774aa40b01f6b76885747d459fd53

  • Tomycase, i think then you have to regenerate the obstacle map very often, i dont think this will work :(

  • Hi, currently iam working on a fps game. The audio design in constrcut is realtivly streight forward, if the player is left of a sound source i hear the sound from the right speaker and vice versa. But how can i make it relative to the player angle? for example if the player looks down the chanels should be switched, as left is now right and right is now left.

    In an old post i read, that the sound is rotated with the layer, so i did the following experiment:

    which unfortunatly did not work. Do the sound sources also have to be on this layer?

    my last resort would be to reduce the volume by distance to the player, which would be a somewhat unsatisfying solution for an FPS :(

    Kind regards

    Joschi

    Tagged:

  • That with the one missle is ok, but the next should shoot without having to press space again :) I missed the manual tho 😂

  • Nice little game, i would suggest 2 qol changes, for once i would like to hold down the space bar for continuess shooting. 2ndly there seems to be no way to restart the game ater death, thats a bit odd...

    Kind regards