Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Here is the function I am using to load the textures. Basically I call 'loadSpriteFile("image.png", enemyImage)'. I have littered this code with printfs for glGetError and nothing comes up.

code:
int loadSpriteFile(char *fileName, GLuint imageData)
{
    SDL_Surface *surface;    // This surface will tell us the details of the image
    GLenum texture_format;
    GLint  nOfColors;
    
    if ((surface = IMG_Load(fileName))) 
    {
        // get the number of channels in the SDL surface
        nOfColors = surface->format->BytesPerPixel;
        glGenTextures(1, &imageData);
        glBindTexture(GL_TEXTURE_2D, imageData);
        
        // Set the texture's stretching properties
        glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
        glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
        
        glTexImage2D(GL_TEXTURE_2D, 0, nOfColors, surface->w, surface->h, 0,
                     texture_format, GL_UNSIGNED_BYTE, surface->pixels);
    } 
    else 
    {
        fprintf(stderr, "SDL could not load %s: %s\n", SDL_GetError(), fileName);
        SDL_Quit();
        return 0;
    }    
    
    glMatrixMode(GL_TEXTURE);
    glLoadIdentity();
    // create 1:1 pixel scale for image
    glScalef(1.0f/(float)surface->w, 1.0f/(float)surface->h, 1.0f);    
    
    // Free the SDL_Surface only if it was successfully created
    if (surface) 
    { 
        SDL_FreeSurface(surface);
    }
    
    return 1;
}

Adbot
ADBOT LOVES YOU

Staggy
Mar 20, 2008

Said little bitch, you can't fuck with me if you wanted to
These expensive
These is red bottoms
These is bloody shoes


I've just found this deal: a year-long free subscription to Develop magazine - either digital or doormat copies - for anyone in the UK only.

The form isn't asking for any credit or debit card details either, so it isn't a case of forgetting, a year from now, that you signed up and getting hit for a full-paid subscription.

I can't say I've heard of the magazine before, but for £0 it seems pretty sweet.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

ARRGGHH NEVERMIND I FIXED IT

Note to self: LEARN C BETTAR

brian
Sep 11, 2001
I obtained this title through beard tax.

Staggy posted:

I've just found this deal: a year-long free subscription to Develop magazine - either digital or doormat copies - for anyone in the UK only.

The form isn't asking for any credit or debit card details either, so it isn't a case of forgetting, a year from now, that you signed up and getting hit for a full-paid subscription.

I can't say I've heard of the magazine before, but for £0 it seems pretty sweet.

Thanks a lot for the heads up, i'm surprised you haven't heard of it, it's the equivalent of game developer for the UK, it's not necessarily as good but has post mortems and whatnot sometimes (less so than GD). Either way it's great to get for free.

Vino
Aug 11, 2010
Holy crap! I've been on SA for about a month and I hadn't even seen the little "Cavern of COBOL" subforum until tonight, and it turns out there's a whole entire drat thread devoted just to game development!

Me :love: SA

So to make sure I have some content and don't get banned, here's a question. Eventually I'm going to have to add frustum culling to my game (Gasp, it doesn't have it already?!? Bad Vino!) and to do this I'm going to make an octree, which I know all about in theory but last time I tried to implement one it failed miserably. The main thing I got hung up on seems silly but I couldn't figure it out so I figure I'll ask you guys to see if I can cut down on experimentation time later.

And it is this: When I have a list of objects in each leaf, do I want large objects to also be listed in every leaf, or only the leaf of its origin? Do I want them to be listed in the parent nodes as well, for every parent node that touches the object, or only in the leafs? Example:

code:
  a
 / \
b   c
There is a large object whose origin is in C, but it stretches across A and B as well. A is only a parent node, but B and C are leafs. Do I want pointers in all three, or only in B and C, or only in C?

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...

Vino posted:

Holy crap! I've been on SA for about a month and I hadn't even seen the little "Cavern of COBOL" subforum until tonight, and it turns out there's a whole entire drat thread devoted just to game development!

Me :love: SA

So to make sure I have some content and don't get banned, here's a question. Eventually I'm going to have to add frustum culling to my game (Gasp, it doesn't have it already?!? Bad Vino!) and to do this I'm going to make an octree, which I know all about in theory but last time I tried to implement one it failed miserably. The main thing I got hung up on seems silly but I couldn't figure it out so I figure I'll ask you guys to see if I can cut down on experimentation time later.

And it is this: When I have a list of objects in each leaf, do I want large objects to also be listed in every leaf, or only the leaf of its origin? Do I want them to be listed in the parent nodes as well, for every parent node that touches the object, or only in the leafs? Example:

code:
  a
 / \
b   c
There is a large object whose origin is in C, but it stretches across A and B as well. A is only a parent node, but B and C are leafs. Do I want pointers in all three, or only in B and C, or only in C?

Put it in A (or use a BVH instead, which is probably a better choice)
Barring that, put it in both B and C

Vino
Aug 11, 2010
A BVH huh? I'm not familiar with those so I'll have to do some learning on them. Doesn't it seem like it'd be expensive to rebuild if things move around, like a kd tree?

Foiltha
Jun 12, 2008

Vino posted:

A BVH huh? I'm not familiar with those so I'll have to do some learning on them. Doesn't it seem like it'd be expensive to rebuild if things move around, like a kd tree?

I'm not really sure about this but I don't think you'd really have to rebuild the BVH unless the translated bounding volume moves outside the parent bounding volume. You could just apply the same translation to the volume as well as the elements in the leaf. How often the rebuilding occurs would probably also depend on the depth of the hierarchy.

BVHs are also pretty fast to build (depending on the spatial split heuristic). Even my really bad BVH implementation builds a BVH containing ~16,000 nodes and over 100,000 triangles in under 500 milliseconds. Do note that this is with the naive median split heuristic though.

Vino
Aug 11, 2010
Is there anywhere I can find a writeup on the benefits and drawbacks for that in comparison to for example an octree or other data structures? My Google-fu is lacking to be productive in this regard.

Your Computer
Oct 3, 2008




Grimey Drawer
I'm currently working on a small project in Java using lwjgl, using it for input-handling and access to OpenGL. I'm fairly new to OpenGL-programming though I do have several years of experience making 3D models (so I'm not new to 3D in general).

The game I'm making is top-down with a mixture of sprites and 3D models, à la GTA 1. Because of this I want perspective and not ortho. Currently I'm doing
code:
gluPerspective(45.0f, ((float)WWIDTH / (float)WHEIGHT)), 0.1f, 150.0f);
..which makes a nice frustum where I place the player at -100.

Now, here's where I'm confused.. This "view" is from the front, correct? How would I go about rotating it so everything is viewed down the y-axis? Should I even bother?
Another thing I wonder about is distortion. I made a tall box and positioned it down the y-axis but it didn't get distorted no matter where I positioned it :sigh: Since I'm going for the GTA 1-look I want the perspective to be distorted towards the viewer so you can view down the sides of the buildings. Am I positioning the box wrong or is it not tall enough?

Another strange problem I just hit has to do with movement. I'm moving the player using
code:
forwardX = (float) Math.sin(Math.toRadians(zRot));
forwardY = (float) -Math.cos(Math.toRadians(zRot));
xPos += forwardX / amount;
yPos += forwardY / amount;
where the amount is -2.5 on x and +2.5 on y for forward movement and +4.5 on x and -4.5 on y for backward movement.

This worked perfectly when it was just hacked into the main code but when I moved it to the appropriate place (the player class) it started acting weird. Rotating works fine and walking works fine, but if I rotate while walking he ends up bouncing around in a circle (instead of just changing direction). Rather, he changes direction while walking forward.

I'm terrible at explaining, so here's my code (it's crap, I know):

http://pastebin.com/HwejSjGP Main class

http://pastebin.com/c6E0uMw0 Sprite class (player)

http://pastebin.com/aT62v6sM Building class (the box)

Edit:
After looking some more at the movement, I've noticed what's wrong.


Left: Desired movement Right: Current movement

In the left picture he rotates and moves at the same time, making a nice curve.
In the right one, he rotates around while walking forward, and when he hits 90 degrees to the right he changes direction.

...At least something like that.

Your Computer fucked around with this message at 23:07 on Oct 1, 2010

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.

Your Computer posted:

Now, here's where I'm confused.. This "view" is from the front, correct? How would I go about rotating it so everything is viewed down the y-axis? Should I even bother?
The perspective matrix just tells the graphics card how to translate the 3D scene onto the 2D surface of your monitor. To get the camera to move around and look in different directions you will also generate a View matrix and then multiply it by the perspective matrix to get the combined effect of 'move camera to this location, point it in this direction, ok now map the model to my monitor from that viewing angle'. I'm not really an openGL person but from a quick Google it seems like gluLookAt might be what you want.

Your Computer posted:

Another thing I wonder about is distortion. I made a tall box and positioned it down the y-axis but it didn't get distorted no matter where I positioned it :sigh: Since I'm going for the GTA 1-look I want the perspective to be distorted towards the viewer so you can view down the sides of the buildings. Am I positioning the box wrong or is it not tall enough?
You can get a kind of fish-eye lens effect by widening the field of view in your perspective matrix, if that's what you are going for. Change the 45f in your gluPerspective call to 90f and see how it looks.

Your Computer posted:

code:
forwardX = (float) Math.sin(Math.toRadians(zRot));
forwardY = (float) -Math.cos(Math.toRadians(zRot));
xPos += forwardX / amount;
yPos += forwardY / amount;
code:
    public void move(float x, float y) {
        this.setX(forwardX / x);
        this.setY(forwardY / y);
    }
The top code is what you posted as working. It looks to me like you are forming a 2D unit vector (forwardX, forwardY) and then moving in that direction by a distance (1/amount). Other than me finding it odd to express the distance as 1/amount instead of just calculating amount differently, it seems fine.

The bottom code is from your pastebin listing. I don't know what x or y are supposed to mean in this case, but the fact that they are different numbers means that you will be moving in the x-direction at a speed of (1/x) and moving in the y-direction at a speed of (1/y) units/tick. That just seems wrong.

Unless I'm missing something you really should be just passing in one number representing how far the player can move in one tick and then doing something like
code:
    public void move(float distanceToMove) {
        this.setX(forwardX * distanceToMove);
        this.setY(forwardY * distanceToMove);
    }

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

Your Computer posted:

Another thing I wonder about is distortion. I made a tall box and positioned it down the y-axis but it didn't get distorted no matter where I positioned it :sigh: Since I'm going for the GTA 1-look I want the perspective to be distorted towards the viewer so you can view down the sides of the buildings. Am I positioning the box wrong or is it not tall enough?
I could be wrong, but I think in order to get noticeable distortion you'd need the box to be segmented. If you're just rendering a rectangle with 4 corners (the side of the box) it'll always be just a trapezoid on screen, any distortion could only be evident from movement not in a still image, but if you're rendering a series of rectangles going into the distance (in a distorted lens) then the trapezoids can be calculated as having different angles, giving you the curved distortion I think you're looking for.

Your Computer
Oct 3, 2008




Grimey Drawer
To better explain the distortion I talked about..

Let's say this is the scene:


This is how I want it to look:


..And this is how it looks:


I have no idea why this is, since it's acting orthographic even though I'm using gluPerspective?

PDP-1:
I.. I guess I'll take another look at my code and come back to that once I figure out what I'm doing.

Edit:

Changing the FOV does nothing but zoom everything out (or in).

PDP-1:
I've cleaned up my code a bit, it's now
code:
forwardX = (float) -Math.sin(Math.toRadians(zRot));
forwardY = (float) -Math.cos(Math.toRadians(zRot));
and
code:
public void move(float amount) {
this.xPos += (forwardX / amount);
this.yPos += (forwardY / amount);
}
xPos and yPos represent the position of the player, forwardX and forwardY are used together with zRot(the rotational angle of the player) to pinpoint in which direction the player should move after rotation. The player starts facing towards the bottom of the screen (instead of up).

The reason I divide by an amount is because 1 unit is too fast. I want it to go slow, or even slower.


Everything works, I just moved the forwardX/Y-updating to the move method and presto, everything works fine. Guess it didn't like being updated every frame?

Your Computer fucked around with this message at 21:40 on Oct 3, 2010

Morpheus
Apr 18, 2008

My favourite little monsters
What's an effective AI pathfinding algorithm for large, open environments? I'm thinking quadtrees + A*, but am unsure. I'm not terribly worried about how the path looks, since this is just for a little side project I've decided to whip up.

PnP Bios
Oct 24, 2005
optional; no images are allowed, only text
I'm working on a geometry library for a game, and need just a bit of assistance dividing a simple polygon into a list of triangles.



If I was just dealing with a convex polygon, this would be simple, you start from a point and build a triangle fan. But with a concave polygon, this is a bit more tricky, would possibly need to first divide up into 2 or more convex polygons first.

My idea was to start with the first vertex and go around the polygon, finding the largest internal polygon that is still convex, splitting that into triangles, then removing everything but the first and last elements, and repeating until all the vertices are used up.

Does this method have any merit? The idea would be to do this once, and basically just for rendering as triangles instead of a polygon for speed.

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen
The ear clipping method is a simple method for decomposing an arbitrary poly into triangles assuming your shape contains no holes, but you could also look up Delaunay triangulation and it's variants if you fancy getting fancy.

PnP Bios
Oct 24, 2005
optional; no images are allowed, only text

ynohtna posted:

The ear clipping method is a simple method for decomposing an arbitrary poly into triangles assuming your shape contains no holes, but you could also look up Delaunay triangulation and it's variants if you fancy getting fancy.

I've been researching ear clipping, i think that will work well for me.

hayden.
Sep 11, 2007

here's a goat on a pig or something
This may not be the best thread for this question - if not let me know where would be.

Derivative works, an example being an MMO someone made similar to the gameboy Pokemon games, typically get sued out of existence because of trademark infringement. Would it be possible to get around this technicality by providing the game with placeholder names and graphics and allowing a user to have a plugin that then displayed Pokemon images/names instead of the placeholders? What if the game automatically downloaded the plugin for users off a website not owned by the people making the game?

LOLLERZ
Dec 9, 2003
ASK ME ABOUT SPAMMING THE REPORT FORUM TO PROTECT ~MY WIFE'S~ OKCUPID PERSONALS ANALYSIS SA-MART THREAD. DO IT. ALL THE TIME. CONSTANTLY. IF SHE DOESN'T HAVE THE THREAD, SHE'LL WANT TO TALK TO ME!

hayden. posted:

This may not be the best thread for this question - if not let me know where would be.

Derivative works, an example being an MMO someone made similar to the gameboy Pokemon games, typically get sued out of existence because of trademark infringement. Would it be possible to get around this technicality by providing the game with placeholder names and graphics and allowing a user to have a plugin that then displayed Pokemon images/names instead of the placeholders? What if the game automatically downloaded the plugin for users off a website not owned by the people making the game?

There's a ton of games that do that quite successfully. StepMania uses pirated DDR songs, TA:Spring uses copyrighted Total Annihilation art assets, Emulators run pirated ROMs, etc.

If it automatically downloads, that site will get takedown notices.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
It's an extremely gray area legally, because it asks the question of what constitutes a derivative work when you clearly made something around a set of existing content even though you didn't actually include it. The same question has come up with how enforceable the GPL's linking provisions are, for example, but nobody's tried it in a courtroom. Normally these sites don't get "sued out of existence," they get C&D notices and kill the project so they DON'T get taken to court.

There's also the concern that, even if you just interface with an existing product, you're asking someone to violate the EULA of a product they own, which is considered copyright infringement on the part of the EULA violator due to some exceptionally terrible case law, and you may wind up in the situation that Glider was in.

The only way to be totally safe is not design your product around somebody else's.

haveblue
Aug 15, 2005



Toilet Rascal
A few years ago Marvel sued the City of Heroes dev (NCSoft) for allowing players to infringe Marvel copyrights with their character creator. They settled, but it looked like NCSoft had the upper hand by the end. So it's not quite as gray as all that- you can allow your users some freedom to use your game without being directly liable for what they do, but if you name your game "Pokamom" and have a /put_rom_here directory you will probably get in trouble.

Either way, I'm not a lawyer.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

I made a Dr. Mario clone using SDL. I'm using a Mac with Xcode, but if anyone wants to see if it will work under Linux/Windows, I'd be interested in seeing how it runs.

Screenshot:


Link to the source+program: http://isovega.net/macgameprog/bugzapper/BugZapper-0.1-full.zip

Just the source: http://isovega.net/macgameprog/bugzapper/BugZapper-0.1-source.zip

It's far from 'complete' but I felt it was enough to share with other people who are getting started in game programming.

The art is from Surt - http://opengameart.org/content/dr-mario-clone-sprites

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!
Can anyone recommend me a series of good SlimDX tutorials?

Seat Safety Switch
May 27, 2008

MY RELIGION IS THE SMALL BLOCK V8 AND COMMANDMENTS ONE THROUGH TEN ARE NEVER LIFT.

Pillbug

Orzo posted:

Can anyone recommend me a series of good SlimDX tutorials?
I know a few of the guys who are working on SlimDX; I think they generally assume you already know how to use DirectX and can just take the native code ideas and use their wrappers instead.

I think there are some in development, but I don't know specifically of any - just take a look at the normal DX documentation and experiment with converting C++ examples (like the ones in MSDN) to C#.

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!
Thanks. I'm finding that Managed DX tutorials are fairly easy to translate..

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice
I'm not sure this goes in here but I'll take a stab. I've currently been modding minecraft using a plugin system introduced by another user who rolled his own API for this game. I've written some pretty cool stuff like floodgates, hearthstones, fishing, and an in game economy.

The problem is that I know poo poo all about game design and I'd really like things to be balanced. Are there any really decent texts on the game design aspect? I want the game to be fun but I don't want users to play for 8 hours and end up with a boat load of cash. My in game store really isn't pulling as much money out of the world as I thought it would.

hayden.
Sep 11, 2007

here's a goat on a pig or something
Give me your email, I got stuff for you.

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice

hayden. posted:

Give me your email, I got stuff for you.

:woop: poemdexter at gmail

pseudorandom name
May 6, 2007

When they have a boatload of diamonds and steel and whatnot spawn an army of Creepers.

When your players complain, explain that the point of Minecraft is to beat the hubris out of them.

If they keep whining, point out that the Turtles in Time arcade machines would explicitly kill you with a giant bomb if you managed to survive for more than 5 minutes in order to suck the quarters out of you.

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice

pseudorandom name posted:

When they have a boatload of diamonds and steel and whatnot spawn an army of Creepers.

When your players complain, explain that the point of Minecraft is to beat the hubris out of them.

If they keep whining, point out that the Turtles in Time arcade machines would explicitly kill you with a giant bomb if you managed to survive for more than 5 minutes in order to suck the quarters out of you.

An excellent suggestion, but I was looking for more balancing suggestions instead of just killing everyone on the server. I can already spawn creepers at people's positions modded in.

slacjs
Feb 27, 2009

I have 2 questions I hope you guys can answer for me. It's not a question about games but building these things should be similar to building games.

I have 2 pieces of software to produce for college. One is a physics package designed to let kids learn the basics of physics and another is a direct manipulation to teach people how to make a pizza.

For the first piece, I'm looking for a graphics library / engine. I've been playing with HGE but it looks like support is horrible for it and there's some issues with vs2008. I've also considered pygame and FlatRedBall for XNA. I was wondering if any goons could give me some insight into these?

For the second piece, code isn't important. I will be marked on the application, not the code so I was wondering if there are any programs which let you build UI based software quickly without having to worry about code? I've read in this thread things like Game Maker but are there any free options?

Thanks!

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!
XNA is very easy to use. Play around with it for a few hours and see if you like it. I know you didn't ask for it, but if you want a 2D physics engine that works well with XNA, try the Farseer physics engine.

I don't have any insight for the 2nd question though, sorry!

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.
Seconding that XNA is pretty easy to use if you are OK with your applications running on Windows only. The new XNA 4.0 version came out recently and is somewhat confusingly bundled into Windows Phone Developer Tools over at the new AppHub site. I don't know what the hell their marketing department was thinking with that name, but it does generate Windows applications in addition to the phone stuff.

XNA doesn't support UI elements directly, but XNA Simple Gui and xWinForms can generate form-like interfaces.

PDP-1 fucked around with this message at 18:04 on Oct 18, 2010

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!
It is also possible to bind the XNA device to a Windows Form. It's not out of the box, but if you search you can find a downloadable example of how to do this. It's not particularly difficult.

George Kaplan
Mar 12, 2006

I've done a search and can't find anything. Is there somewhere I can find goons with XBL Creators Club memberships to discuss a game I'm working on? Just need to get an opinion on what direction I should take it in.

Also:

Fragaroc posted:


I have 2 pieces of software to produce for college. One is a physics package designed to let kids learn the basics of physics and another is a direct manipulation to teach people how to make a pizza.

Thanks!

Download the Farseer example codes - both simple and advanced - and you'll have frameworks and code examples for everything you could need for the first project.

As for project 2, my ex was manager of a Pizza Hut. Combining this discussion with my knowledge on the hazards of pizza placement, I'm picturing a fun Farseer-based physics game where you try and place the toppings with the correct spread and pattern against the clock, but they slide around as you move/spin the pizza.

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.

George Kaplan posted:

I've done a search and can't find anything. Is there somewhere I can find goons with XBL Creators Club memberships to discuss a game I'm working on? Just need to get an opinion on what direction I should take it in.

You could try asking in the Xbox Live Community Games thread. There have been several people who posted their own games there and reviewed each other in the past.

PnP Bios
Oct 24, 2005
optional; no images are allowed, only text


A doom-a-like I've been working on in my free time with C# and OpenTK

Needs .NET 4 to run, haven't tested it under mono, but give it a test run if you feel like it.

ASDW - move
ESC - quit
Mouse - move

I doubt it will work on Linux since I had to use some p-invoke to handle the input.

http://dl.dropbox.com/u/2126236/Sandbox2.1.zip

Madox
Oct 25, 2004
Recedite, plebes!

George Kaplan posted:

I've done a search and can't find anything. Is there somewhere I can find goons with XBL Creators Club memberships to discuss a game I'm working on? Just need to get an opinion on what direction I should take it in.

I have XBL Creators Club membership. What kind of discussion would you like. I have PM if you want to use that. I've worked at a game place in the past and fiddle with my own projects, but I'm no expert.

Visible Stink
Mar 31, 2010

Got a light, handsome?

For Windows controls in XNA you could take a look at this.

http://www.c-sharpcorner.com/UploadFile/iersoy/256/Default.aspx

Adbot
ADBOT LOVES YOU

dizzywhip
Dec 23, 2005

I'm trying to come up with an algorithm to solve a problem that I've never come across before. The situation is thus:

I have a 2D grid of cells. Any number of cells can be selected in any shape or pattern. I need to create an algorithm that will partition an arbitrary selection of cells into a reasonably small set of rectangles. To illustrate the situation, here's an image:



The selection on the left should be partitioned into something like the 6 rectangles on the right.

Brute force approaches are pretty straightforward, but I need this to be fast. It doesn't need to be the smallest possible set of rectangles, just reasonably small.

Does this problem or algorithm have a name? I've been trying to google it with no luck.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply