Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 108 109 [110] 111 112 ... 795

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 815096 times)

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1636 on: February 20, 2012, 09:24:06 pm »

I'll try it out in a few things when I get off work.

That is pretty cool.  Is it just random piano notes?  Sometimes I start to think I can hear a pattern, but I don't trust my brain enough to believe it.   :P
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Willfor

  • Bay Watcher
  • The great magmaman adventurer. I do it for hugs.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1637 on: February 20, 2012, 09:35:12 pm »

There's a pattern, but it's per song. Basically, the sim people who wrote the songs have preferred notes and intervals. They start on a preferred note they raise or lower the next note by their preferred interval until they have something. There is some random deviation, but only for flavor. Then the culture that they come from goes through the song, and looks for its preferred notes and intervals. Songs are rated by how much they conform to those rules, and are put on a list that's sorted. The Top 10 are the 10 songs that conformed to their culture's ideals the most, and captured the essence of what they liked listening to.

Unfortunately, the rules of what each culture likes are randomly generated... So their liking something does not immediately it's suited for human ears.
Logged
In the wells of livestock vans with shells and garden sands /
Iron mixed with oxygen as per the laws of chemistry and chance /
A shape was roughly human, it was only roughly human /
Apparition eyes / Apparition eyes / Knock, apparition, knock / Eyes, apparition eyes /

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1638 on: February 20, 2012, 10:04:48 pm »

Crazy.  That is pretty detailed.

---

On my roguelike/dungeon management project I implemented a basic item system today.  My first implemented item was corpses.   :P

My infrastructure is starting to get a bit unmanageable again.  I think soon I'm going to have to refactor things so that spawning monsters, items and constructions is a bit more streamlined. 
« Last Edit: February 20, 2012, 10:07:58 pm by Levi »
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1639 on: February 20, 2012, 10:08:25 pm »

For bay12? It will be detailed once you can figure out the likelihood of an artist having a drug addition based on what genera they are in.

EDIT:
So I'm messing around in XNA again... Who says c# isn't portable?
Spoiler (click to show/hide)


EDIT2: Goddammit!!!!!!! C# has a truncated modulus operator, not floored like I want it to. Why can't it do the exact thing I want in the exact way I want in the exact place I need it 100% of the time.

malloc

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1640 on: February 21, 2012, 06:17:06 am »

So I'm messing around in XNA again... Who says c# isn't portable?
Spoiler (click to show/hide)
.

The C# specification is open source, so yeah, it's technically portable if people intend to implement the specification. But c# is more or less useless without .NET, which is sadly only has a partly open specification. As far as I understand, only the base components can be implemented, while more advanced stuff (GUI, web all that good stuff) is proprietary.
Yes, I know it's weird, but live with it.

Also, what you are showing off is the portability of XNA? XNA is about as portable as M$ intends it to be. Which is actually not so little considering they made a console, a mobile OS and a desktop OS (Let's not forget that Zune thingy), all of which support XNA.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1641 on: February 21, 2012, 08:04:30 am »

Texture management. Am I doing it right?

So I receive a Material. It has a basetype (rock/skin/metal/bone/etc), a status (solid, liquid, powder, gaseous) and zillions of other stats (density, hardness, shininess etc).
This needs a texture, and for this I have several texture generators prepared. To choose which one, I pass the material through a list of generators, and the first that claims it, gets it. So I pass it to PowderGenerator, that gives it a powder-texture if it was powdered, and if not pass it on to the next which is a solidIngeousRockTextureGenerator or something. I don't know if this is a good pattern, though. It seems... fragile, too dependent on the order and on the behaviour of the other generators.

Anyone got a better idea?
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

PxiePip

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1642 on: February 21, 2012, 08:34:56 am »

This thread is wonderful, all your tutorials are excellent, please continue!
« Last Edit: July 31, 2012, 12:20:04 pm by PxiePip »
Logged

malloc

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1643 on: February 21, 2012, 09:04:25 am »

Anyone got a better idea?
Rather than matching material names from a list of generators. Maybe each material should just store a list of generators. Much like a cooking list, add some noise, add some cracks, add something else. This way you are not dependent on order, and you have much more control over how the output will look.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1644 on: February 21, 2012, 09:58:34 am »

That is an option, except... that the materials themselves are unique per "real world object". So the head of a hammer would have Metal type #345, Solid, Smoothed, Tarnished #0.5 and maybe some other modifiers. This gives me a combination of Material, Texture and Shaders (so it's not just texture we're talking about, eventually) that I can render. These are gotten from memory, disk, or generated on the fly.

The generators have a function
bool criteria(Material*);
Which returns true if that generator thinks he can provide a texture for that specific material.

So I get it like this now (filler means generator, texturefillers is a linked list of them):
Code: [Select]
NTextureFiller NMaterialManager::getTextureFiller(const NMaterial* mat){
  for(auto i : texturefillers){
    if(i->criteria(mat)){
      return *i;
    }
  }
  return null;
}
But this means if an early one is too greedy, a later one might not get it's deserved turn, or if the order is slightly wrong it fails, etc., so it's kind of fragile like that.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1645 on: February 21, 2012, 10:17:57 am »

Texture management. Am I doing it right?

So I receive a Material. It has a basetype (rock/skin/metal/bone/etc), a status (solid, liquid, powder, gaseous) and zillions of other stats (density, hardness, shininess etc).
This needs a texture, and for this I have several texture generators prepared. To choose which one, I pass the material through a list of generators, and the first that claims it, gets it. So I pass it to PowderGenerator, that gives it a powder-texture if it was powdered, and if not pass it on to the next which is a solidIngeousRockTextureGenerator or something. I don't know if this is a good pattern, though. It seems... fragile, too dependent on the order and on the behaviour of the other generators.

Anyone got a better idea?
So if I understand it correctly, you have an n-dimensional property space and each generator occupies a certain hypervolume in your property space? You could describe your material as a point in your property space and then use any collision detection method to check which generator covers that point. The one you're currently using is the old-fashioned "check every single one of them and return the first one that fits", but, depending on how your problem space is covered, that may not be the most efficient one (although it is the simplest one. See This wiki entry for more examples of possible spatial indexing schemes)


Now, there's of course the problem of handling overlapping generators. Ideally you'd want to pick a random one, to give each one of them equal chance, or you'd use a biased random selection if you want to give one more chance than the other, but again, depending on your indexing scheme that may be too complex. One option would be to give each generator a random number and give the lookup function an additional randomly generated number and then pick from all the generators that overlap your material the one with the id that is closest to the random number supplied, but you'll have to make sure that this is unbiased, as random numbers in the range of [0...n] and id's in the same range will give more weight to the center of the range than to the edges.
« Last Edit: February 21, 2012, 10:26:48 am by Virex »
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1646 on: February 21, 2012, 11:07:04 am »

... or you nail it and give an awesome answer, because that's exactly what I'm doing. :)
The indices you linked to are based on automatic grouping of n-dimensional point data, though, while I predefine my groups and their shapes, in non-uniform dimensions (some int (enum), some double, some bool), and then match my points on that map. Maybe some kind of k-d tree with volumetric leaves... I've got reading to do, thanks!
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1647 on: February 22, 2012, 05:05:30 pm »

So, I've come to a terrible disagreement with a coworker.

When using the MVC architecture, I argue that the bulk of the business logic should be broken down and handled by the models, relying only on the controller to pull things together and pass messages. He thinks the controllers should handle the bulk of the business logic.

These views are clearly incompatible. I don't know what we're going to do, but I'm guessing it's gonna turn into a big mess. :/

At the very least we should probably stop arguing about it in front of the boss...
Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1648 on: February 22, 2012, 05:12:26 pm »

So, I've come to a terrible disagreement with a coworker.

When using the MVC architecture, I argue that the bulk of the business logic should be broken down and handled by the models, relying only on the controller to pull things together and pass messages. He thinks the controllers should handle the bulk of the business logic.

These views are clearly incompatible. I don't know what we're going to do, but I'm guessing it's gonna turn into a big mess. :/

At the very least we should probably stop arguing about it in front of the boss...

Compromise.  Put all the business logic into the views.   :P

(just kidding, please don't)
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #1649 on: February 22, 2012, 05:14:54 pm »

From an MVC standpoint, the model IS business logic, not just a data store. You are right, he is wrong.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.
Pages: 1 ... 108 109 [110] 111 112 ... 795