Hello I've been trying for couple of days to write a script to generate a progressive map using PHP.
What I'm trying to achieve but with no success would be something like this:
In short I have a "node" defined as 5,6 on xy ( as an example ) then randomly add a random number of "players" close to the "node". From here I want to connect the closest "player" to the node while having a list of criteria that will determine to which node the "player" will be connected (how many connections are for that node, what's the max number of connections etc ). I haven't written any code yet because I don't know exactly where to start or with what should I start since I'm not that great with math only pretty good with PHP. Andy ideas or advice any help is welcomed.
Well, I think you want to create a topology of the network, having as root the internet provider.
So, I'm thinking that the best way is to create a graph. The root is the red dot. Than the players attached to it. Than the players attached to the already attached players and so on.
something like this :
*
/ | \
O O O
/ | | |
O O O O
now. Each node of the graph can have some info associated to it: type: player | node coordX : 5 coordY: 6 etc...
Displaying the map will just mean that you can walk the tree and draw the elements based on their positions, you can draw lines based on the connections.
If your topology conains cycles, that is player1 connected to player2 which is connected to player3 ..... player n which is connected to player1, than you need a graph structure.
If i described correctly your problem, than you should find some articles about tree / graph algorithm, how to parse them, etc.. and should be able to do your job.