Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 20 Apr 2013
Offline Last Active Aug 24 2015 09:05 AM

Posts I've Made

In Topic: which method should i use for engine independent level-design?

20 February 2015 - 03:12 AM

Short answer: with code. Long answer: For example you usually have a level designer (depends on the game though) using some kind of editor to put the things in place, this editor can save all that data under some form. Then you'll need a piece of code (usually your programmer would write it or you'll use a library) that can make sense of the file you have from your editor (you may need to convert the format from the editor to something else before using it too). It would help a lot if you try to elaborate what exactly you are trying to do. From what I get up to now, you want to use unity's editor to create your scene - then get the output file and read it so you can use it in another engine. To do this you'll need to know the structure of a unity scene(?) file, and be able to make sense of each structure in the unity file and convert it to something that makes sense in your engine. You could also try another thing - write your own editor that does exactly what you want and not tons more(like Unity), which saves everything exactly in the format you need it.

In Topic: Simplify nodes in a grid

28 January 2015 - 02:32 PM

You can run an algorithm on a grid - basically drop the nodes to begin with and when "draggin your road" just put a cell value of 1 for example and 0 for empty. Then you start at a cell with 1 and from there search horizontally till you reach an empty cell - then you register where it ends and you can save the coordinates and put a node there. You can do the same thing vertically and diagonally. Or you could create an instance of some structure Cell that would contain information on the 8 neighbouring cells then run an algorithm on all the cells. The other possibility is going with your variant, applying an algorithm to check for intersections and stuff, but the whole thing would get needlessly tricky.


Say I have a grid nxn, use an array to represent that grid, make every cell = 0 to begin with, whenever you draw a road put cell = 1. After this if you want you could create nodes by analyzing the grid - basically from a cell with value 1 you try to reach the end horizontally, when you reach the ends you put a node there, same for the other directions. Example(c++ code):

const unsigned int n = 10;
bool grid[n][n];
for(unsigned int i = 0; i<n;i++)
    for(unsigned int j = 0; j<n; j++)
        grid[i][j] = 0;

int findEndHorizontallyRight(int cellX, int cellY)
        return 0;
    int x = cellX;
             return x;
    return x;

In Topic: Simplify nodes in a grid

28 January 2015 - 02:19 PM

By dragging the road - in which directions can I drag it(only vertically, only horizontally, alternating?)?

This code helps a lot - so you basically want to merge roads if they "touch" or intersect?

In Topic: Simplify nodes in a grid

28 January 2015 - 02:13 PM

This is not helping...Can you explain in steps, without references to simcity if possible, what you want to get from this:

var path    = [];
    path[0] = {'x':1,'y':3,'linksTo':[1],'id':0};
    path[1] = {'x':1,'y':4,'linksTo':[0],'id':1};
    path[2] = {'x':1,'y':1,'linksTo':[3] ,'id':2};
    path[2] = {'x':1,'y':0,'linksTo':[2] ,'id':3};

Like type the structure you get, and explain by what rules you get it. As much as I like guessing games, I'd prefer knowing the rules to build the 2nd image from the first one. Just elaborate on the question and exactly what you want to get.

In Topic: Simplify nodes in a grid

28 January 2015 - 02:07 PM

And how exactly do you get the 2nd image without doing anything from the first image, it doesn't make sense at least to me. I think defining what "building an intersection" would help a lot, or you could just define the whole thing in terms of a graph so people won't have to guess what you are trying to do. Or just take some time to elaborate on exactly what you want to happen - the more concise information you give - the better an answer would people be able to give.


P.S. The terms you use are more than ambiguous, and while you may have an idea in your head of what you want to make - I can guess at least 10 scenarios from what you're saying.