I'm currently working on a game akin to Minecraft, i.e. a game with procedurally generated terrain. I'm doing this by using Perlin Noise and determining which ground to place where dependent on some mapping. Now I want to place Objects on top of said terrain and my goal is to have more of these objects in the center of the map than away from it, so a lower distribution of these objects the further we are from the center.
And I'm not sure how to achieve this, I've found several mentions of Poisson sampling and sampling of a circle but these only seem to work in a finite predfined space? Which wouldn't work in my case as the space and distance increases. In addition I would want to be able to input a coordinate and simply recieve yes or no as an answer if an object is present at that coordinate.
So I just wanted to ask if someone could nudge me into the right direction by providing some concepts I could look up?
Related
I'm a beginner in game development and want to create a top-down game using tilemaps. I'm using Godot as my game engine but a general C# solution is fine.
I'm looking to generate lakes in the tilemap but I can't come up with any ideas that might work due to my inexperience. Previously I tried using Simplex, but I decided against it due to the lack of control over where the lakes spawn.
Performance is somewhat important but the world will be finite and not procedural, similar to Terraria.
I'm open to any ideas on the matter that would be reasonable within a videogame.
So for a finite world size, I can sketch an approach for you that you can try out. It is not language specific but you should be able to do that (easily) with C#:
The tiled world is represented as a bitmap: 0=land, 1=water
To generate a lake, mark the starting tile as water and add its coordinates to a queue
Deque a point from the queue. For that tile and for each direction, randomly decide if that adjacent tile is also water. Add newly added tiles to the queue.
Control the lake shape by different probabilities for different directions
Control the size of the lake by either limiting the iteration count or by decreasing the chance of a new water tile by the distance from the starting point
Repeat until the queue is empty.
Let me know how this workes out - I have only tested it using my mental code simulator so mileage may vary;) If you need help in implementing that approach, don't hesitate to ask.
I am trying to create a simple scene where a few objects are placed on the table. Object placement works perfect but when I move the device, the objects drift around a bit. Which at one point makes the objects placed at the corner feel like they are not on the table but floating in the air.
Even in the sun moon and earth example in Unity examples here: https://github.com/googlesamples/tango-examples-unity
The earth n moon drifts as you move the device
Is this a bug or is there any special setting which I'm missing?
The objects drift because as the Tango device moves through space, it is only tracking its own position in 3D space. For objects to remain static in a dynamic environment, the device needs to understand the position of the placed objects in 3D space and their relation to the surroundings in order to anchor the objects and reduce drift.
Luckily, TangoCore has you covered here and the 3 Core technologies of Motion Tracking, Depth Perception and Area Learning all work together to help out.
If I'm not mistaken, the Sun and Moon example is the scene "SimpleAugmentedReality" under tango-examples-unity / UnityExamples / Assets / TangoSDK / Examples / Scenes /
However if you would like to anchor the objects in 3D space and reduce drift, you'll need to use Area Learning and Depth Perception as well. Area learning performs Loop Closures as the device realises it has "seen" an area before and adjusts the path and markers to provide a more accurate device and augmented content position.
So here is what you can do to learn what you need to. Save your current scene, go to open Scene and follow this path tango-examples-unity / UnityExamples / Assets / TangoSDK / Examples / Scenes / and load up some of the other scenes to get an understanding of how the technologies intertwine.
For example, you could load up the ExperimentalMeshBuilderWithColour scene, and learn how the Depth Processing works programmatically, and then load the MotionTracking scene and learn how to access and use Motion Tracking from the TangoManager Game Object. And finally (also probably most frustratingly difficult) learn how Area Learning is managed with the AreaDescriptionManagement and AreaLearning scenes.
This will not only solve your drift issues, but also give you a much fuller understanding of the capabilities of the Tango Technology and allow you to express your ideas much easier.
I am working on a Unity leap motion desktop project using latest versions of Orion and unity prefabs package. I have created a simple scene pretty much identical to the one in Desktop Demo scene. (pair of capsule hands and a simple object you can poke and move around)
https://developer.leapmotion.com/documentation/csharp/devguide/Leap_Coordinate_Mapping.html
This article covers all of the issues I am currently facing but so far, I was unable to implement these solutions in my project.
When moving hands from the maximum range of the camera for example left to right or any other direction, this only translates to a portion of available screen space, in other words, a user will never be able to reach out to the edges of a screen with their hands. From my understanding, the tracking info provided in millimetres by the camera is somehow translated into units that Unity can understand and process. I want to change that scale.
From the article, "You also have to decide how to scale the Leap Motion coordinates to suit your application (i.e. how many pixels per millimetre in a 2D application). The greater the scale factor, the more affect a small physical movement will have." - This is exactly what I want to do in Unity.
Additionally, even being able to what I think was a successful attempt at normalisation of coordinates using the InteractionBox, I am unsure what to do with the results. How or rather, where do I pass these values so that it will display the hands in an updated position.
I'm planning to draw these shapes in WPF. It's for an educational software.
What idea's do you have in how to implement these cubes and views?
I was planning at the beginning starting using canvas and draw, but I guess it will be become eternal. So I supposed if exists some library to help me drawing them?
The ability to draw 3D shapes (such as cubes) and render them from different angles is built right into WPF. From the look of your cubes, you're going to want an orthographic camera, rather than a perspective camera, because the lines composing your cubes are parallel.
You might also find the Petzold.Media3D library helpful, because it has objects like cubes built in (you don't have to write your own algorithms to build them).
Finally, you might this primer helpful in getting started with WPF 3D.
Once you have some idea of how to use 3D, it will just be a matter of putting cubes in your scene at the proper locations and positioning the cameras properly for viewing the cubes. You will probably want to keep reusing the same four camera positions: one for the "3D view", and one each for the top, side, and front views.
This should be a lot less work than trying to draw the cubes using 2D.
For our game we have to create collision detection.
The problem is that the collided objects are in different canvasses/layers, which makes collision detection by pointlocation inpossible.
Does anyone have an idea how to solve this?
It's hard to give a great answer without some more information, but if all your layers are the same size then you can just roll your own collision detection. All you need to know is the locations and sizes of two things to be collision detected. Then you just test to see if one rectangle intersects with the other rectangle.
There is also a function that might be useful to use called TranslatePoint. This translates from one UIElements coordinates to another. So if you had a ball bouncing around in a smaller area of the screen with it's own local coordinate system, you could get the ball's coordinates relative to the entire screen with this function.
Can I suggest you try using the Farseer physics engine just to save yourself some pain?
http://farseerphysics.codeplex.com/
It's very good and is in use in some WP7 games already.
http://www.farseergames.com/
There's also some Blend behaviors and helpers to make using it even easier:
http://physicshelper.codeplex.com/