BreakDown`
|
|
Posted on: August 02, 2014, 10:03:40 am |
|
|
Location: France Joined: Aug 2014
Posts: 10
|
Hi ! First I'm BreakDown`, I'm from France so sorry if my english sucks some time... I discovered Enigma since some weeks and wanna try to use it with my current project, a space simulation based on a giant economic system (I will present this project later in a post). Well, I've a strange bug when I've imported my project from GM8 into Enigma. When I use the functions image_angle & view_angle, a grid appears in game and the sprite is distorted. _____________________________________________________________ How does it work ?I told the game when the "Arrow Left" is pressed to : - Substract a rotation of the sprite (image_angle) of -3° (negative for left) - start Alarm[0] and set it to 10. In the Alarm[0] Event (so when it comes to 0) : - Substract a rotation of the sprite of -3° - set Alarm[0] to 10. Also in the Step Event I've two things : - view_angle = image_angle (to prevent a gap between sprite and view and rotate automatically the view when sprite is rotating) - If "Left Arrow" is released, set Alarm[0] to 0 (to stop the rotation event). So what's going on ?Here is the initial situation when the room starts : http://img15.hostingpics.net/pics/194745512.jpgHere is when I press the "Left Arrow" key : http://img15.hostingpics.net/pics/496345531.jpgAnd now a preview in GM8 : http://img15.hostingpics.net/pics/287401803.jpgThe "0" (who draws the vspeed variable) doesn't follow the sprite specially to see the sprite rotation_____________________________________________________________ It's my first use of Enigma engine, so maybe I made something wrong, but please tell me. See ya, BreakDown`
|
|
« Last Edit: August 02, 2014, 10:17:43 am by BreakDown` »
|
Logged
|
“ Music is moonlight in the gloomy night of life. ” - Jean Paul Richter
|
|
|
Josh @ Dreamland
|
|
Reply #1 Posted on: August 02, 2014, 10:18:41 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
The grid you are seeing is caused by gaps in the tiled background. The graphics card should not be doing that; those polygons share coordinates, so even if the pixels didn't belong to one tile, they should belong to the next...
The skewing you see instead of rotation, however, is entirely our fault. I'll look into why that's happening.
Does the third screenshot show us what happens in GM8 when you press left? I.e, does the sprite rotate to remain upright while the world rotates around it?
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
BreakDown`
|
|
Reply #2 Posted on: August 02, 2014, 10:29:00 am |
|
|
Location: France Joined: Aug 2014
Posts: 10
|
Hi Josh. So if I understand, it isn't possible to do it from this way ?
Yep like I wrote, it's what I see when I launch my game in GM8, this method works pretty good... But not in Enigma :/ It's the opposite in my script : the spaceship rotates and the view follow the spaceship's rotation. Maybe I should try the opposite like you said ?
Thanks for your quick reply, I appreciate this ! See ya.
|
|
|
Logged
|
“ Music is moonlight in the gloomy night of life. ” - Jean Paul Richter
|
|
|
Josh @ Dreamland
|
|
Reply #3 Posted on: August 02, 2014, 10:44:56 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
It seems ENIGMA is mishandling the view_angle transformation. I'm merging something in from Robert now, and I have a small laundry list of other things to check in with it. I'll see if I can't reproduce your problem and fix it.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
BreakDown`
|
|
Reply #4 Posted on: August 02, 2014, 10:50:59 am |
|
|
Location: France Joined: Aug 2014
Posts: 10
|
Thanks for your quickness, I appreciate your support and I will stay in Enigma for my project. I'm reassured to know this is not entirely my fault, during your research I will try to find another method to do what I want Happy to be among you. See ya, BreakDown`
|
|
|
Logged
|
“ Music is moonlight in the gloomy night of life. ” - Jean Paul Richter
|
|
|
Goombert
|
|
Reply #5 Posted on: August 02, 2014, 03:08:57 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Actually, I believe those tile gaps could be the result of the offset in the projection functions, since they also cause gaps in my scrolling background. This is why I am being adamant about fixing the text drawing functions to prove we don't need offsets to our projection functions.
|
|
|
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.
|
|
|
BreakDown`
|
|
Reply #6 Posted on: August 02, 2014, 03:30:56 pm |
|
|
Location: France Joined: Aug 2014
Posts: 10
|
Thanks for your reply Robert.
Ok I understand... Is it possible to make this rotation with another method for the moment ? See ya, BreakDown`.
|
|
|
Logged
|
“ Music is moonlight in the gloomy night of life. ” - Jean Paul Richter
|
|
|
|
BreakDown`
|
|
Reply #8 Posted on: August 02, 2014, 04:53:16 pm |
|
|
Location: France Joined: Aug 2014
Posts: 10
|
Is it works for sprite and view ? Because any text will be rotate in my room.
Thanks for your help, I appreciate. See ya, BreakDown`
|
|
|
Logged
|
“ Music is moonlight in the gloomy night of life. ” - Jean Paul Richter
|
|
|
|
BreakDown`
|
|
Reply #10 Posted on: August 02, 2014, 05:19:24 pm |
|
|
Location: France Joined: Aug 2014
Posts: 10
|
Ok perfect I will try it tomorrow (it's already midnight here...) Thanks to take time to help me Josh and Robert.
See ya, BreakDown`
|
|
|
Logged
|
“ Music is moonlight in the gloomy night of life. ” - Jean Paul Richter
|
|
|
Darkstar2
|
|
Reply #11 Posted on: August 02, 2014, 09:50:09 pm |
|
|
Joined: Jan 2014
Posts: 1238
|
Actually, I believe those tile gaps could be the result of the offset in the projection functions, since they also cause gaps in my scrolling background. This is why I am being adamant about fixing the text drawing functions to prove we don't need offsets to our projection functions.
I tested this extensively on my end and had other people offline test it, I've done more offline testing on my own with scrolling, and have never seen any gaps, horizontal / vertical, tiles, objects or otherwise caused by the 0.01 + rounding fix, in fact there was a problem long before the offset fix.....Remember we've used offset and rounding, and for your information, you might have forgotten this, but I mentioned to you I noticed a scrolling gap, even WITHOUT the offset fixes, I accidentally found that out as I was testing something with all fixes removed and stumbled upon a flickering 1px gap on vertical scroll or some odd scrolling thing I was doing at the time, and I had all fixes removed.....So the fix is probably shifting the already existing problem around So I strongly disagree, the offset fix is not the CAUSE of the gap, as I witnessed it with factory code, no fix enabled. As far as text drawing fix, I'm for it, but not at the cost of degrading text quality and having it display blurry (even on non moving text) or sprites, etc. The fix just shifts problem around, out of view, but is NOT the cause of the bloody problem. If the ROOT of the problem is dealt with, we probably won't need a fix, but there again, it was established that it is clearly a graphic card issue, and results vary between AMD and NVIDIA. Also Robert, they cause gaps in your scrolling background, probably because of the way you do your scrolling, very complicated shit! I tested your scrolling code even without the fix and I saw gaps !!! So it was not caused by my fix. I had the gaps completely gone when modifying your code to use traditional methods of scrolling, you were using delta if not mistaken, I used the background function scrolling and gaps gone, with or without fix.
|
|
|
Logged
|
|
|
|
Josh @ Dreamland
|
|
Reply #12 Posted on: August 03, 2014, 10:55:21 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Robert, the room view code uses d3d_set_projection_ortho itself. The skewing is a function of the aspect ratio. If the room were, say, 560×560 instead of 640×480, there wouldn't be a problem with the aspect. We could ostensibly fix this by applying the rotation to the projection width and height, but that shouldn't be necessary. If I had to guess, this is solved by applying the rotation after the scaling and before the translation when creating the matrix. Right now it seems to be specified first of all, so it's not surprising we're getting skewing issues. I'll need to sit down and think about it to get the right order for the transformations. My intuitive best guess did not cut it.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
TheExDeus
|
|
Reply #13 Posted on: August 03, 2014, 04:22:42 pm |
|
|
Joined: Apr 2008
Posts: 1860
|
I didn't test view_angle, so I just implemented it wrong. This is the correct code (test and works like GM8):
void d3d_set_projection_ortho(gs_scalar x, gs_scalar y, gs_scalar width, gs_scalar height, gs_scalar angle) { x = round(x) + 0.01f; y = round(y) + 0.01f; oglmgr->Transformation(); enigma::projection_matrix.InitTranslationTransform(-x-width/2.0, -y-height/2.0, 0); enigma::projection_matrix.rotateZ(-angle); enigma::projection_matrix.translate(x+width/2.0, y+height/2.0, 0);
enigma::Matrix4 ortho; ortho.InitOrthoProjTransform(x,x + width,y + height,y,32000,-32000);
enigma::projection_matrix = ortho * enigma::projection_matrix; enigma::view_matrix.InitIdentity(); enigma::transform_needs_update = true; //enigma::d3d_light_update_positions(); } So I need to offset (because in GM the rotation is around the center of the view), rotate, and the offset it back. Then multiply in reverse order to not skew.
I will later probably fix the code not to have three matrix functions and instead make a special one, so it would be faster.
|
|
« Last Edit: August 03, 2014, 04:25:46 pm by TheExDeus »
|
Logged
|
|
|
|
Josh @ Dreamland
|
|
Reply #14 Posted on: August 03, 2014, 04:41:52 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Thanks, Harri.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|