Pages: « 1 2 3 4 5 6 7 »
  Print  
Author Topic: In need of a Sonic fangame engine for Enigma  (Read 22830 times)
Offline (Male) Goombert
Reply #30 Posted on: October 23, 2014, 08:02:03 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
I haven't looked at the example, does it happen to use inheritance? We've had issues with script locals for a while, I am not sure what could have changed off hand.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) polygone
Reply #31 Posted on: October 23, 2014, 11:16:22 AM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
Ohh I presume it's because of a parser change then.

It's called like this:
Code: [Select]
with (Player)
{
  collision_onset(other.id);  //other.id being the id of the collectable like a ring or box or whatever
}

Code: [Select]
// collision_onset
// Checks if there is going to be a collision with the object giving in argument0 given the Player's current speed
// To be accurate it does this using a place_meeting check at the position the Player will be at given it's hspeed / vspeed
// And also using two collision lines either side of the player mask from the Player's current position to the position it
// will be at given it's hspeed / vspeed

var x1, y1, x2, y2;

x1 = x + cos(full_direction+pi/2)*mask_radius; y1 = y - sin(full_direction+pi/2)*mask_radius;
x2 = x + cos(full_direction-pi/2)*mask_radius; y2 = y - sin(full_direction-pi/2)*mask_radius;

return (place_meeting(x + full_hspeed, y + full_vspeed, other.id)
        || collision_line(x1, y1, x1 + full_hspeed, y1 + full_vspeed, argument0, false, true) != noone
        || collision_line(x2, y2, x2 + full_hspeed, y2 + full_vspeed, argument0, false, true) != noone)
So the script is using local variables for Player; ie full_direction,  full_hspeed, full_vspeed

The parser is notorious for breaking with things like this.
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Male) Goombert
Reply #32 Posted on: October 23, 2014, 03:23:30 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Looks like the issue is with the with() construct. Polygone, can you explain exactly why we don't have working locals in scripts? I am not too informed on the matter, but I've been aware of its existence.
« Last Edit: October 23, 2014, 09:52:24 PM by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) polygone
Reply #33 Posted on: October 24, 2014, 07:22:37 AM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
Looks like the issue is with the with() construct. Polygone, can you explain exactly why we don't have working locals in scripts? I am not too informed on the matter, but I've been aware of its existence.
Cause Josh do wrong? <_<
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Male) HitCoder
Reply #34 Posted on: October 24, 2014, 03:41:22 PM

Member
Location: Oxford, England
Joined: Aug 2014
Posts: 153

View Profile WWW Email
I've done a temporary workaround for while a solution is found, or enigma is fixed, but anyway, why does sonic go at a different speed on hitting a spring depending on his current speed - I mean, the harder he hits a spring, the faster he goes or whatever? How can I fix this?
Logged
Computer Scientist, Programmer in C#, C/C++, Java, Python, GML, EDL, and more. Hobbyist musicial.
DISCORD: HitCoder#4530
Offline (Male) polygone
Reply #35 Posted on: October 25, 2014, 08:58:18 AM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
I've done a temporary workaround for while a solution is found, or enigma is fixed, but anyway, why does sonic go at a different speed on hitting a spring depending on his current speed - I mean, the harder he hits a spring, the faster he goes or whatever? How can I fix this?
This also happens in classic Sonic games, perhaps not to the same degree though.

The code for the springs is in SpringParent begin step event:

Code: [Select]
        // Get the hspeed and vspeed which the player will be set to (note this is dependent on the original player's speed)
        hspd_set = (abs(full_hspeed*other.bounce_factor) + other.strength)*other.dcos + (abs(full_vspeed)*other.dcos + full_hspeed*abs(other.dsin))*abs(other.dsin);
        vspd_set = (abs(full_vspeed*other.bounce_factor) + other.strength)*other.dsin + (abs(full_hspeed)*other.dsin - full_vspeed*abs(other.dcos))*abs(other.dsin);
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Male) HitCoder
Reply #36 Posted on: October 25, 2014, 09:34:21 AM

Member
Location: Oxford, England
Joined: Aug 2014
Posts: 153

View Profile WWW Email
Yea, I realise that code was there, but I don't remember it working quite like that on the classic games... I thought you could keep momentum on the axis the spring isn't bouncing you on.
Also, Polygone, is there a way to fix the 90-degree rotation snapping bug? It seems quite common in your engine...
I mean where you go up a slope, expecting to go into the air, but then it rotates you almost a whole 90 degrees and makes you snap to the floor. I know it's normal in some sonic engines, but it's not supposed to be there. Lol.
Logged
Computer Scientist, Programmer in C#, C/C++, Java, Python, GML, EDL, and more. Hobbyist musicial.
DISCORD: HitCoder#4530
Offline (Male) polygone
Reply #37 Posted on: October 25, 2014, 10:12:44 AM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
Yea, I realise that code was there, but I don't remember it working quite like that on the classic games... I thought you could keep momentum on the axis the spring isn't bouncing you on.
It does in my engine?

Code: [Select]
Also, Polygone, is there a way to fix the 90-degree rotation snapping bug? It seems quite common in your engine...Well it's technically a bug which of course could be fixed somehow but I'm not going to make any attempt to do so lol.
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Male) HitCoder
Reply #38 Posted on: October 25, 2014, 10:34:43 PM

Member
Location: Oxford, England
Joined: Aug 2014
Posts: 153

View Profile WWW Email
I accidentally deleted this post, refreshed the page, and thought it had double posted. Whoops.

Anyway, I've got it all fixed, I was just wondering if I could build an engine using your's as a base? I will give credit if you don't mind me making my own based on yours, but if you'd rather I didn't spin-off your engine, then that's fine. I was just wondering.

Also, when I said keep your momentum on the non-modified axis, your engine seems to cap the speed, but I cannot find a way around this :/
« Last Edit: October 25, 2014, 10:36:35 PM by HitCoder » Logged
Computer Scientist, Programmer in C#, C/C++, Java, Python, GML, EDL, and more. Hobbyist musicial.
DISCORD: HitCoder#4530
Offline (Male) polygone
Reply #39 Posted on: October 26, 2014, 06:26:14 AM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
You can do whatever you like with it, I developed the engine from another engine myself.

It's optional, but if you wish to then you can give credit to:
- Damizean & McdIzzY (for the original slope engine)
- Kain (for the boxes in his Sonic 3 engine)
- Flexaplex (for this engine).
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Male) HitCoder
Reply #40 Posted on: October 26, 2014, 09:22:20 AM

Member
Location: Oxford, England
Joined: Aug 2014
Posts: 153

View Profile WWW Email
Ok, thank you Polygone. I also think this thread can be closed now, but I won't just yet unless someone else has something to say. I think I might close it if it's inactive for around 2 weeks. Thank you all for your help. :)

~~HitCoder~~
Logged
Computer Scientist, Programmer in C#, C/C++, Java, Python, GML, EDL, and more. Hobbyist musicial.
DISCORD: HitCoder#4530
Offline (Male) HitCoder
Reply #41 Posted on: October 26, 2014, 04:31:00 PM

Member
Location: Oxford, England
Joined: Aug 2014
Posts: 153

View Profile WWW Email
I just saved a file in Enigma, but when I did, Enigma randomly closed. When I try to open the file, it says it's corrupted, so... fix bug please?
Logged
Computer Scientist, Programmer in C#, C/C++, Java, Python, GML, EDL, and more. Hobbyist musicial.
DISCORD: HitCoder#4530
Offline (Male) polygone
Reply #42 Posted on: October 26, 2014, 04:39:10 PM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
Well I've done some debugging on the issue with the local variables being called in scripts, the problem is actually the with statement scoping being messed up inside if statements.

My test, in obj_1:

Code: [Select]
with (obj_0)
{
scr_0();
}
In this case local variables in scr_0 are used from obj_0 as they should be.

Code: [Select]
with (obj_0)
{
if (scr_0()) {}
}
In this case local variables in scr_0 are used from obj_1 incorrectly.

Example file: https://app.box.com/s/n0p8ccr75hticpcs545r
« Last Edit: October 26, 2014, 04:41:49 PM by polygone » Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Unknown gender) TheExDeus
Reply #43 Posted on: October 26, 2014, 04:41:16 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
You could of checked the generated .cpp files and probably see that. Sorlok was the one who changed scoping recently. Maybe he can fix it.
Logged
Offline (Male) polygone
Reply #44 Posted on: October 27, 2014, 03:25:00 AM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
This is the cpp gen:

Code: [Select]
  {
    with((obj_0))
    {
      :: scr_0();
     
    }
   
  }
  ;

Code: [Select]
  {
    with((obj_0))
    {
      if((scr_0()))
      {
       
      }
   
    }
  }
  ;
   
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Pages: « 1 2 3 4 5 6 7 »
  Print