• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

3d begin

So I have worked in 2d, some time to realize how this work and dif from c#, and I want to create a 3d game to challenge me :).

So I want a start and on the interned I dont find anything what I want...

1) A collision system, how I could do?
2) From engine to engine x,y,z dif, so in 2d I know Y is the height and X is the width, so here who what does?
3) I want a method to check if the mouse is on the object, I find a way on the youtube, but that is a little bit tricky and I see a potential bug in it(the trick with draw model colour) also if I make that object on more drawing things to detect them.
4) Check terrain collisions..., who I can detectect my terain y, z or x (what coord def the up and down)
5) and play sound volume ( how I can set the volume of that)


I dont want any dll, and things like that because I want to learn by my self
 

Yambam

Member
I'll try to answer your questions one by one. :)
  1. Same as what @KingdomOfGamez says, you can use place_meeting and design using some kind of top-down view in the normal room editor. Then you can check for the z variable yourself. E.g.
  2. In most GameMaker games the (0, 0, 1) points into the right sky if you are standing at (0, 0, 0). That means that positive (+) Z is higher than negative (-) Z and if you only change the X and Y coordinates of a model, it stays at the same level. You can change the so-called up-vector yourself, for example (0, 1, 0) is the up-vector in Minecraft and some other games I know, in those games Y is the height instead of Z. :)
  3. For checking whether the mouse is on top of a wall or a floor, you could use these scripts written by Xot, their usage is explained by Phantom107's example: http://gmc.yoyogames.com/index.php?showtopic=416555
  4. I'm not sure what you mean, but you could use a grayscale heightmap for that I think.
  5. I think you can create a (3D) audio emitter using `emitter = audio_emitter_create()` and then set its position in 3D space using `audio_emitter_position(emitter,X,Y,Z)`. I never used those functions though.
 
M

Misu

Guest
Im sorry KoG but you are not helpping out correctly. Allow me to assist on this properly.

A collision system, how I could do?
There are multiple methods to accomplish a few algorithms on 3D collision. Understanding GM's potential, its better to go for the most efficient technique. As KoG stated earlier, sprite collision would be the most basic and reliable method on GM. However, sprite collision would apply for the x and y coordinates but NOT z. For that, you need to create your own constant or variable to specify a local z value for a specific object or entity. Then you would have to check if both top z and/or bottom is within a range from any of the collided entities' z value. For example:

Code:
if (z1 < other.z2 && z1 >= other.z1) 
  or (z2 < other.z2 && z2 >= other.z1)
{
  // Do action
}
Also, avoid using the default collision event. GM's collision comes with a built in trigger that is automatically executed once you call the event. This trigger causes the entity to become solid and hault motion sometimes. This can lead to future bugs along the way and can be a pain in the head to resolve. For checking collisions, is recommended to use step event and this function:

Code:
place_meeting(x,y,object)
3D collision is one of the most complexive and challenging processes to establish in a game so take that note in mind.

From engine to engine x,y,z dif, so in 2d I know Y is the height and X is the width, so here who what does?
Depending on what perspective.
Normally in hud, xy can be width and z is height but in a projection view, its pretty much the same, x is x, y is y, and z is z.
However, when drawing a projection, you are viewing the world sideways so that z is the height. With some algorithms on tweaking the z rotation, you will be able to change that perspective. Is recommended to use lengthdir functions to establish the rotation of the projection. Since there is no lengthdir_z, you can still use lengthdir_x for that but requires to synchronize the length argument for the other lengthdir commands from x and y.

I want a method to check if the mouse is on the object, I find a way on the youtube, but that is a little bit tricky and I see a potential bug in it(the trick with draw model colour) also if I make that object on more drawing things to detect them.
I know three techniques that can work:

1. Using a 2D to 3D conversion script to convert the mouse coordinates so it can also specify depth as well (xyz). I rember one script back at the old gmc by "yourself" I dont remember.
2. Ray casting. Although this method seems complicated to establish, its the most used method by many game developers and most reliable. Calculating the direction, and length within projection view, you can trace out a depth and capture what entity has that trace pointed or meet up.
3. Color surface technique (which is the easiest method yet average). I use this technique myself most of the time since im lazy. What you do is create a surface image of the projection screen but using a shader that turns your view into color coding instead. Then by using surface_getpixel, i can retrieve a specific color id, which represents a specific entity on the screen. I use shaders now sinve it can help me determine at least the depth value as well. However, this is an average technique that costs your performance on pc.

Check terrain collisions..., who I can detectect my terain y, z or x (what coord def the up and down)
There a few ways to do this. What I usually do is create several variable arrays during the terrain creation process that determines the z hieght of each vertex. Then I create a script that checks for my xy position within the closest triabular boundary around me and with an algorithm for detecting the z height base on three vertices, i set that as a separate z value for my object.

and play sound volume ( how I can set the volume of that)
I remember in the old game maker legacy had a function for that but with gm studio, there is the new sound engine that comes with new functions. You can change the volume base on distance from projection view. That would be my idea. I really never worked with sounds in my projects to be honest so my knowledge isnt much there.


Ok so I hope most of that helpped you and if you need any help, check out in the programming subforum for a thread about game maker mentors. We have people who can help you out on the 3d creation process as well. Feel free to ask questions also whenever you are stuck. We are here to help always. I wish you luck with Game Maker :)
 
You told me very good, I like it,I love, I dont have word of what did you say.

But a good way to generate terrain like minecraft? I dont like the perlin method, and I dont belive there is something like this in the game maker. So is there a way to make a random terrain generation, using only z (who I understand is y from other games). I want something nice and beautiful like minecraft :p
 
M

Misu

Guest
Unfortunately, base on GM's potential, the only method adecuate would by generating using perlin noise and vertex buffer.

I never attempted to make a terrain similar to minecraft before but the realtime modification process would be much complicated and relies on how you generated the terrain in the first place.
 
M

Misu

Guest
Examples, i cant think of one. I never got to practice perlin noise with GM before but I know a basic fundamental on perlin noise online. Its extremely short

http://flafla2.github.io/2014/08/09/perlinnoise.html

You may want to also know what is an octree system too. That might be required for creating collisions for that kind of terrain generation.
These stuff are an advance level so you should first get to familiarize with GM's interface and work flow. Try doing basic practical projects before jumping in to these kind of concepts.
 
Examples, i cant think of one. I never got to practice perlin noise with GM before but I know a basic fundamental on perlin noise online. Its extremely short

http://flafla2.github.io/2014/08/09/perlinnoise.html

You may want to also know what is an octree system too. That might be required for creating collisions for that kind of terrain generation.
These stuff are an advance level so you should first get to familiarize with GM's interface and work flow. Try doing basic practical projects before jumping in to these kind of concepts.
I was working a long time, like 3 months and like 2 years of basic c#
 
Top