Game Development Community

Randomly Generated DIFs

by Greg Berkhof · in Artist Corner · 07/13/2005 (8:14 pm) · 3 replies

OK, so i picked up a copy of Coded Arms for psp today, and one of the unique (still deciding if i want to call it "cool" yet) features is that everytime you load up the level (weather you are playing again, or trying again after dieing) it is created randomly, so no "level" is ever the same. Since i have been working on a little torque project, it got me thinking how this could be implemented using DIFs. I did a quick search about the subject, but only came up with random terrain, not DIFs, so i apologize if this has been done before. Anyhow, on to how I think it could happen.

First off, this would be for actual interiors, IE buildings you go inside. It makes theroretical sense (to me at least) that if you build, lets say, 100 interiors, and created them so that each had 2 entries, at EXACTLY the same co-ords, as well as the outer shape (shell i guess?) to be the exact same size, you could easily interchange them. The random part is that the insides, walls, rooms, decorations, etc could be different from one DIF to the next. Then, in the mission file, you sorta line up the number of total random difs you want, so that the entries line up with each other. Then when Defining the actual shape, you simply add in the randomize code, to pick a number between 1 and 100. To make it even easier, you name your 100 difs, yep, you guessed it, 1, 2, 3... 100. Then in the actual shape def line, put the same path, but throw in your random number for the actual name of the dif.

Now, just thinking about it while i type, one question comes to mind, and i apologize as, as a torque dev (newbish as i am) maybe i should already know... BUT when loading a mission, does the mission scirpt get loaded before the shapes do? if so, we luck out, as the engine would NOT have to load all 100 difs into mem in preparation for the random code, only the luck of the draw would have to get loaded.

Anyhow, maybe I'll try it out sometime, maybe not... But what do you all think about the idea?

#1
07/14/2005 (1:41 am)
From what I understand it could work. You could probably even call a script to write a .mis before level loading even begins, thus completely negating any need to worry about ever accidentally trying to load any unneeded DIFs.
#2
07/14/2005 (3:31 am)
Perform a Google search for procedural content (generation). There are some pretty nifty papers on the topic out there.

I especially like this article: www.gamespy.com/articles/595/595975p1.html.
#3
07/15/2005 (7:59 pm)
@ Thijs
I finally got around to reading that article you pointed out, very interesting, but seeing how its coming from the creator of simcity, its very beleivable.