This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 »
1756
Announcements / Re: Scalability
« on: December 02, 2010, 09:53:34 am »
Will wiki also feature all default functions and its parameters? Or there will be a help file for that?
1757
Function Peer Review / Custom: Curve drawing functions (Bezier and Spline)
« on: December 02, 2010, 09:36:53 am »Curve functions
Version:1.1
Changelog:
1.1
-Added new spline functions that have control points
-Made spline_begin() function use vectors and stacks. This decreases memory consumption and allows nesting (several _begin() and _end() inside one another).
-Added new _end() function that optimizes the curve (reduces vertexes based on point distance).
-Added anti-aliasing functions.
Description: These are functions for drawing curves. Both Bezier and splines. These functions allow drawing them with specific widths, with alpha and color blending, as well as getting points on the curve.
Functions:
Code: (C++) [Select]
void draw_bezier_quadratic(float x1,float y1,float x2,float y2,float x3,float y3);
void draw_bezier_cubic(float x1,float y1,float x2,float y2,float x3,float y3, float x4, float y4);
void draw_set_curve_color(int c1, int c2);
void draw_set_curve_alpha(float a1, float a2);
void draw_set_curve_mode(int mode);
void draw_set_curve_detail(int detail);
void draw_set_curve_width(int width);
void draw_set_antialiasing(bool enable, int qual);
float draw_bezier_quadratic_x(float x1,float y1,float x2,float y2,float x3,float y3, float t);
float draw_bezier_quadratic_y(float x1,float y1,float x2,float y2,float x3,float y3, float t);
float draw_bezier_cubic_x(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float t);
float draw_bezier_cubic_y(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float t);
void draw_spline_part(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, int c1, int c2, float a1, float a2);
void draw_spline2c(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
void draw_spline3(float x1, float y1, float x2, float y2, float x3, float y3);
void draw_spline3c(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float x5, float y5);
void draw_spline4(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
void draw_spline4c(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float x5, float y5, float x6, float y6);
void draw_spline_begin(int mode);
int draw_spline_vertex(float x, float y);
int draw_spline_vertex_color(float x, float y, int col, float alpha);
void draw_spline_end();
int draw_spline_optimized_end();
Most functions are self explanatory (if not, then the example shows most of them at work). Only things I should note is about draw_spline_part, which is not actually meant to be used. It is used in other spline functions and that is the one that actually draws the spline. You can use it separately if you wish, thou then you need to call glBegin and glEnd, because that function only returns vertexes.Another function I should note is draw_spline2c, it draws a line between two points, but accounts for two control points that shape the actual line. The rest of the spline drawing functions that have c at the end act the same. The first and the last points are control points.
draw_spline_begin() function needs at least 4 points to draw one line. The first and the last point is a control point.
draw_spline_optimized_end() function should be used in some cases like when there are a lot of points and many of them can be close together. This function checks the distance of the two points and then reduces the vertex count as needed. The maximum vertex count is still pr_curve_detail (set by draw_set_curve_detail()). This function returns the vertex number drawn.
Download: GMK and .h/.cpp files can be downloaded from attachments. Exe version of the example (just to check it out or if it doesn't work for you) can be downloaded here: http://www.host-a.net/u/harrikiri/curvesexample.zip.
Installation: As Enigma doesn't have an easy 2 click extension mechanism now (or will never have?!?), you need to put these files in manually. Copy GScurves.h and GScurves.cpp into Enigma\ENIGMAsystem\SHELL\Graphics_Systems\OpenGL (preferably). Then open: Enigma\ENIGMAsystem\SHELL\SHELLmain.cpp and put #include "Graphics_Systems/OpenGL/GScurves.h" into line 63 or so (after #if ENIGMA_GS_OPENGL). Then either use bash script located in Enigma\ENIGMAsystem\SHELL\Developer\automake.sh, or if you are on Windows (like me), then just open Enigma\ENIGMAsystem\SHELL\Graphics_Systems\OpenGL\Makefile and add:
Quote
.eobjs_$(MODE)/GScurves.o: GScurves.cpp OpenGLHeaders.hTo somewhere in the top. And: ".eobjs_Run/GScurves.o" everywhere at the bottom (just look where similar action is done.
g++ -c GScurves.cpp -o .eobjs_$(MODE)/GScurves.o $(FLAGS)
Notice: You need to actually do additional things to run the example or use this code as intended. First, you need to fix merge_color function which is buggy in the current repo. To fix this, find and open GScolors.cpp, find merge_color function and replace the code with this:
Code: [Select]
int merge_color(int c1,int c2,double amount)
{
amount = amount > 1 ? 1 : (amount < 0 ? 0 : amount);
return
(unsigned char)(fabs(__GETR(c1)+(__GETR(c2)-__GETR(c1))*amount))
| (unsigned char)(fabs(__GETG(c1)+(__GETG(c2)-__GETG(c1))*amount))<<8
| (unsigned char)(fabs(__GETB(c1)+(__GETB(c2)-__GETB(c1))*amount))<<16;
}
Second, you need to add a new math function, which I didn't just insert as a script for some reason. Its lerp (linear interpolation) and seemed useful as a standard function. Open mathnc.cpp and put this somewhere:Code: [Select]
double lerp(double x, double y, double a) { return x + ((y-x)*a); }
Also, open mathnc.h and add the header:Code: [Select]
double lerp(double x, double y, double a);
I think this should be all. Maybe I have forgotten something, so if you get an error post it here.Example controls: You can scroll through rooms with left and right arrows. In the third room (where there is initially just a black screen) you can draw a curve with your mouse. Left click to add a point, or hold right button to add a lot of points. In the last room you can move that jelly thing to your mouse with left click and increase/decrease detail with up and down arrows. Room system seems buggy, so I couldn't find a way to return back to previous rooms. Its just restarts from the first room when you press left arrow. Press number keys to disable, enable and change quality of anti-aliasing. 1-Disabled. 2-Enabled, fastest. 3-Enabled, nicest. 4-Enabled, don't care.
To-Do:
-Add new functions to get points on splines
Thanks to LSnK for inspiring me to make this for Enigma, as well as making that beautiful example (which modified code is used in this example too).
1758
Issues Help Desk / Re: Can't draw anything inside _begin _end
« on: December 01, 2010, 03:05:36 pm »
Also, when you make _end functions actually draw the primitive you can have things like "draw_add_vertex" inside, for example, a mouse click event and then just draw with _end in the draw event. So this allows adding points without using any arrays. I also thought that would increase speed, as every add_vertex function assigns arrays its values and increments, but my test showed that fps gain is minimal, or none at all.
Also, its allows drawing with _end, then have some d3d transform function in the middle, and draw again with _end thus making some interesting effects. GM allows this, as GM also draws only in _end.
Also, room_goto() doesn't work. I will test it some more and if its really not my fault, then I will post a ticket.
Also, its allows drawing with _end, then have some d3d transform function in the middle, and draw again with _end thus making some interesting effects. GM allows this, as GM also draws only in _end.
Also, room_goto() doesn't work. I will test it some more and if its really not my fault, then I will post a ticket.
1759
Issues Help Desk / Re: Can't draw anything inside _begin _end
« on: November 30, 2010, 05:45:44 pm »Quote
Indeed, I chose not to use a custom vertex buffer to render primitives, and nested glBegin()s are invalid. I am unsure why you would be drawing a circle inside your primitive calls in the first place, but if you can make a case for it I'd be happy to use a dynamic array for a custom VBO (another 1980 GL spec that Intel refuses to support).Well I had code like this:
Code: [Select]
draw_spline_begin(pr_linestrip);
for (int i=0; i<points; i++){
draw_spline_add_point_color(ar[i,0],ar[i,1],ar[i,2],ar[i,3]);
draw_circle(ar[i,0],ar[i,1],5,1);
}
draw_spline_add_point(ar[points-1,0],ar[points-1,1]);
draw_spline_end();
So I draw a point and also draw a circle at that same point. I can, of course, make two "for cycles" for this, but that would be slower. Maybe not in this case (where point number is like 512 max), but in other cases where you draw more stuff together. Either way, how would dynamic arrays work? Is it the same as in the link I posted? Where you just create new array every time you need more space?
1760
Issues Help Desk / Can't draw anything inside _begin _end
« on: November 30, 2010, 02:02:19 pm »
While testing my curve functions I innially could not get why my curves drawed normally some times, but not others. I found out that a draw_circle was to blame, which I used to mark the points. When I start drawing a spline with draw_spline_begin() it just does:
Also, if I have to save points + colors + alphas in an array, then should I use something like this:
http://www.fredosaurus.com/notes-cpp/newdelete/50dynamalloc.html
or just:
float pr_point_ar[MAXPOINTS][4];
MAXPOINTS could be changed, or just be a large number by default.
I don't want to do that dynamic deleting and allocation because I would need to do this for every point... Or I could alloc, for example, 64 points at a time, and when I run out I alloc another 64. This wouldn't waste much memory and should be faster, but then again its another if cycle.
Also, I guess I should post these as tickets in the tracker, but I might as well put it here:
draw_merge doesn't work. I wasted about 40min trying to figure out why I can't blend my curve smoothly, and it ends up that the function doesn't return the right values. For example, merge_color(c_red,c_white,1), will return c_red even thou it needs to return c_white. Either way, this is how I fixed it:
Also, draw_get_color() (or anything draw_get for that matter) returns nan all the time.. I have this code:
edit: Anyway, as you can see this post started as a question, but by the second paragraph I realized how to fix this myself (by drawing in _end), so the first part can be ignored I guess.
Code: [Select]
glPushAttrib(GL_CURRENT_BIT);
glBegin(mode);
And when I draw a circle or any other shape in between it will get points on that circle, and thus mess up my curve. This is exactly the same problem with the already implemented draw_primitive functions. Try something like this and see for yourself:Code: [Select]
draw_primitive_begin(pr_linestrip);
draw_vertex(10,10);
draw_vertex(100,50);
draw_circle(500,300,5,1);
draw_vertex(50,300);
draw_primitive_end();
In GM it does allow things like this. The way it does this is that the _end function is the one that draws it. So I guess this is how I need to do it too? I already save points in an array, so I guess its not a problem, but still. There is some DEPTHBUFFER code already done in primitive functions and in thous it does save points as well. So drawing it in _end would be the best bet I guess.Also, if I have to save points + colors + alphas in an array, then should I use something like this:
http://www.fredosaurus.com/notes-cpp/newdelete/50dynamalloc.html
or just:
float pr_point_ar[MAXPOINTS][4];
MAXPOINTS could be changed, or just be a large number by default.
I don't want to do that dynamic deleting and allocation because I would need to do this for every point... Or I could alloc, for example, 64 points at a time, and when I run out I alloc another 64. This wouldn't waste much memory and should be faster, but then again its another if cycle.
Also, I guess I should post these as tickets in the tracker, but I might as well put it here:
draw_merge doesn't work. I wasted about 40min trying to figure out why I can't blend my curve smoothly, and it ends up that the function doesn't return the right values. For example, merge_color(c_red,c_white,1), will return c_red even thou it needs to return c_white. Either way, this is how I fixed it:
Code: [Select]
int merge_color(int c1,int c2,double amount)
{
amount = amount > 1 ? 1 : (amount < 0 ? 0 : amount);
return
(unsigned char)(fabs(__GETR(c1)+(__GETR(c2)-__GETR(c1))*amount))
| (unsigned char)(fabs(__GETG(c1)+(__GETG(c2)-__GETG(c1))*amount))<<8
| (unsigned char)(fabs(__GETB(c1)+(__GETB(c2)-__GETB(c1))*amount))<<16;
}
I think fabs can be removed somehow.Also, draw_get_color() (or anything draw_get for that matter) returns nan all the time.. I have this code:
Code: [Select]
pr_point_ar[i][2] = (pr_curve_color1 == -1 ? draw_get_color() : merge_color(pr_curve_color1,pr_curve_color2,1/(pr_spline_points+1)))
And it will return nan if pr_curve_color1 is -1 (so its calling merge_color). I just tested std::cout << merge_color(col1,col2,1) and got the same result. Couldn't find the reason thou... I looked in GScolors.cpp and everything seems fine.edit: Anyway, as you can see this post started as a question, but by the second paragraph I realized how to fix this myself (by drawing in _end), so the first part can be ignored I guess.
1761
Issues Help Desk / Re: extern double returns 0
« on: November 27, 2010, 03:00:52 pm »
Thanks. I have create splines, but I think I use some very bad method. But that was the only method I could easily grasp. Thou that method allows making a spline with infinite points, so that's nice. Now I am thinking of some method to allow user to pass thous points. I can't use ds_lists as LSnK does (the creator of curves extension), because they are not implemented yet (at least I think so). I could use _begin, _add_point(x,y), and _end thou. So I am trying to do so.
1762
Issues Help Desk / Re: extern double returns 0
« on: November 25, 2010, 10:02:01 am »
Yes, I am aware that it is not the same. But it works for my applications, thou I could just use a regular variable I guess.
Anyway, I am working on Bezier curves and slopes. Inspired by this:
http://gmc.yoyogames.com/index.php?showtopic=491339
He also had made a very great example to showcase the beauty.
Here is how it looks now in Enigma:
http://www.host-a.net/u/harrikiri/curvesexample.zip
I haven't created any spline functions, just Bezier. When I get a good grasp on how splines work I will implement thous too. When everything's ready I will release the code.
Also, the number in the corner is the segment number. More segments mean smoother line, but of course, slower drawing. You can increase/decrease them with up and down arrows on your keyboard. Click to move it to the mouse.
edit: And btw, restarting LGM did fix it. I haven't added any new modifications. I changed everything I mentioned.
Anyway, I am working on Bezier curves and slopes. Inspired by this:
http://gmc.yoyogames.com/index.php?showtopic=491339
He also had made a very great example to showcase the beauty.
Here is how it looks now in Enigma:
http://www.host-a.net/u/harrikiri/curvesexample.zip
I haven't created any spline functions, just Bezier. When I get a good grasp on how splines work I will implement thous too. When everything's ready I will release the code.
Also, the number in the corner is the segment number. More segments mean smoother line, but of course, slower drawing. You can increase/decrease them with up and down arrows on your keyboard. Click to move it to the mouse.
edit: And btw, restarting LGM did fix it. I haven't added any new modifications. I changed everything I mentioned.
1763
Issues Help Desk / extern double returns 0
« on: November 25, 2010, 08:23:13 am »
Solved: No need to read this unless you're bored.
I am playing with some curves (sounds dirty doesn't it?) and I have a problem almost totally unrelated to that. For some eye candy I usually use cos/sin and current_time to get oscillation. I used current_time and it always returned 0, then I found out that actually current_time is not defined anywhere (and Enigma doesn't report non existing variables, they just assume 0, and that is bad (people don't suggest to use "Threat undefined variables as 0" for a reason)). Anyway, I went to implement it myself thinking it is easy. Found key_game_globals.h, and uncommented "extern double current_time;". Then went into WINDOWSmain.cpp and modified a small part to this:
I also uncommented the line in GAME_GLOBALS.h to "double current_time;".
edit: I did everything right. Just didn't occur to me to restart LGM (I know I need to do this when I update header files, but not when I update .cpp files).
I am playing with some curves (sounds dirty doesn't it?) and I have a problem almost totally unrelated to that. For some eye candy I usually use cos/sin and current_time to get oscillation. I used current_time and it always returned 0, then I found out that actually current_time is not defined anywhere (and Enigma doesn't report non existing variables, they just assume 0, and that is bad (people don't suggest to use "Threat undefined variables as 0" for a reason)). Anyway, I went to implement it myself thinking it is easy. Found key_game_globals.h, and uncommented "extern double current_time;". Then went into WINDOWSmain.cpp and modified a small part to this:
Code: [Select]
extern double fps, current_time;
namespace enigma {
clock_t lc;
void sleep_for_framerate(int rs)
{
clock_t nc = clock();
int sdur = 1000/rs - 1 - (nc - lc)*1000 / CLOCKS_PER_SEC;
if (sdur > 0)
{
Sleep(sdur);
fps = room_speed;
}
else
{
fps = CLOCKS_PER_SEC / (nc - lc);
if(fps > room_speed){ fps = room_speed; }
}
lc = nc;
current_time = clock() / double(CLOCKS_PER_SEC) * 1000;
}
}
So now current_time holds ms till the program launched. In GM it actually holds the number of ms the system has started, but whatever. Now whenever I use "extern double current_time;" in .cpp I can get that number and it works great. But the problem is that when I use string(current_time) in Enigma it just still returns 0. Did I miss a place to put it?I also uncommented the line in GAME_GLOBALS.h to "double current_time;".
edit: I did everything right. Just didn't occur to me to restart LGM (I know I need to do this when I update header files, but not when I update .cpp files).
1764
Sound and Music / Re: Audio Sequencing (midi alternatives)
« on: November 20, 2010, 04:33:02 pm »so many fucking acronyms.....Yeah. Thats the reason I don't reply 80% of the time.
1765
General ENIGMA / Re: The Life of a Games Progammer (GM dev blog)
« on: November 16, 2010, 03:13:46 am »
Ok. I knew that Sturcts could be possible, but as I never used them I didn't know.
Quote
1) Yes, I was thinking about how it could be applied, but then I realized that doing so would completely alienate a useful function: GL_WRAP based tiling. Honestly, I'm not entirely positive how to justify a check for texbordx and y (As you mentioned) against 1 just to determine if tiling is possible... I've been giving it some thought, but I'm not yet confident enough to just go through with it.And where exactly we use GL_WRAP? That worked only with power of two textures anyways, and that's the reason why our tiling functions use for loops and quads. The pluses for this I think are many. In Mikes example they could reduce texture size from 28 512x512 to 17 512x512. For bigger games that would be a much larger gain. If we want to launch Enigma games on mobile devices, then this, sadly, is a must.
1766
General ENIGMA / The Life of a Games Progammer (GM dev blog)
« on: November 15, 2010, 04:34:25 pm »
I don't know how many of you are aware of this blog, but I have been following it for quite a while now. Link is http://dailly.blogspot.com/. Its the blog for GM's programmer that YYG hired to write runner in C++ and port GM to other platforms. There is some interesting technical details, even thou they are not that complicated (as they are meant for the layman I suppose). And there he writes about many aspect GM and in turn Enigma has either implemented, it is going to implement, or should implement.
1) First things first - Texture packing. I am aware that Josh is using some rectangle packing algorithm (or he is developing his own) for fonts. What Enigma should also do would be packing as many sprites/backgrounds inside one texture as well. Mike (that's the name of that guy) posted on how GM now uses that to launch on devices with limited GPU speed and memory. Pluses for this are quite obvious - there would be a lot less texture switching, and the amount of memory used would also decrease substantially. Enigma already uses spr2d->texbordx and spr2d->texbordy to get the point where sprite has its width and height and so the rest of the texture is not needed. With texture packing there wouldn't be that much things to add, except spr2d->texbord_left and spr2d->texbord_top or something similar. Then the drawing functions could be changed easily to accommodate that. Like setting every texture size to 512x512 (something every GPU, even mobile device should support), and then packing as many images in that 512x512 as possible.
2) Next he speaks about many aspect of GM and how it could be improved by using types (Enigma already supports thous), structs (Enigma doesn't supports them for now, or ever or I am wrong) and some other stuff. From previous posts I get that he would want to implement them, but they don't plan to do that for now (because Mark wants his tool to still be very easy). Thou he showed that it wouldn't change anything in GML (just like in Enigma), so if you don't want to use types, then don't and it automatically uses doubles, but if you really know what you are doing then you can easily declare an int.
Anyway, there are more things. I don't think that we should denigrate (is that the word?) that guy because he works in the Evil YYG. There are many things we can learn about GM future development, and in turn, it could affect our development as well.
1) First things first - Texture packing. I am aware that Josh is using some rectangle packing algorithm (or he is developing his own) for fonts. What Enigma should also do would be packing as many sprites/backgrounds inside one texture as well. Mike (that's the name of that guy) posted on how GM now uses that to launch on devices with limited GPU speed and memory. Pluses for this are quite obvious - there would be a lot less texture switching, and the amount of memory used would also decrease substantially. Enigma already uses spr2d->texbordx and spr2d->texbordy to get the point where sprite has its width and height and so the rest of the texture is not needed. With texture packing there wouldn't be that much things to add, except spr2d->texbord_left and spr2d->texbord_top or something similar. Then the drawing functions could be changed easily to accommodate that. Like setting every texture size to 512x512 (something every GPU, even mobile device should support), and then packing as many images in that 512x512 as possible.
2) Next he speaks about many aspect of GM and how it could be improved by using types (Enigma already supports thous), structs (Enigma doesn't supports them for now, or ever or I am wrong) and some other stuff. From previous posts I get that he would want to implement them, but they don't plan to do that for now (because Mark wants his tool to still be very easy). Thou he showed that it wouldn't change anything in GML (just like in Enigma), so if you don't want to use types, then don't and it automatically uses doubles, but if you really know what you are doing then you can easily declare an int.
Anyway, there are more things. I don't think that we should denigrate (is that the word?) that guy because he works in the Evil YYG. There are many things we can learn about GM future development, and in turn, it could affect our development as well.
1767
Graphics and Video / Re: ENIGMA examples - Games
« on: November 14, 2010, 03:34:23 pm »
Glad to hear its so close.
I too don't think you can make argument type resolution, as script arguments in GM can not only be a number or a string, but it can be both (in one place you add a number, the next place that argument is a string, and the script is made to account for that). I don't usually code like that, so argument type resolution would work in my case, but I am not sure if that actually makes any difference in speed. And yes, I am sure what I said didn't make much sense.
I am aware of Design Mode. I am actually here for a while now. I am registered in April 2008. I remember some screens of it a while back.
And yes, I now tried adding draw_primitive_set_line_width before _begin and it works. I was 150% sure that I did try that before thou... weird.
And how tha hell you got that sweet division in your post.
edit: Found it.
I too don't think you can make argument type resolution, as script arguments in GM can not only be a number or a string, but it can be both (in one place you add a number, the next place that argument is a string, and the script is made to account for that). I don't usually code like that, so argument type resolution would work in my case, but I am not sure if that actually makes any difference in speed. And yes, I am sure what I said didn't make much sense.
I am aware of Design Mode. I am actually here for a while now. I am registered in April 2008. I remember some screens of it a while back.
And yes, I now tried adding draw_primitive_set_line_width before _begin and it works. I was 150% sure that I did try that before thou... weird.
And how tha hell you got that sweet division in your post.
edit: Found it.
1768
Graphics and Video / Re: ENIGMA examples - Games
« on: November 14, 2010, 11:12:37 am »
Here is another grid test people can test their speed on. This uses primitives, which I think is the fastest way to draw the grid. With sprites I had min 17, max 22 fps, with lines min 29, max 40 and with primitive I had min 34 and max 55fps. Now the objects are the bottleneck, because of the calculations I put them trough the fps drops to 52-55 even when no grid is drawn. And these numbers are actually very good, compared to GM which didn't exceed 1-2fps in any of these tests. It even had only 5-6fps when the grid wasn't drawing.
I did fail to change the line width. I know that glLineWidth(width); should work, but I tried it in different contexts (in the begin function, in end function and in the add_vertex function, as well as making it a separate function altogether (draw_primitive_set_line_width()) and it didn't work.
Anyway, I am ready and willing to add some new things to Enigma. I know that development takes time and all, but I really like rushing the more the better. Like it took me 1 evening to add all draw_background functions and another for all draw_text functions (thou they needed to be optimized, which also took another evening). So I believe that we could replicate GM's functionality in very short amount of time. I am not sure about the internals, but I believe most of the hard things are already done. And I am willing to create functions for the mechanisms already in place. For example, if I could get all of the point data for paths I could be able to make most, if not all, path functions.
I did fail to change the line width. I know that glLineWidth(width); should work, but I tried it in different contexts (in the begin function, in end function and in the add_vertex function, as well as making it a separate function altogether (draw_primitive_set_line_width()) and it didn't work.
Anyway, I am ready and willing to add some new things to Enigma. I know that development takes time and all, but I really like rushing the more the better. Like it took me 1 evening to add all draw_background functions and another for all draw_text functions (thou they needed to be optimized, which also took another evening). So I believe that we could replicate GM's functionality in very short amount of time. I am not sure about the internals, but I believe most of the hard things are already done. And I am willing to create functions for the mechanisms already in place. For example, if I could get all of the point data for paths I could be able to make most, if not all, path functions.
1769
Graphics and Video / Re: ENIGMA examples - Games
« on: November 13, 2010, 05:45:05 am »Quote
I can't think of any reason "if (nx*nx+ny*ny<radius*radius){" would behave that way. If you like, you can look at IDE_EDIT_objectfunctionality.h and find how the faulty code is exported. If you see something wrong with it, tell me and I'll probably be able to diagnose the problem.I checked and it parses at that point correctly. The problem was with with() statement and arguments. The beginning of the code looked like this:
Code: [Select]
with (obj_controller){
int i,c, radius, xx, yy, nx, ny, dir,col, nid;
xx=argument0;
yy=argument1;
radius=argument2;
And it parsed like this:Code: [Select]
with(obj_controller)
{
int i, c, radius, xx, yy, nx, ny, dir, col, nid;
xx = enigma::varaccess_argument0(int(self));
yy = enigma::varaccess_argument1(int(self));
radius = enigma::varaccess_argument2(int(self));
As you can see it tries to get variables argument0, argument1 and 2 from obj_controller. As those variables don't exist it returns 0 for some reason (even thou it should return an error no?).When I change it to this:
Code: [Select]
int i,c, radius, xx, yy, nx, ny, dir,col, nid;
xx=argument0;
yy=argument1;
radius=argument2;
with (obj_controller){
It parses correctly.So basically, arguments don't work inside with() statements. Also other.argument0 doesn't work either, it also returns 0.
edit: Also, a script is generated for all objects that uses it? Isn't that more bad than just creating one and making all objects use it?
1770
Graphics and Video / Re: ENIGMA examples - Games
« on: November 11, 2010, 10:46:48 am »
I did a little test with grids to compare speeds. With 8x8 grid the game in GM runs with 1-2fps, but the same example in Enigma runs with 16fps. Now when I just change "var" with "int" everywhere, then its goes up to 22fps. The biggest bottleneck is to draw a transformed sprite (which is the line connecting points). Don't know if those could get faster, but it would be better to use primitives or something of the like to draw the grid anyway. I added the examples as attachments. There is one thing I noticed thou. Something didn't work right with scripts. I made a script scr_grid_add_wave to move the grid nodes. In GM it works fine, but in Enigma this part "if (nx*nx+ny*ny<radius*radius){" is always "if (0<0){" for some reason, and so it doesn't work. When I copied the script code to the step even and just changed arguments with their values then it works fine. Something to look into..
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 »