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.
16
Proposals / Obliterating "inst" from functions.
« on: February 27, 2011, 08:48:49 pm »
Instead of defining:
Good idea/bad idea?
enigma::inst_iter_planar seems a lot nicer.
Code: [Select]
enigma::object_planar* const inst = ((enigma::object_planar*)enigma::instance_event_iterator->inst);
or something similar in every instance-related function, there should be a pointer defined somewhere globally (or a macro if you insist) so that people don't have to define this everywhere, so that code is cleaner, and so that we can inline more stuff and make things generally faster.Good idea/bad idea?
enigma::inst_iter_planar seems a lot nicer.
17
Proposals / Avatar Size
« on: February 19, 2011, 01:08:48 pm »
I see no reason why it shouldn't be at least 96x96, or maybe even 128x128. For external avatars, at least. The tables can handle it. :V
18
Proposals / Static object variables
« on: January 26, 2011, 05:15:26 pm »
This is something that I think would be particularly useful. Opinions? Not sure if they'd use the member ( . ) operator or scope resolution ( :: ) like C++. Probably could be an option.
For those that are unfamiliar, static variables are variables that are accessed by a class, or object type, rather than a specific instance.
For those that are unfamiliar, static variables are variables that are accessed by a class, or object type, rather than a specific instance.
20
Function Peer Review / collision_point
« on: January 22, 2011, 09:00:14 pm »Code: [Select]
int collision_point(double x, double y, int obj, bool prec /*ignored*/, bool notme)
{
const enigma::object_collisions* r = collide_inst_point(obj,false,notme,x,y); //false is for solid_only, not prec
return r == NULL ? noone : r->id;
}
It's Ism's fault that this wasn't added.
21
Issues Help Desk / Combining members
« on: January 15, 2011, 04:46:52 pm »Code: [Select]
struct foo { int x; };
struct bar { int x; };
struct foobar : public foo, public bar {};
results in a class with the members foo::x and bar::x. However, foobar::x does not exist. Is there any way to do this?Example:
Code: [Select]
foobar val;
val.x = 5;
results in:Code: [Select]
error: request for member ‘x’ is ambiguous
error: candidates are: int bar::x
error: int foo::x
22
Proposals / Object member functons
« on: January 06, 2011, 07:50:50 pm »
It would be really cool if, somehow, ENIGMA would be able to do something like:
Basically, calling a function as a member function would merely mean applying it as a with() statement with only one line. And there might be optimisations for it, too, for example:
Granted, you could abuse this and do things like obj.draw_set_color(), but it's still a nicer syntax (and you can do that in with(), too). Obviously, with() would have to be used for ifs and loops, but for simple functions, writing it out this way just looks nicer.
I dunno how doable that this would be, but I think that it would be a really nice thing to have.
Code: [Select]
obj.instance_destroy();
instead of:Code: [Select]
with(obj)
{
instance_destroy();
}
Basically, calling a function as a member function would merely mean applying it as a with() statement with only one line. And there might be optimisations for it, too, for example:
Code: [Select]
obj.f1();
obj.f2();
would be parsed to:Code: [Select]
with (obj)
{
f1();
f2();
}
Granted, you could abuse this and do things like obj.draw_set_color(), but it's still a nicer syntax (and you can do that in with(), too). Obviously, with() would have to be used for ifs and loops, but for simple functions, writing it out this way just looks nicer.
I dunno how doable that this would be, but I think that it would be a really nice thing to have.
23
Function Peer Review / move_contact functions optimised for bbox
« on: December 31, 2010, 12:09:58 am »Code: [Select]
int move_contact(double direction, double max_distance, bool solid_only)
{
enigma::object_collisions* const inst1 = ((enigma::object_collisions*)enigma::instance_event_iterator->inst);
double max_x = lengthdir_x(direction, max_distance);
double max_y = lengthdir_y(direction, max_distance);
for (enigma::inst_iter *it = enigma::fetch_inst_iter_by_int(all); it != NULL; it = it->next)
{
const enigma::object_collisions* inst2 = (enigma::object_collisions*)it->inst;
if (inst2->id == inst1->id || solid_only && !inst2->solid) continue;
if (max_x > 0)
{
const double x1 = inst1->x + max_x, x2 = inst2->x + inst2->bbox_left;
if (x2 < x1)
{
max_x = x2 - inst1->x;
}
}
else if (max_x < 0)
{
const double x1 = inst1->x + max_x, x2 = inst2->x + inst2->bbox_right;
if (x2 > x1)
{
max_x = x2 - inst1->x;
}
}
if (max_y > 0)
{
const double y1 = inst1->y + max_y, y2 = inst2->y + inst2->bbox_top;
if (y2 < y1)
{
max_y = y2 - inst1->y;
}
}
else if (max_y < 0)
{
const double y1 = inst1->y + max_y, y2 = inst2->y + inst2->bbox_bottom;
if (y2 > y1)
{
max_y = y2 - inst1->y;
}
}
}
inst1->x += max_x;
inst1->y += max_y;
return 0;
}
inline int move_contact_solid(double direction, double speed) { return move_contact(direction, speed, true); }
inline int move_contact_all(double direction, double speed) { return move_contact(direction, speed, false); }
Haven't tested it yet, but this should work. Also am going under the assumption that objects don't collide when they share an edge.
24
Function Peer Review / distance_to_object
« on: December 20, 2010, 09:02:53 pm »Code: [Select]
#include <limits>
double distance_to_object_point(int object)
{
enigma::object_collisions* const inst1 = ((enigma::object_collisions*)enigma::instance_event_iterator->inst);
double distance = std::numeric_limits<double>::infinity();
double tempdist;
for (enigma::inst_iter *it = enigma::fetch_inst_iter_by_int(object); it != NULL; it = it->next)
{
const enigma::object_collisions* inst2 = (enigma::object_collisions*)it->inst;
if (inst1 == inst2) continue;
tempdist = point_distance(inst1->x, inst1->y, inst2->x, inst2->y);
if (tempdist < distance)
{
distance = tempdist;
}
}
return (distance == std::numeric_limits<double>::infinity() ? 0 : distance);
}
inline double dist_ranges(double left1, double right1, double left2, double right2)
{
double right = min(right1, right2), left = max(left1, left2);
return (left > right ? left - right : 0);
}
double distance_to_object_bbox(int object)
{
enigma::object_collisions* const inst1 = ((enigma::object_collisions*)enigma::instance_event_iterator->inst);
const double left1 = inst1->x + inst1->bbox_left, top1 = inst1->y + inst1->bbox_top,
right1 = inst1->x + inst1->bbox_right, bottom1 = inst1->y + inst1->bbox_bottom;
double distance = std::numeric_limits<double>::infinity();
double tempdist;
for (enigma::inst_iter *it = enigma::fetch_inst_iter_by_int(object); it != NULL; it = it->next)
{
const enigma::object_collisions* inst2 = (enigma::object_collisions*)it->inst;
if (inst1 == inst2) continue;
const double left2 = inst2->x + inst1->bbox_left, top2 = inst2->y + inst1->bbox_top,
right2 = inst2->x + inst1->bbox_right, bottom2 = inst2->y + inst1->bbox_bottom;
tempdist = hypot(dist_ranges(left1, right1, left2, right2),
dist_ranges(top1, bottom1, top2, bottom2));
if (tempdist < distance)
{
distance = tempdist;
}
}
return (distance == std::numeric_limits<double>::infinity() ? 0 : distance);
}
Tested and both work. I don't know which method that GM uses, but here's two different algorithms.
25
Function Peer Review / clamp()
« on: December 13, 2010, 04:15:09 pm »Code: [Select]
double clamp(double x, double lower, double upper) { return (x < lower ? lower : (x > upper ? upper : x)); }
Simple function that would be useful.
26
General ENIGMA / Cross-compiling
« on: December 10, 2010, 07:40:25 pm »
Would be a really neat feature to have.
But I don't see it as being possible currently.
Ideally, LGM would be able to specify a compile command (by default, g++) for the makefiles, as well as a list of default flags to the compilers (such as -m32 and -m64). This would enable me to do things like turning on the -m32 flag, or using i486-mingw32-g++ as the compile command so that I can cross-compile to Windows.
I also propose that -mtune=generic is added to the default flags, because it avoids runtime conflicts or something like that. I add that in my packages right now through sed, but it would be a good idea for default. Probably would be ignored under everything but Linux and Android, but MinGW should still support it.
But I don't see it as being possible currently.
Ideally, LGM would be able to specify a compile command (by default, g++) for the makefiles, as well as a list of default flags to the compilers (such as -m32 and -m64). This would enable me to do things like turning on the -m32 flag, or using i486-mingw32-g++ as the compile command so that I can cross-compile to Windows.
I also propose that -mtune=generic is added to the default flags, because it avoids runtime conflicts or something like that. I add that in my packages right now through sed, but it would be a good idea for default. Probably would be ignored under everything but Linux and Android, but MinGW should still support it.
27
Function Peer Review / NEEDED FUNCTION LIST
« on: December 05, 2010, 04:40:20 pm »
I was bored and made one.
I compared GM8's fnames file to the function, definition, and types list for ENIGMA. Here are the functions and definitions that need to be made:
http://dl.dropbox.com/u/6125077/enigma/needed-stuff.txt
I can imagine this being very useful for some people.
Note that not some things on this list might already be made. Inversely, there might be things that were inserted as placeholder functions (like show_message) and aren't on this list.
I compared GM8's fnames file to the function, definition, and types list for ENIGMA. Here are the functions and definitions that need to be made:
http://dl.dropbox.com/u/6125077/enigma/needed-stuff.txt
I can imagine this being very useful for some people.
Note that not some things on this list might already be made. Inversely, there might be things that were inserted as placeholder functions (like show_message) and aren't on this list.
28
General ENIGMA / variable_* Functions
« on: December 05, 2010, 03:29:29 pm »
This is one thing that I stumbled upon today. Like execute_string, these functions will be a bit tricky. And I happened to use one in a GM project, and they don't work in ENIGMA currently.
I'm not entirely sure how to go about doing these, but the best idea that I can think of is keeping an array of variable names from the parser and storing pointers during runtime. It would really decrease speed, though, and I think that it would be best to make this kind of system enable/disable-able. Nonetheless, these do happen to be relatively common functions that will have to be supported by ENIGMA.
Usually, code tends to be:
You also face the problem of:
Which would run into even more problems.
Code: [Select]
variable_global_exists(name)
variable_global_get(name)
variable_global_array_get(name,ind)
variable_global_array2_get(name,ind1,ind2)
variable_global_set(name,value)
variable_global_array_set(name,ind,value)
variable_global_array2_set(name,ind1,ind2,value)
variable_local_exists(name)
variable_local_get(name)
variable_local_array_get(name,ind)
variable_local_array2_get(name,ind1,ind2)
variable_local_set(name,value)
variable_local_array_set(name,ind,value)
variable_local_array2_set(name,ind1,ind2,value)
I'm not entirely sure how to go about doing these, but the best idea that I can think of is keeping an array of variable names from the parser and storing pointers during runtime. It would really decrease speed, though, and I think that it would be best to make this kind of system enable/disable-able. Nonetheless, these do happen to be relatively common functions that will have to be supported by ENIGMA.
Usually, code tends to be:
Code: [Select]
if (variable_global_exists('bob'))
{
bob = global.bob;
}
which would cause a compile error in C++.You also face the problem of:
Code: [Select]
bobvar = "bob"
if (variable_global_exists(bobvar))
{
bob = global.bob;
}
Which would run into even more problems.
29
General ENIGMA / Builds, Packages, Releases, etc.
« on: November 03, 2010, 08:44:37 pm »
OUTDATED
The contents/links of this page may be outdated. We have instead starting hosting our installation links and directions on the wiki: http://enigma-dev.org/docs/Wiki/Install
README
Note that ENIGMA is still in the beta stage and that not all systems are finished. This is not a topic to ask for things to be finished, nor is it for commenting on releases. It's merely a place to keep the releases in a nice place. All of the releases below are of the latest SVN revision, or close to it.
Windows
The latest windows version can be found here. Run ENIGMA.exe to install and run ENIGMA.
Mac OS X, iPhone, Android
These platforms don't currently have builds. You can try them out from the SVN. You can either use this command:
Linux
Currently, the only packages that have been built are for Ubuntu and Arch Linux. I'll eventually create one for Fedora, but for now, it's just those two.
Ubuntu
Note: If you get a file conflict error, try removing the old package before installing the new one.
To install ENIGMA, you need to add the ENIGMA repo to your list of repositories. To do this, navigate to System > Administration > Software Sources. You might have to edit the menu for it to show up; right click the menu and choose "edit menu" to do this.
There, navigate to the Other Software tab and add a repository with the following code:
Now, this should create two repositories - one for binaries and one for source; delete the source version, because it does not exist, and will create an error.
Note that I've labeled it as natty, but it will work for any version of Ubuntu. If you're still on the maverick version, it'll give you a 404 error.
If Ubuntu doesn't ask you to automatically update the package database, go to a terminal and run:
Then, you can install ENIGMA (enigma-dev-svn) via the software center, synaptic, or command-line with the following command:
If it asks to install even if the package isn't authenticated, say yes.
Arch Linux
To add the repository in Arch Linux, add the following to /etc/pacman.conf:
And run the following to update the database:
ENIGMA can be installed via command-line with:
Running ENIGMA
To launch ENIGMA, you can either run "enigma-dev" or "lateralgm" in a terminal or use the launcher in the Applications > Programming menu. Note that launching ENIGMA from the menu will create a terminal to display the output of LGM and the compiler. LGM will be associated with Game Maker files even if they don't have a file extension.
For people that want the package source, you can get it here:
http://dl.dropbox.com/u/6125077/enigma/enigma-dev-svn.src.tar.gz
I'm going to be running the build script every once in a while, so, don't expect a version for every commit. I also am not keeping old packages/releases for the sake of web space. If I do happen to forget to make a new package/release, let me know on the IRC or something.
The contents/links of this page may be outdated. We have instead starting hosting our installation links and directions on the wiki: http://enigma-dev.org/docs/Wiki/Install
README
Note that ENIGMA is still in the beta stage and that not all systems are finished. This is not a topic to ask for things to be finished, nor is it for commenting on releases. It's merely a place to keep the releases in a nice place. All of the releases below are of the latest SVN revision, or close to it.
Windows
The latest windows version can be found here. Run ENIGMA.exe to install and run ENIGMA.
Mac OS X, iPhone, Android
These platforms don't currently have builds. You can try them out from the SVN. You can either use this command:
Code: [Select]
svn co https://enigma-dev.svn.sourceforge.net/svnroot/enigma-dev enigma-dev
Or, alternatively, you can use another SVN client with https://enigma-dev.svn.sourceforge.net/svnroot/enigma-dev as a server.Linux
Currently, the only packages that have been built are for Ubuntu and Arch Linux. I'll eventually create one for Fedora, but for now, it's just those two.
Ubuntu
Note: If you get a file conflict error, try removing the old package before installing the new one.
To install ENIGMA, you need to add the ENIGMA repo to your list of repositories. To do this, navigate to System > Administration > Software Sources. You might have to edit the menu for it to show up; right click the menu and choose "edit menu" to do this.
There, navigate to the Other Software tab and add a repository with the following code:
Code: [Select]
deb http://dl.dropbox.com/u/6125077/enigma/repos/ubuntu natty main
Now, this should create two repositories - one for binaries and one for source; delete the source version, because it does not exist, and will create an error.
Note that I've labeled it as natty, but it will work for any version of Ubuntu. If you're still on the maverick version, it'll give you a 404 error.
If Ubuntu doesn't ask you to automatically update the package database, go to a terminal and run:
Code: [Select]
sudo apt-get update
Then, you can install ENIGMA (enigma-dev-svn) via the software center, synaptic, or command-line with the following command:
Code: [Select]
sudo apt-get install enigma-dev-svn
If it asks to install even if the package isn't authenticated, say yes.
Arch Linux
To add the repository in Arch Linux, add the following to /etc/pacman.conf:
Code: [Select]
[enigma]
Server = http://dl.dropbox.com/u/6125077/enigma/repos/arch-linux/$arch
And run the following to update the database:
Code: [Select]
sudo pacman -Sy
ENIGMA can be installed via command-line with:
Code: [Select]
sudo pacman -S enigma-dev-svn
Running ENIGMA
To launch ENIGMA, you can either run "enigma-dev" or "lateralgm" in a terminal or use the launcher in the Applications > Programming menu. Note that launching ENIGMA from the menu will create a terminal to display the output of LGM and the compiler. LGM will be associated with Game Maker files even if they don't have a file extension.
For people that want the package source, you can get it here:
http://dl.dropbox.com/u/6125077/enigma/enigma-dev-svn.src.tar.gz
I'm going to be running the build script every once in a while, so, don't expect a version for every commit. I also am not keeping old packages/releases for the sake of web space. If I do happen to forget to make a new package/release, let me know on the IRC or something.
30
General ENIGMA / DnD Functions
« on: October 30, 2010, 04:13:21 pm »
Not like anyone here uses DnD, but they might as well be done.
#define action_if(x) if(x)
#define action_while(x) while(x)
etc.
#define action_if(x) if(x)
#define action_while(x) while(x)
etc.