TWLan Forum
some help - Printable Version

+- TWLan Forum (https://twlan.org)
+-- Forum: Legacy (https://twlan.org/forumdisplay.php?fid=61)
+--- Forum: TWLan 1.x (DSLan) (https://twlan.org/forumdisplay.php?fid=62)
+---- Forum: Deutsche Community (https://twlan.org/forumdisplay.php?fid=65)
+----- Forum: Spielerprojekte (https://twlan.org/forumdisplay.php?fid=9)
+------ Forum: Vorschläge und Fragen (https://twlan.org/forumdisplay.php?fid=47)
+------ Thread: some help (/showthread.php?tid=4477)



some help - sinner - 02.07.2011

Hi there, I'm developing a game, it's still at a little script stage, hope that soon will get shape. Anyway, I have been studying the create_village function, and came exactly to no result. Can someone tip (pass) me some info on that ? A slight idea on how could it be made, because, I can't show up with any idea even after some researching on a x,y points onto a vertex circle on google. Tough, I still didn't manage to make any progress on that function, which is quite important. I'm asking the developers of this game, sure, if they want to give me a hand on that. I'm available via PM or Mail if you don't want to say the hints in this thread.

Cheers, Sinner.


RE: Game developing hotfix help - Yannici - 02.07.2011

I just little bit drunken, but I hope I understood your question anyway.

You have to get the position where the village should be create! (Like: Nord-East(ne), Nord-West (nw), South-West (sw), South-East (se)).
So if you get this information you can create a random number for the X and Y coordinates.
For example you got a map with coords between -50|50.

So the Script would be like this one:
PHP Code:
$position $_GET['position'];

if(
$position == "ne")
   {
     
$x rand(050);
     
$y rand(050);
   }
   elseif(
$position == "nw")
   {
    
$x rand(-500);
    
$y rand(050);
   }
   elseif(
$position == "sw")
   {
    
$x rand(-500);
    
$y rand(0, -50);
   }
   elseif(
$position == "se")
   {
    
$x rand(050);
    
$y rand(0, -50);
   }
   else  
// If random position
   
{
    
$x rand(-5050);
    
$y rand(-5050);
   }

create_village($x$y); 

I hope, I could helped you :')

Sorry for bad english Big Grin

so far
Yannici



RE: Game developing hotfix help - Molt - 02.07.2011

@Yannici: Was, wenn dann aber schon alles voll ist da? Tongue

@Sinner:
Before I joined the TWLan Dev, I wrote a little script for myself and it looked similar to this:
PHP Code:
// Given variables:
// $direction = direction in which the village should be created
// $villages = amount of villages

// Coord-System is like in Tribalwars

// So, the main idea is to find a circle where the village is created on
$radius sqrt($villages);
if(
$direction == "nw" || $direction == "sw")
{
$x rand(0, -1);
}
else
{
$x rand(01);
}
// Now we have a horizontal value and need the vertical one
$y cos(asin($x));
// But it will always be positive, so we have to make another check
if($direction == "se" || $direction == "sw")
{
$y *= (-1);
}
// All we have to do now is multiply x and y with the radius and add the center coords of the map
$x *= $radius;
$y *= $radius;
$x += 500;
$y += 500;
$x round($x);
$y round($y);
// And then of course check if this coords are free ;) 

Greetings
Molt


RE: Game developing hotfix help - sinner - 02.07.2011

@Molt, what do you mean by "amount of villages" the number of villages already created ? Though, I am a bit shamed because thats quite logical, too bad i never got in good relation with math algorithms.
Thanks again for this. Anyway, I have 2 more questions that are like an enigma for me at the moment, because they require mathematical attention, and i kind of suck at that. Hope for the best, i will get back with them as soon as possible, and thanks again for the patience and the help you gave me.
@Yannici, thanks for that too, you understood my needings, but i done it myself too and didn't helped much.


RE: Game developing hotfix help - Molt - 02.07.2011

(02.07.2011, 10:30)sinner Wrote: what do you mean by "amount of villages" the number of villages already created?
Exactly. Wink


RE: Game developing hotfix help - Yannici - 02.07.2011

(02.07.2011, 08:00)Molt Wrote: @Yannici: Was, wenn dann aber schon alles voll ist da? Tongue

Die Abfrage steckt dann in der Funktion create_village(); *HÖHÖHÖHÖ* Big Grin

so far
Yannici