color_get_green(pix); //forest wall
http://kepfeltoltes....ltoltes.hu_.png
Edited by szotyi41, 19 February 2012 - 09:46 AM.
Posted 19 February 2012 - 09:45 AM
Edited by szotyi41, 19 February 2012 - 09:46 AM.
Posted 19 February 2012 - 09:54 AM
the_color = color_get_green(pix);Now use the_color variable as your color to draw the 3d walls.
Posted 19 February 2012 - 06:57 PM
Posted 19 February 2012 - 09:13 PM
For GM, it's probably more efficient to create a model using whatever lets him generate it fastest (blocks would suffice) than to waste time generating a fancy model.But that is really inefficiebt, if he wants each pixel to represent a 3D block then he needs a voxel engine similar to minecraft and should look around for some of those examples as well...
Posted 19 February 2012 - 10:02 PM
Just generate one fancy model once (at the beginning of the level)For GM, it's probably more efficient to create a model using whatever lets him generate it fastest (blocks would suffice) than to waste time generating a fancy model.
Then you would need to find adjacent pixels to connect to to find out if the wall is horizontal, vertical, both, or possibly diagonal.Alternately, consider creating your levels using walls. It'll be faster and easier than this. Also, you can create a sprite from that if you need.
Posted 19 February 2012 - 10:56 PM
for(i=0; i<=sprite_width; i+=1)
{
for(j=0; j<=sprite_height; j+=1)
{
col=color_get_pixel(i,j);
if(col == redValue)
instance_create(i,j,redWall);
else if(col == greenValue)
instance_create(i,j,greenWall);
}
}Although this would be very slow and result in a lot of walls. It might just be better to save their location in an array.Edited by Buff-Robotix, 19 February 2012 - 10:56 PM.
Posted 20 February 2012 - 04:01 AM
I see I have been misunderstood. When making a level, don't make a sprite. Make a list of walls (start and end). Load that.Then you would need to find adjacent pixels to connect to to find out if the wall is horizontal, vertical, both, or possibly diagonal.
Alternately, consider creating your levels using walls. It'll be faster and easier than this. Also, you can create a sprite from that if you need.
Polygons are fast to draw. (In models. Drawing them individually is really slow in GM) Creating models out of blocks would waste few polygons. (look at the example image. Note the large amount of empty space) The advantage to this method is that it will load as fast as possible (This is why I suggested it).Yeah Im sorry but Gamer3D that would be just way to innefficient, it would be easier to code yes but would be slow as hell to generate the model and much slower to draw it. Lets say we build a 10 * 10 tile model, your way, at 1 pixels deep.... that would be 100 (blocks) * 6 sides each block = 600 faces * 2 triangles per face = 1200 polys. Now if we were to do it my way the 100 tiles would have two faces (top and bottom) so 200 triangles + 40 edge blocks would have an extra 2 faces which are 2 triangles so my total would be about 300 polys. The model would render 4 times quicker so it would be a waste to model all the faces that are never seen just because it is easier to code it.
Posted 20 February 2012 - 05:07 AM
I see I have been misunderstood. When making a level, don't make a sprite. Make a list of walls (start and end). Load that.
Then you would need to find adjacent pixels to connect to to find out if the wall is horizontal, vertical, both, or possibly diagonal.
Alternately, consider creating your levels using walls. It'll be faster and easier than this. Also, you can create a sprite from that if you need.
If you need the sprite, render a line at the base of each wall to a texture, then use that texture. (May need to save to file, load. Not sure)Polygons are fast to draw. (In models. Drawing them individually is really slow in GM) Creating models out of blocks would waste few polygons. (look at the example image. Note the large amount of empty space) The advantage to this method is that it will load as fast as possible (This is why I suggested it).Yeah Im sorry but Gamer3D that would be just way to innefficient, it would be easier to code yes but would be slow as hell to generate the model and much slower to draw it. Lets say we build a 10 * 10 tile model, your way, at 1 pixels deep.... that would be 100 (blocks) * 6 sides each block = 600 faces * 2 triangles per face = 1200 polys. Now if we were to do it my way the 100 tiles would have two faces (top and bottom) so 200 triangles + 40 edge blocks would have an extra 2 faces which are 2 triangles so my total would be about 300 polys. The model would render 4 times quicker so it would be a waste to model all the faces that are never seen just because it is easier to code it.
Your methods (Colton and Buff) are going to be VERY slow to load (and with GM8.1 model draw speed, not noticeably faster than drawing a block per pixel).
If there's anything to take away from this post, it's this: He'd be best off by saving his levels as lists of walls, then building the sprite from it if needed.
Posted 20 February 2012 - 05:36 AM
He wants to be able to use the sprite as a base. If he were to use your method he would need to convert the sprite into a list of walls using the method that I described above.
What Colton is saying is that why use all of the blocks if you wont be able to see half of the faces (2 adjacent blocks have a 2 faces in the same position that won't be seen anyway) You can do what Colton says and it would be more cpu intensive in the first step to generate a model that has only the visible faces in the model. Or you can do what you say and have it be more gpu intensive every step of the game... take your pick.
Posted 20 February 2012 - 11:48 AM
Posted 20 February 2012 - 06:43 PM
Noone has been suggesting drawing using data structures. Everyone has been talking about D3D models. Because D3D models are quite fast, I suggested minimizing load time.Or better yet how about use my script that I started to convert the sprite to a model and then save it in d3d format. I do not know why you guys continue suggesting drawing multiple walls and floors with data structures when all of that stuff is unnecessary.
Note his example sprite. Very few pixels are actually used, so without major polygon reduction (which is possible), our methods will have similar results.and no Gamera3D it would not hurt to draw about 6 extra polys per pixel but when you consider he might have around 100 objects with sprites that would be a large chunk of polys and could make a real difference.
And since he has not stated that his sprites are changed dynamically at runtime then there is no need to even consider any other method because mine will be fastest to load and render and the least painful of them all.
Edited by Gamer3D, 20 February 2012 - 08:45 PM.
Posted 20 February 2012 - 08:43 PM
A list. An ordered set of items (Although it does not need ordering, so a set would have been a better term). I did not say ds_list because I did not mean ds_list. Also, this is for saved levels. Files. Not something to keep in memory and use to render.As a BETTER METHOD THAN SPRITES, I suggested saving lists of walls.
You suggested a ds list...
I missed 3 letters. 4 characters, including the blank. I read your statement incorrectly. I will edit my previous post to remove the erroneous interpretation.Read the statement you quoted me on again, because I stated since they are NOT dynamic he can convert the sprites ONCE only.
-SNIP-
And don't quote me if your not actually going to read what you are quoting me on thank you very much.
I've been telling him to load walls instead of sprites from the beginning:And if he is going to use sprites larger than even 10x10 it is more efficient to write a quick conversion program.
Posted 22 February 2012 - 04:33 AM
//CREATE EVENT (SCANS THE IMAGE)
for(myy=0; myy<=HEIGHT;myy+=inc)
{for(myx=0; myx<=WIDTH;myx+=inc)
{
val=draw_getpixel(myx,myy)
ds_grid_add(global.grid,myx,myy,val)
}}
//DRAW EVENT
for(myy=0; myy<=HEIGHT;myy+=inc)
{for(myx=0; myx<=WIDTH;myx+=inc)
{
val=ds_grid_get(global.grid,myx,myy);
draw_point_color(myx,myy,val); //<---replace this with something like 'd3d_draw_wall(myx,myy,z,myy+inc,myx+inc,myz+inc)'
}}
Posted 22 February 2012 - 07:39 AM
Posted 23 February 2012 - 06:52 AM
You're talking about the editor, not the system. The system is a reasonably robust quadratic bezier spline system.Game Maker's path system needs to be redone. It needs a minimap and zoom features like the room editor when underlay it. And it also needs to allow a point to be connected to more than just one other point.
Posted 23 February 2012 - 08:47 PM
Due to the way that GM's paths work, for a curved path, you'll need to start and end the new path halfway between two points of the path. I think there are functions for doing this. To make the paths connect perfectly, place the first or last two or three points where the other path's points are. You can then check (in the object code) when you're on that part of the path, and switchNo I could never manage a path like that and is why I had to create my own path editor to make these simple paths.
GM's models are effectively a combination of vertex and index buffers.Either that or it would be nice if GM finally had vertex/index buffers because then we could make a simple non textured model to create paths like the Unity game engine.
Posted 24 February 2012 - 06:11 AM
I suggested creating your own path system because it seemed like you wanted a 3D path (when you suggested using the vertex buffers).No I still don't like any of that at all it would be better if GM's path system just had the functionality of connecting to more than one point. As far as creating my own path system that just replicates GM's, then what is the point of even having a built in path system at all? And all of the other curve calculations and extra things that define the path should just be extra options. GM's path system needs allot of improvements.
That violates a very important rule: Gameplay components should never depend on graphics components.Let me rephrase when I said GM should utilize vertex/index buffers, it should allow us access to vertex/index buffers. Obviously every game that uses DirectX makes use of index/vertex buffers. And I like this better for making a path a model because then we don't need any messy GML code to load the path, we just call d3d_model_load() and use the theoretical vertex/index buffer functions and buda bing buda boom we have our path.
read a line or two (get past version number)
while (!eof) {
str = readline
switch (number at beginning of line) {
case primitive begin: start new path.
case primitive end: stop editing path
case vertex (of any type): path_add_point(current path, second number on line, third number on line, 100)
}
}Posted 24 February 2012 - 06:16 PM
No, no. The ball is in your court now. Tell us EXACTLY how to merge it with a system that does what you want while keeping it simplified. Do it in a PM if you wish. I want to hear this.Well with the paths I am not going to argue because Game Makers path system and editor are completely useless, and we should have more control over them. I don't like them because they are oversimplified so that new users can get objects to follow paths without much coding. But there is a way that it could be merged with a more advanced system and remain simplified at the same time, but I am not going to bother arguing with you over the details of it because it is pointless so just drop that subject.
Sure. Add zoom and minimap features to the path editor. Those won't break anything, so I couldn't care less.All I am saying is I disagree with you and feel it should be greatly improved, either way though I am sure you agree with me that they should add zoom features and the minimap from the room editor, I hope...
Animation would be a nice use of such a hack, but with the current GM model interface, exposing vertex buffers would not be the way to do it (again, because it makes it more difficult to change in the future).And I completely disagree with that YYG should expose the index/vertex buffers. This would provide us with efficient methods of animation, and so many other improvements. How nice would it be if you could edit the heights of a 3D terrain in real time without reconstructing the model? Many people are suggesting this for Game Maker 9 and it should have been available long ago, the BlitzBasic engines and DarkBasic engines had functionality for this long ago.
A GM smooth path is a quadratic function in 2 dimensions and is used once per object. Having it built-in or in GML will not make any significant difference to performance because the function itself is so tiny and little-used. In fact, a GML function this tiny could probably run as fast as a call to a built-in GM function, or faster.And I still disagree, I have written my own path system for Most Wanted already that allows me to make multiple connections. But as you already argued too much GML is sluggish, but you say YYG shouldn't do anything that greatly improve my games efficiency? Quite a contradicting statement there.
Edit : And as far as the paths go I would rather have creativity and functionality over simplification or in other words bread and butter. And either way none of this matters because most of Game Makers inner workings are being completely restructured with GM9 so that more functionality can be exposed (read Mike Daily's blog) so your argument is completely mute.
Posted 25 February 2012 - 12:23 AM
Posted 25 February 2012 - 01:15 AM
No system (that I can think of) could cater to all path systems. Keep in mind, however, that the path system is used by many other functions, including the mp_grid system. It's become too pervasive to be easily removed (or changed, for that matter). I'd rather avoid having more systems become pervasive.If everyone is going to utilize paths differently, then it should be some sort of system that caters to all path systems or none at all.
Animation was the good thing. It was a good point on your part.As far as the index/vertex buffer exposure, you still did not say tell me anything bad about being able to manipulate the model data in real time, other than animation.
I didn't use the surface fix hack, but I was quite happy when surfaces were fully fixed.Also as far as it being a hack, I suppose you were against the original surface fix hack to?
How do I sound like I'm contradicting myself? I have said time and again that the built-in path system is sufficient for its intended purpose, and that making it more complex would be a bad idea. I haven't defended YoYo's choice to include a path system in GM, so nothing has been contradictory.And in response to your last paragraph, I am not really sure what you are referring to there. If you mean you would not like a more advanced path system, because I am to lazy to write a few extra lines of code (which I am not, and already have), then why are you not also complaining with me about the useless one already included? And I thought you said...
In fact, a GML function this tiny could probably run as fast as a call to a built-in GM function, or faster.
So you sound really contradicting in that paragraph, please elaborate.
Finally. Something we agree on.%100 AgreeP.S. No, I don't like hspeed, vspeed, direction, speed, gravity, gravity_direction, etc.
0 members, 0 guests, 0 anonymous users