I would use a static value for testing but ideally the value of this float would vary depending on the Z axis of the prop.Ī = (PlayerXLocation - LastPlayerXLocation) * ParallaxSpeed Once a prop enters camera view the math below would run on a tick.įloat ParallaxSpeed = 0.1 //higher values = more movement. I have an idea of how I would make the blueprint. I’m not 100% sure how difficult that will be. From there, try to manipulate said object types in array. One thing I’m wondering before I go about jumping into your method, would I be forced to make a blueprint for every prop or could I just drop sprites and set a custom object type, and set the player collision to only hit that object type. I actually did the opposite and made collision around the props but I feel like your idea would tidy up the level a bit and require less work. If you do not have tiles, apply above but with plain distance to camera location. Or just do event tick with that checking for “last update” time at very beginning in each blueprint tile. You can use event dispatchers here, register/unregister blueprints to create/destroy event. And create destroy stuff like i described on top. So when there is time to update, check distance to center tile. This is quite big optimization compared to checking this all every tick. When time is more than shortest crossing time (see above) update this tile. Each one should have variable “last updated seconds” get this from “get game seconds”. Calculate shortest time for player to cross one tile, this will be you time to do the loop/update. You call that functions for edges that player is moving to and for ones that are outside of scope.Įasiest way, slightly slower, but much less code:ĭepending on how fast player can move. Now you need functions that can create row or column, and other that can destroy row or column. Easiest way would be if every tile was very simple blueprint. You need big array (x*y size) with pointers to tiles. Now most efficient way of implementing this: outer one, that is outside camera view.you watch all tiles hare and create ones on sides that player is moving to. one that is mor than 2 tiles away from camera edge and less than 6-8 tiles (engine needs time for streaming in). the one where you just do not mess with create and destroy. most inner one, that is in camera view or right next to it (like 2 times margin).Make 3 squares on your map froms smalles to biggest: For this you should dynamically create and destroy tiles (or objects). You have ortho camera, soo i assume some kind of scroller or strategy/tower defense or topdown view. Or just flat cull out above some distance. Then top and best (or first line) optimization should be cull distance, either use trigonometry to find distance from Camera when to cull (if camera can zoom in), or use curve graph for it. First if you do not develop this for mobile do not worry much with blueprint performance, well not until you have more than 100 objects to check.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |