Programmer needed (level generator)
Moderator: Moporators
Re: Programmer needed (level generator)
Well yes it does work. But it's hard to calculate how much should x/y-coordinates vary depending on the angle the next vertex is going... though I haven't given this thing much thoughts yet. If you have anything to suggest, do it xD
Re: Programmer needed (level generator)
some info for elma level making:
a polygon has its values written clockwise in a solid/ground polygon. if the polygon is reversed, meaning cut out from the ground, its values are written in anti-clockwise order. if you mess this up the level will still work to play, but it will look crazy. do it!
a polygon has its values written clockwise in a solid/ground polygon. if the polygon is reversed, meaning cut out from the ground, its values are written in anti-clockwise order. if you mess this up the level will still work to play, but it will look crazy. do it!
-
"leader status in the Elma against-the-system underground" - Abula
-
ElmaAutoGravityApples 2024
IncrElastoMania - Elma Simulation - Browser Game 2020
Elma Imager - Command Line Tool 2020
"leader status in the Elma against-the-system underground" - Abula
-
ElmaAutoGravityApples 2024
IncrElastoMania - Elma Simulation - Browser Game 2020
Elma Imager - Command Line Tool 2020
Re: Programmer needed (level generator)
Ok here is my problem in the pie generator. First of all you should know how I am trying to generate pie. I create a random line, then duplicate it and try to adjust the x,y values of the line to make it always standard width.
This link will probably tell something: http://zworqy.com/up/files/lal.png.
The first situation in the left is ez. The second on the right, is the same situation, but the first line is already in an angle. Of course you count it just like the first one, but somehow I fail to make a generalized function of it. In that situation, the length of x same, but x,y coordinates aren't. I've tried to do some coordinate system rotation according how the line is angled, but not managed. Maybe I'll try some other method.
This link will probably tell something: http://zworqy.com/up/files/lal.png.
The first situation in the left is ez. The second on the right, is the same situation, but the first line is already in an angle. Of course you count it just like the first one, but somehow I fail to make a generalized function of it. In that situation, the length of x same, but x,y coordinates aren't. I've tried to do some coordinate system rotation according how the line is angled, but not managed. Maybe I'll try some other method.
Re: Programmer needed (level generator)
Hope u understand...
status:ONLINE - - - drinking:GOFE - - - iq:85 - - - elasto mania ranking:#1
Re: Programmer needed (level generator)
Well yeah I understand everything you drew there but I don't know it is supposed to help me xD
Re: Programmer needed (level generator)
you can use that procedure in any angle
status:ONLINE - - - drinking:GOFE - - - iq:85 - - - elasto mania ranking:#1
Re: Programmer needed (level generator)
You should try not to use any angles at all. I usually do such stuff this way:
Given the blue points (A,B,C), you want to calculate the green ones (G,K,I). (Red lines have same length, i.e. 1)
Given the blue points (A,B,C), you want to calculate the green ones (G,K,I). (Red lines have same length, i.e. 1)
- Calculate G and I
- calculate the blue vectors
a = B - A; // pointing from A to B
b = C - B; // pointing from B to C - normalize them
c = a / a.length; // pointing from D to B
d = b / b.length; // pointing from B to E - rotate c counter clockwise by 90 degree
e.x = -c.y;
e.y = c.x; // pointing from A to F - multiply by pipe width
f = e * w; // pointing from A to G - calculate G
G = A + f; - same to calculate I
g.x = -d.y;
g.y = d.x; // pointing from C to H
h = g * w; // pointing from C to I
I = C + h;
- Calculate K
- Get a bisector of the angle (A,B,C)
n = B - c + d; // pointing from J to B - the lines q = G + t * a (t in IR) and k = B + s * n (s in IR) intersect in K, so we need to solve the following equations:
With some simple algebra we get the solution:
Code: Select all
G.x + t * a.x = B.x + s * n.x G.x + t * a.x = B.x + s * n.x
t = (n.x * (B.y - G.y) - n.y * (B.x - G.x)) / (a.y * n.x - a.x * n.y);
K = G + t * a;
- To calculate more points like K, use the line r = K + t * b instead of q.
Last edited by welle on 10 Feb 2010, 23:19, edited 1 time in total.
Re: Programmer needed (level generator)
if you wanna do it with angles anyway maybe this helps:
angle of pipe 1: v1
angle of pipe 2: v2
angle of red line in your drawing: (v1+v2+pi)/2
angle beta in your drawing: (v1-v2)/2
width of pipe: w
so length of red line would be w/cos(beta)
and this gives distance to the coordinates for where the "roof" lines meet:
dx = w/cos((v1-v2)/2) * cos((v1+v2+pi)/2)
dy = w/cos((v1-v2)/2) * sin((v1+v2+pi)/2)
-pi < v1-v2 < pi
using vectors like welle said might be easier and faster tho
angle of pipe 1: v1
angle of pipe 2: v2
angle of red line in your drawing: (v1+v2+pi)/2
angle beta in your drawing: (v1-v2)/2
width of pipe: w
so length of red line would be w/cos(beta)
and this gives distance to the coordinates for where the "roof" lines meet:
dx = w/cos((v1-v2)/2) * cos((v1+v2+pi)/2)
dy = w/cos((v1-v2)/2) * sin((v1+v2+pi)/2)
-pi < v1-v2 < pi
using vectors like welle said might be easier and faster tho
Re: Programmer needed (level generator)
eeww maths =)
Re: Programmer needed (level generator)
Thank you for those methods, I will try those tomorrow.
Re: Programmer needed (level generator)
Ville :O time for some random update xD
Thorze wrote:I just wanted to make a cool topic like Juish have cool topics..
Re: Programmer needed (level generator)
I've said like 100 times that I haven't had any time to work on it, it means 0 seconds xD I hav not even tried the methods given above. But now that you brought this up, I think I will do something over the weekend =)
Re: Programmer needed (level generator)
You say you have had no time what so ever yet you play endless battles on belma :D:D:D:D:D::D:D:Dd =D=D=D xd
Thorze wrote:I just wanted to make a cool topic like Juish have cool topics..
Re: Programmer needed (level generator)
Ah yes of course, I meant like very often you can't find any time to make your homework because you have better things to do =)
Re: Programmer needed (level generator)
Well, I tried Welles method a bit and some of it worked but some I fail. Here:
As you can see it doesn't look too good =) but, the thing is that the y-values are the values from the top border, not from bottom as it is in normal coordinates. Anyways we can see that if that G-spot is moved to below of the A-spot as much as it is above it now, it goes right. But the real problem here is (I guess) that K doesn't seem to make any sense. No matter where I put the C spot, the K spot always stays at the same position, and ofc it can't be like that. The direction of the vector seems to be right but it's not long enough. So I have failed something, I put my code here so someone can look and tell me how nab I am:
As you can see it doesn't look too good =) but, the thing is that the y-values are the values from the top border, not from bottom as it is in normal coordinates. Anyways we can see that if that G-spot is moved to below of the A-spot as much as it is above it now, it goes right. But the real problem here is (I guess) that K doesn't seem to make any sense. No matter where I put the C spot, the K spot always stays at the same position, and ofc it can't be like that. The direction of the vector seems to be right but it's not long enough. So I have failed something, I put my code here so someone can look and tell me how nab I am:
Code: Select all
/*
this is the polygon shown in the picture
*/
// A B C
$polygon2 = array(10,30,40,20,80,30);
/*
vector shit
*/
//vector a
$va_x = $polygon2[2] - $polygon2[0];
$va_y = $polygon2[3] - $polygon2[1];
//vector b
$vb_x = $polygon2[4] - $polygon2[2];
$vb_y = $polygon2[5] - $polygon2[3];
//vector a length
$va_length = sqrt(($va_x*$va_x)+($va_y*$va_y));
$vb_length = sqrt(($vb_x*$vb_x)+($vb_y*$vb_y));
//vector e
$ve_x = (-$va_y/$va_length) * 10;
$ve_y = (-$va_x/$va_length) * 10;
//g-spot
$sG_x = $polygon2[0]+$ve_x;
$sG_y = $polygon2[1]+$ve_y;
/*
K here...
*/
//this is n vector
$vn_x = $polygon2[2] - ($va_x/$va_length) + ($vb_x/$vb_length);
$vn_y = $polygon2[3] - ($va_y/$va_length) + ($vb_y/$vb_length);
//t number
$mt = (($vn_x * ($polygon2[3]-$sG_y) - $vn_y * ($polygon2[2] - $sG_x)) / ($va_y * $vn_x - $va_x * $vn_y));
//k-spot
$sK_x = $sG_x + $mt * $va_x;
$sK_y = $sG_y + $mt * $va_y;
Re: Programmer needed (level generator)
i don't want to confuse people but here is the way i did :
1. See a pipe as a path :
2. For each section, find the ortho vectors of each extremity
3. Given a width, compute intersections between the interesting lines
4. You have a pipe dude
result :
1. See a pipe as a path :
2. For each section, find the ortho vectors of each extremity
3. Given a width, compute intersections between the interesting lines
4. You have a pipe dude
result :
Re: Programmer needed (level generator)
Thank you for not confusing =D But anyways, that was the way I first wanted/tried to do it but I couldn't figure out how to do the other lines so that I could actually count the point where they intersect. Like how teh fuck you do that? There was a time when I was king of maths, but apparently not anymore! I feel like a retard when thinking these things, not sure should I be happy or sad =)
Re: Programmer needed (level generator)
it's all matter of 2D points and vectors :
then :
then :
Re: Programmer needed (level generator)
Ok here is the random update teh:
- You can make the lev either uphill or downhill
- Apples on/off
- Killers on/of with different "difficulty" (noone liked killers on so don't balle it too much =)
http://gen.oktobia.org/
Maby now I will move forward and leave even the pipe shit behind at least for now xD
- You can make the lev either uphill or downhill
- Apples on/off
- Killers on/of with different "difficulty" (noone liked killers on so don't balle it too much =)
http://gen.oktobia.org/
Maby now I will move forward and leave even the pipe shit behind at least for now xD
Re: Programmer needed (level generator)
woooooooow =o where did you find those seconds of spair time? XD
Thorze wrote:I just wanted to make a cool topic like Juish have cool topics..
Re: Programmer needed (level generator)
I finished another thing I've been busy with =) And now I have thousands of seconds to develope this, unless I start making my other project soon =D
Re: Programmer needed (level generator)
Made teh rah mode =) It's quite experimental and not that random, and prolly sucks but I wasted waaaay to much time making it so there it is:
http://gen.oktobia.org/rah
So be careful what level you download, some might cause elma to crash (if polygons intersect).
Does someone want some new mode to be made, and what mode? Or ideas to make ruh or rah even better?
http://gen.oktobia.org/rah
So be careful what level you download, some might cause elma to crash (if polygons intersect).
Does someone want some new mode to be made, and what mode? Or ideas to make ruh or rah even better?
Re: Programmer needed (level generator)
If there was a Like button I would so press it! :D:D
I gotta check the levels later on after my homework (or tomorrow). Looks like you cheated and put somewhat fixed locations (+- some minor differences) for each polygon and the rotation and size of the polygons differ not very much
I like how you handled the "background" level problem.
Good job Ville =)
I'll try to come up with some new idea for your randomnessorized level generator script.
I gotta check the levels later on after my homework (or tomorrow). Looks like you cheated and put somewhat fixed locations (+- some minor differences) for each polygon and the rotation and size of the polygons differ not very much
I like how you handled the "background" level problem.
Good job Ville =)
I'll try to come up with some new idea for your randomnessorized level generator script.
Thorze wrote:I just wanted to make a cool topic like Juish have cool topics..
Re: Programmer needed (level generator)
Yes I had to xiit like that because I couldn't come up with nice algorithm that wouldn't create platforms too close to each other. If anyone has any idea, you can suggest. But plz no "Just count the distance of each lines to every existing vertex and if too close then..", nat gonna happen. I made a script to detect intersections but there was some tiny bug (or then I somehow passed few wrong variables in it, who knows) so I couldn't use it yet, but maby laters. And ofc it does not solve the platforms being too close...
- Kopaka
- 39mins club
- Posts: 6612
- Joined: 23 May 2002, 13:59
- Team: LAME
- Location: In a northern danish city beating YOUR record.
- Contact:
Re: Programmer needed (level generator)
When I press generate it just goes to a blank page.
Re: Programmer needed (level generator)
This is a problem of the host. Ftp isn't working correctly atm and I can't update any files. I tried to update the generator script and that happened. I guess it will be fixed by tomorrow when I am able to re-upload the files.
edit.
Oops it was my mistake after all, didn't include the functions I made. Anyways sucks host because it doesn't tell me what is actually wrong =)
So, AH's are more random now. It may still generate intersecting polygons though. I've just started to rewrite my generator with classes so in the future it will be easier for me to develop it I hope.
edit.
Oops it was my mistake after all, didn't include the functions I made. Anyways sucks host because it doesn't tell me what is actually wrong =)
So, AH's are more random now. It may still generate intersecting polygons though. I've just started to rewrite my generator with classes so in the future it will be easier for me to develop it I hope.
- Kopaka
- 39mins club
- Posts: 6612
- Joined: 23 May 2002, 13:59
- Team: LAME
- Location: In a northern danish city beating YOUR record.
- Contact:
Re: Programmer needed (level generator)
Wow, suddenly this is a really interesting project Before with uphills and the talk about pipes I thought it was kinda useless since it was only what I consider bad/no fun levels, but now it can create some levels that could be fun to play. Good work =)
Re: Programmer needed (level generator)
Anyone have copy of level format & algorithms? I think Lousku posted somewhere on mopolauta and can't find it, and file link here is broken
CHeers
CHeers
Re: Programmer needed (level generator)
http://zzz.ink/elma/formats/sunl wrote:Anyone have copy of level format & algorithms? I think Lousku posted somewhere on mopolauta and can't find it, and file link here is broken
CHeers
then again i don't know anything
maybe easier not to think abouut alöl things thought than not things thought ... or something..=?
maybe easier not to think abouut alöl things thought than not things thought ... or something..=?
Re: Programmer needed (level generator)
it wos for mats not for sunl..
Re: Programmer needed (level generator)
Started "transcribing" those text files here btw with little explanation, but still work in progress: http://wiki.elmaonline.net/Technical
Prestigious member of 14.6x Tutor14 club