Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (753)
Games in Android Showcase (228)
games submitted by our members
Games in WIP (842)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Performance Tuning / Re: Better way of doing this? on: 2009-03-07 18:03:06
You won't get much more efficient without actually compiling GML to bytecode, but I must say that I find the type system absolutely horrible. "Hello, World" + 1 = 1?!
Actually "Hello, World" + 1 = "Hello, World1"
As it uses the string add function.

Yeah I suppose it is horrible but I can't think of a better way of doing things Undecided.
2  Game Development / Performance Tuning / Better way of doing this? on: 2009-03-07 17:00:29
This is quite a strange project but I will try to explain it. It takes code from an application called game maker ( and converts that code to java.
In the game maker language (gml) you don't need to declare variables, you just use them, and you can use a variable that is not defined yet from another 'object'. Also variables can be either double or string and it can change from one to the other.
The current system works but since I am just a hobby programmer I don't have very much experience so there could be a faster way to do it. Speed is important because its the backend of all the games. Its already faster than gm but i still would like to know if it can be any faster.

here is an example how the current system will convert gml:
{self.setVariable("s",self.getVariable("s") .add((Game.getValueOf(1))));}

It uses a hashtable to store all the variable names with their values:
public void setVariable(java.lang.String name, Variable value) {
        variables.put(name, value);

     * Gets the value of the variable with string name.
    public Variable getVariable(java.lang.String name) {
        Variable o = (Variable) variables.get(name.toString());
        if (o == null) {
            o=new Integer(0);
            variables.put(name.toString(),o );
            return o;
        return o;

Code for Game.getValueOf():
public static Variable getValueOf(int i){
        if (NUMBER_VARIABLE !=null){
        return NUMBER_VARIABLE;
        else {
            NUMBER_VARIABLE=new Integer(i);
        integers.put(i, NUMBER_VARIABLE);
        return NUMBER_VARIABLE;

It also uses a hashtable to store all numbers that will be used, to save memory rather than doing new Integer() every time.

Heres some more source files if you need to see them:

Thats basically the system, it uses hashtables and Variable objects to get and set variables. is their a more efficient way of doing this.

I appreciate any help Smiley
Pages: [1]
ivj94 (582 views)
2018-03-24 14:47:39

ivj94 (46 views)
2018-03-24 14:46:31

ivj94 (374 views)
2018-03-24 14:43:53

Solater (61 views)
2018-03-17 05:04:08

nelsongames (108 views)
2018-03-05 17:56:34

Gornova (150 views)
2018-03-02 22:15:33

buddyBro (691 views)
2018-02-28 16:59:18

buddyBro (91 views)
2018-02-28 16:45:17

xxMrPHDxx (493 views)
2017-12-31 17:17:51

xxMrPHDxx (730 views)
2017-12-31 17:15:51
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!