Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated level is corrupt #33

Open
kryptan opened this issue May 20, 2020 · 2 comments
Open

Generated level is corrupt #33

kryptan opened this issue May 20, 2020 · 2 comments
Assignees

Comments

@kryptan
Copy link

kryptan commented May 20, 2020

Hi, I'm trying to generate a level using example from the readme. It saves the file but when I try to open it in Elastomania it says it is corrupt. I tries both latest published version on crates.io and master but result is the same (

Otherwise a great library, reading levels and lgrs works flawlessly, thanks!

@kryptan kryptan changed the title Generated level id corrupt Generated level is corrupt May 20, 2020
@hexjelly
Copy link
Member

I'm theorizing it might have something to do with how Elma has some expectation of the direction/order of vertices for polygons. Opening the level up in an external editor like SLE works alright. Saving it in SLE, the vertices gets rearranged, and the level saved then works in Elma.

I would have to investigate a bit about how Elma expects these vertices to be arranged, or whether I'm remember correctly in the first place. Maybe it is from something else, but I'm pretty sure this is the reason.

I'm not sure whether the library should forcefully rearrange the vertices, or if it should be up to the person using it to do it correctly. I'm guessing the library should just do it, because I'm not sure why you wouldn't want it to.

Unfortunately I don't know when I'd get around to fixing this, it's not my biggest priority with how little it is used by anyone other than myself at random times. I guess the default level should at least be fixed though so that works.

@hexjelly
Copy link
Member

This is indeed the problem. For reference:

Elma expects all ground polygons to be positively oriented (i.e. vertices are listed in counterclockwise order in memory)

@hexjelly hexjelly self-assigned this May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants