Topic:   Randomized Game   (Read 23873 times)


0 Members and 1 Guest are viewing this topic.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Randomized Game
« on: June 10, 2010, 11:44:02 PM »
I'm gonna try putting together a randomized game in SC. Not extremely complex, however I'm still working out exactly how to put the code together. I'm trying to make it create a 25x25 grid of rooms that are all connected to the next room without any weird mistakes. (like you exit to the east and the next room has no door on the west. Unless there's an invisible door on purpose hey I think I'll put that in!)
Anyways I figured a good way to do it is (this is what I'm trying to do now) when you enter a room you haven't before THEN the program creates it based on what's next to it. It would prevent insolvable puzzles like the key being in a room behind the door that you cant reach yet.
I'm still trying to get a solid plan for it so I don't screw it up so I could use some tips if anyone has some ideas.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gnome


  • GMG Extraordinaire

  • ***


  • Posts: 1073
Re: Randomized Game
« Reply #1 on: June 11, 2010, 01:55:17 AM »
Simple Doors are sprites.

Then all you have to do as make a 5 line code snippet like

SPRITECOLLIDE 1, 2

door = left
IF door = left THEN
SPRITE 1, 50 50 (basically adds a left door.)

Having the door lead BACK to the old room is a much harder problem.
This Cannot be, NOOOOOOOO!!!!

-Gnomes Cry when the McRib was discontinued again.

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Randomized Game
« Reply #2 on: June 11, 2010, 10:53:39 AM »
i think tiresdragon did this a while back, maybe he'll let you use the sourse

WarHampster


  • GMG Extraordinaire

  • ***


  • Posts: 1501

  • The People's Moderator
    • Arcade of the Absurd
Re: Randomized Game
« Reply #3 on: June 11, 2010, 11:15:23 AM »
All you need to do is pick a spot randomly to be the center of a room, then hollow out everything around it. To make sure everything is connected, hollow out passage ways from the center of all the rooms to the sides of the map and the other rooms. A simple line drawing algorithm should suffice.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Randomized Game
« Reply #4 on: June 11, 2010, 03:12:26 PM »
I'm not quite following you WarHampster. you mean draw lines between rooms that are already there?
Also a big problem is that I need an easier way to keep track of the details of each room without making thousands of variables. (or 15 different arrays.)
« Last Edit: June 11, 2010, 03:21:51 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Randomized Game
« Reply #5 on: June 11, 2010, 05:43:16 PM »
Create a custom class to hold all individual room data.
Oh wait. Sc doesn't have those.
You're going to have to force through it.


-Gan

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Randomized Game
« Reply #6 on: June 11, 2010, 06:00:15 PM »
...or tires can just tell you how he did it
« Last Edit: June 11, 2010, 06:00:41 PM by EqwanoX »

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Randomized Game
« Reply #7 on: June 11, 2010, 06:22:24 PM »
TD used an ingeniously simple "edge joining" routine which rewrote the collision values of two ajoining edge tiles to make them traversable. The collision map of the rooms themselves weren't randomly generated, just picked randomly from a predefined list of 20 or so variants. It's a really clever and effective method that could easily be reproduced on a large scale.
I survived the spammage of 2007

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Randomized Game
« Reply #8 on: June 11, 2010, 08:42:22 PM »
why rooms? why not just make one large randomly generated scrolling map

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Randomized Game
« Reply #9 on: June 11, 2010, 08:59:48 PM »
because I've never managed to make a non-scrolling map yet. ::)
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

GMG Mike


  • Administrator

  • GMG-er

  • *****

  • no avatar

  • Posts: 536
    • mikerichardson.name
Re: Randomized Game
« Reply #10 on: June 11, 2010, 09:26:36 PM »
Quote
Create a custom class to hold all individual room data.
Oh wait. Sc doesn't have those.
You're going to have to force through it.

Dude, we get it, there's no classes in SC. Obviously you've evolved past SC so just leave it alone. It's a free product that I work on in my spare time and when you write stuff like that it's not encouraging at all.
« Last Edit: June 11, 2010, 09:27:22 PM by Mike_Richardson »

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Randomized Game
« Reply #11 on: June 12, 2010, 12:38:15 PM »
mikes been touchy latley. but it is annoying when people diss sc, but it can also be an unexpected compliment that theyre compareing sc to objective c. maybe i should just remake the irpg in sc and make it even better, lol
« Last Edit: June 12, 2010, 12:46:19 PM by EqwanoX »

WarHampster


  • GMG Extraordinaire

  • ***


  • Posts: 1501

  • The People's Moderator
    • Arcade of the Absurd
Re: Randomized Game
« Reply #12 on: June 14, 2010, 12:31:27 PM »
Quote
I'm not quite following you WarHampster. you mean draw lines between rooms that are already there?
Also a big problem is that I need an easier way to keep track of the details of each room without making thousands of variables. (or 15 different arrays.)

1. Randomly decide on a number of rooms and DIM an array of double that number.

2. Go through the array and put random x and y values in each field of the array.

3. Go through the array and use every pair of fields (ex. (1) and (2) would be a pair) as the coordinates of the center of a room. I assume you have a tilemap done already, carve out all the room centers.

4. Carve out a box of random size around all the room centers.

5. Use a line drawing algorithm to draw lines between all the room centers, storing the coordinates of the points in the lines in an array.

6. Carve out all those points.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Randomized Game
« Reply #13 on: June 14, 2010, 02:55:11 PM »
Quote
mikes been touchy latley. but it is annoying when people diss sc, but it can also be an unexpected compliment that theyre compareing sc to objective c. maybe i should just remake the irpg in sc and make it even better, lol
Good luck with that. ;D
...I like SC but I am still thinking about other languages. I noticed Gan put up tutorials but I don't know if I can get the programs I need.
« Last Edit: June 14, 2010, 02:57:30 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

GabrielCA


  • GMG-er

  • **

  • no avatar

  • Posts: 224
Re: Randomized Game
« Reply #14 on: June 14, 2010, 04:53:40 PM »
Randomness is always a hot topic.

Quote
BTW About the whole random thing :
One thing I always found interesting is that computers, being entirely logic-driven, are actually incapable of generating truly random patterns.

See for example :
http://www.freepatentsonline.com/6215874.html
(Quote : "Unfortunately, computers are only capable of generating pseudo random numbers. These numbers may follow known sequences for they may rely on date and time information making them predictable. ")
« Last Edit: June 14, 2010, 04:53:54 PM by GabrielCA »
Creator of the deprecated plugin KeyDetect (2005)