Allegro.cc - Online Community

Allegro.cc Forums » The Depot » infinite number of individual foes...

This thread is locked; no one can reply to it. rss feed Print
infinite number of individual foes...
Gabhonga
Member #1,247
February 2001
avatar

okay, let's maybe relax from the hard job of programming and discuss some creative aspects of game creation. For example, I want to enable my game to make every (or almost every) dude running arround in my world look different from all other of the same "type", and I also want it to create these "variations" on the fly, when the object is created...now how achieve that???
once again I think interpolation is the answer, like almost everywhere in multimedia programming. consider a 3d game. there's a race of, let's say, goblins. all goblins look of course, similliar, but I want lots of them to look different without having to model an infinite number of meshes...so I thought about this: the meshes are split into different parts, for each detail, like the ears, one could have two(or more) different versions of different shapes...when a goblin is spawned into the game, the engine first gets some random values and then for each "part" of the goblin an interpolated (morphed) version of that part is inserted into it's mesh...with each of the parameters choosen random, or ranges specified, if you want to fierce muscular looking goblins to protect a door, you just interpolate all parameters as usual, but make shure that the size and "bulkyness" stay in a certain range so they don't look to wimpy...this approach could be used for many other things than just the mesh, animation data (the way the goblin walks), the skin bitmap, his behaviour...all could be a bit randomized, like the levels in diablo, to make each game you play really unique to others...
so what do you think of what one could do to achieve this, and what do you think about my ideas? I canÄt wait to read your opinion!!

--------------------------------------------------------
sigs suck

Sammy
Member #955
February 2001

Sounds good to me! Now let's see some code :D

Bruce Perry
Member #270
April 2000

A little something to think about: the ideal (ie. perfectly beautiful/handsome) face uses the ratio 1:1.618 all over the place. This is the ratio of any side of a regular pentagon to any diagonal. When you smile, the pentagon begins to be visible :-<)
This was on a BBC (British) TV program called "The Human Face" :-)

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

Gabhonga
Member #1,247
February 2001
avatar

Sammy: If I already had the code for that I'd probably be the happiest coder on earth (and a clever one, too)...but sadly this is all theory yet, I haven't tried out such stuff at all...though I agree that it's very interesting :-)
bdavis: yes, that fact is interesting...how mathematic rules and phenomens often hit the "real" world gives me a strange tickle inside my head...
anyway, the approach still has inevitable downsides: for each character that's individual a complete individual mesh has to be stored, so stuff hardly suffers from trading lots of memory to that feature...
nut, what the heck, it would be so very freaky...and implementation (hopefully) a piece of cake!
by the way, I've thought of an applicable approach of that principle to 2d games with bitmapped graphics: again, we've got 2 "states" we've got to interpolate to...we could acchieve this "shape-" interpolation by initially mapping 2d vertices over the bitmaps, and assign texture u/v coordinates according to their momentary position. To outline the important details that would be reshaped: the vertices are moved from their initial positions to resemble each individuum just like in the 3d case...then each individuums 2dmesh is rendered to a memory bitmap by texturemapping the 2d polygons with the sprite bitmap (preferably at least twice the size the sprite uses) and is then downsampled to the needed size to provide some interpolation/antialiasing. this should be impossible to do in realtime, because it's computationally very expensive (every single animation frame!!!), but it could be done at startup, or the process is split up to take place in several frames if a new individuum is urgently needed during game runtime...

--------------------------------------------------------
sigs suck

Jason Heim
Member #484
June 2000

bdavis,
ah you are talking about the golden ratio, or golden rectangle. ever seen the movie pi? there are a lot of other ways to generate that ratio, the pentagram is just the easiest way to describe it.
for instance, if you have a rectangle with the sides in proportion to that ratio, you can remove a square from it whose length is the shorter side, and the piece that remains is another rectangle with the EXACT same ratio, only rotated 90 degrees.
another way to find this ratio is to take the fibonacci sequence (1, 1, 2, 3, 5, 8, 13). as the numbers get higher you can divide the smaller of any two consecutive numbers into the larger and watch the result approach the golden ratio.
for instance, two numbers later in the sequence are 144 and 233 (quoted in the movie). you divide 144 into 233 and you get 1.6180555, which is close to the golden ratio.
yet another way is to use a pie-slice shape of 45 degrees of a circle. take either endpoint on the arc side, and draw a perpendicular line with the other side of the 'slice'. this creates the ratio, the top value is the length of a straight side, the bottom value is the length from the center to the perpendicular intersection you created.
fun fun fun!
jase

Bjorn Hannibal Madsen
Member #1,015
February 2001
avatar

Humm.. I like the idear and with the new generation of grahpics cards (Geforce3) beliveble (a face can have 100+ polys) characters could be generated.
This sounds a bit like RTS game Black&White where the creatures (not the people) shifts form... if thay eat alot they get fat, if they workout(fight?) their muscels gets bigger.. etc.
Compeared to all the amazing cunning hacks that has been made in the past to increase the poly count barrier (1st person shooters), I think that somthing like this would not be as hard as it may seem...

Bob
Free Market Evangelist
September 2000
avatar

I think the biggest problem here is how do you go from x vertecies to y vertecies. The rest is simply interpolation (and a lot of memory). I guess you can look up mesh morphing, but it's not a topic for the feint of heart!
Otherwise, I'd recommend you just forget about mesh interpolation and just use regular mesh combination. For example, you select one mesh for the ears out of a predefined set of 10 let's say, and just stick it to your character as is.

--
- Bob
[ -- All my signature links are 404 -- ]

Gabhonga
Member #1,247
February 2001
avatar

yes, I'd be (not only) a question of proper 3d morphing, that's actually I meant when I said interpolating (but morphing is an interpolation, so what de heck etc.).
anyway, for having the same number of vertices in both models and having them mapped to each other (or by creating the second mesh by dragging the first meshes vertices around a little in the modeller) one would just need to do linear interpolation of the coordinates...okay, that's the basic "morph" effect demopeople often use for their eyecandy. one would just need to expand that concept by grouping the vertices into different relevant detail groups...and these are then individually interpolated...fine, but more work for the modeller guys...
btw, it's not going to be rts, but just a game...it'll be about a little alien (who doesn't morph, however) wandering his strange planet to find out wether there's life on other planets then his own...however, I plan him to find some (maybe even the worst: humans!) other races, so that's what I was looking for: 3 or 4 meshes per race combined together by different coefficients and a little randomness to generate the characters my alien bro's able to interact with...so the algorithm does not need at all to be fast, because it would ne just used for "loading" meshes, so instead of loading the specific mesh of that wimpy little extraterestrial computer specialist one just gives a race and the attribute "tends to look wimpy, blue or green spacesuit, maybe wearing electronic glasses" so the routine matches all parameters... :-) well...anyways, I'll try that sollution, but I guess with real mesh morphing everything would be easieer to create...hehe just give me 2 years and my game will be finished ;-)

--------------------------------------------------------
sigs suck

Araanor
Member #990
February 2001
avatar

To my knowledge, the Fibonacci sequence is the best approximation possible for the golden ratio. You could actually use a exponential sequence, 1.618^x, to approximate the Fibonnaci, with a greater accuracy the further down the sequence you start...
(Where the fuck are those links?! (they were nice too, interesting reads about Fibonnaci and Co.) Bloody looses a treasure everytime Windows needs re-installing (I'm not going to mention how often that happens (Don't you just love nestling??)))

Gabhonga
Member #1,247
February 2001
avatar

yes, the "golden number" caught my interest a while ago, too...though I had no internet, I read it in a big book about lots of mathematical geniusses from the antique until now...I could dig it out if anyone is interested in algos how to create that number, there were lots of different in that book, I think even a better one than fibanocci...
anyways, that magic number doesn't help me in my task of writing an individaualizer(tm)...but it helped me a lot in my aesthetical understanding and improoved my drawing/sketching abilities when it comes to human faces....so it's a "patch" for your brain rather than for your software...but those tend to be the best :-)

--------------------------------------------------------
sigs suck

Dennis
Member #1,090
July 2003
avatar

I also have a good idea for an individualizer...
(Coming up is supposed to be funny...
...I better mention this right now so that
no one may call me psychopathic...)
Ok here we go.
Go out on the street and take a quite "normal" looking guy.
Bring him home and do a 3d scan of his face.
Next slap his face a few times until it looks
a bit different. Then again do a 3d scan...
Do this for every different individual you'd
like to have...
Right now I'm standing in my corner totally
ashame on myself...
It's just the thing that I CAN'T be serious... I'm always babbling shit... please... you must help me!

Tyfer
Member #1,192
April 2001

Actually to do what B&W would be sorta simple, but you've gotta handle the vertices and metrices yourself (already done that? good boy, have a biscuit). What B&W does (and I know this because I've played around with the 3d models and skins :)) Is it has a base model and skin, and another model with the exact same points+vertices but slightly moved, and gets some attribute (such as alignment in B&W) and has the end point/vertice being (where attribute is from 0 to 1):
end point = point 1 * attribute + point 2 * -attribute
And the good news is: no divisons!

Gabhonga
Member #1,247
February 2001
avatar

hey yes, thanks a lot for your feedback...so you, too think it is a good idea...besids the morphing FX can be used for some more madness incorporating the cpu...you know, I think madness is (sometimes, if it goes into the "right" direction...well, who sais what's right and what's wrong anyways???) really beautiful, a lot of significant artists either were already mad by nature or have gotten into that state by manipulating their consciousness with psychoactive substances, like I think Hieroniemus Bosch with his apocalyptic worlds was toxed with some real mean stuff like datura etc...
anyways, the idea of getting some "normal" guy from the street isn't really what I want!
he would just long for beer, and I have none.
he would want to watch soccer, but I refuse TV...
he would even long for some cigarettes, just to find the flavour I'm smoking is illegal everywhere with exception of afghanistan(where nobody cares about...) and holland (where people are just a surprisingly bit more liberal than everywhere else.).
another worth thing, how should I explain to him what I plan to do?? and even worse: if I had that "normal" guy running around in my game (when it's finally finished in 5 years...) he would just go insane because of all the funky music and the freaky alien charachters around him!!! so I'd just better keep poor "Joe" (or call him "bob" or "bill" or "hannes" or "gernot") out of my bussiness and let him sit, peace in mind, in front of his endumbing TV and watch his goddamn match of soccer (and about 536 commercial spots in between his subcounciousness soaks like a dry sponge does with water, just to release it whenever he should happen to visit a grocery store). So that guy would be shurely lost if he ever knew about my existance!!!!
but by the way, I found just morphing the meshes a bit boring (yes, I'm doing everything myself, exept for timer, sellecting gfx mode, putpixel, and the scanline funcs from allegro(dos version)...well, okay, I still use the CPU for integer math and the FPU for floating point arythmetics etc....but I guess that's "allowed..."), so I'm right now thinking about how to do it in more interesting ways...like splitting the mesh up into pyramids to let them rotate three times around different axxi, change their color wikkedly in between and come out as an completely different object!!(wich ideally maybe even looks a bit trianglish, not like in goddamn real live, and with more colors..)
anyway, I'm so damn tired I'm gonna go to sleep first before trying on to code such stuff...you know I just helped my sister to move(into a different flat), so I was just stepping up 85 steps and then I was stepping them down again, carrying somethng really heavy...and this for about 5 hours...damn, I'm wasted...so cheers to all the madmen, cosider: you're not alone...

--------------------------------------------------------
sigs suck

Gabhonga
Member #1,247
February 2001
avatar

btw.: duh, still 2 multiplications...can't one do it with LEA and some bisshifts ? ;-)
agh, just don't take this serious, you know, my engine is so slow :-((((

--------------------------------------------------------
sigs suck

Go to: