GPWiki.org
GPWiki.org
It is currently Fri May 24, 2013 11:15 am

All times are UTC




Post new topic Reply to topic  [ 17 posts ] 
Author Message
 Post subject: MUD Level Seeding
PostPosted: Sun Feb 15, 2009 8:24 pm 
Harmlessness does no harm
User avatar

Joined: Tue Sep 14, 2004 8:37 pm
Posts: 3809
Location: Ferriday, LA, US
Hey guys, just wanted to throw a suggestion your way.

How about using a seed scheme for generating level layouts? The idea is that each generated level would have a number associated with it (the seed). The seed would normally be chosen at random, but if a group wanted to play the same layout again later, they could enter the seed of that level.

Most other things could still be more random (encounters, etc.), but I think having the layout of a level be seed-based might be an idea. Thoughts?

_________________
What most people don't understand about "enlightenment" is that it is not an end-goal; but where you find yourself just before taking a new "first step."


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 15, 2009 9:35 pm 
P2k
User avatar

Joined: Tue Aug 23, 2005 5:11 am
Posts: 2145
Obviously you need to use seeds. Otherwise you have to send a lot of information about the level over the network. But I don't think letting people pick seeds is a good idea. It would be easy to cheat to get specific items to drop or keep replaying an imbalanced (too easy) level.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 1:30 am 
Harmlessness does no harm
User avatar

Joined: Tue Sep 14, 2004 8:37 pm
Posts: 3809
Location: Ferriday, LA, US
Struan wrote:
Obviously you need to use seeds. Otherwise you have to send a lot of information about the level over the network. But I don't think letting people pick seeds is a good idea. It would be easy to cheat to get specific items to drop or keep replaying an imbalanced (too easy) level.


Well yeah, that's why I said it would be mostly for level layout. The rest of the stuff (items, encounters, et al) would be generated via a clock-generated seed.

The reasoning is mainly for when someone finds a level built in a way that's really groovy, they can opt to play through that level again. If you wanted to though, you could have everything (including item drops and encounters) the same, and just make the program not save the player's progress when using their own seed. It would be a good option for single-player "quickplay" and allow the player to "do over" a level he or she has trouble with, or just really likes.

edit: Also, you probably want to send the level data anyway, since (AFAIK) different CPU architectures produce different random numbers, even if a seed is used.

_________________
What most people don't understand about "enlightenment" is that it is not an end-goal; but where you find yourself just before taking a new "first step."


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 1:47 am 
Dexterous Droid

Joined: Fri Aug 19, 2005 10:34 am
Posts: 3650
theraje wrote:
Also, you probably want to send the level data anyway, since (AFAIK) different CPU architectures produce different random numbers, even if a seed is used.


You wouldn't need generate typical random values, but rather just alter the value. All you would need are bit shifts, XOR, AND, OR, and NOT to generate good enough values, and all of those should result in the same values no matter the processor. Then to make use of mod, which I am assuming is used for generating the maps, just make sure it takes into account endianness.

In any case, I don't see it being difficult at all to, given a seed value, generate the same map across all supported platforms.

_________________
NetGore - Open source online RPG engine


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 3:08 am 
Fish Doggy
User avatar

Joined: Mon Jun 27, 2005 4:50 pm
Posts: 1705
Location: Ontario, Canada
Seeds are an obvious must. :D

_________________
In brightest day, in blackest night. No evil shall escape my sight. Let those who worship evil's might, beware my power... Green Lantern's light!
Twitter!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 3:54 am 
P2k
User avatar

Joined: Tue Aug 23, 2005 5:11 am
Posts: 2145
theraje wrote:
Also, you probably want to send the level data anyway, since (AFAIK) different CPU architectures produce different random numbers, even if a seed is used.


.NET's Random class is not CPU dependent and is more than ample for any random level generation purposes.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 4:08 am 
King Code Monkey
User avatar

Joined: Wed Sep 01, 2004 3:05 pm
Posts: 11182
Location: Abingdon, MD
While this is a cool idea, it's outside of the scope of the project.

_________________
Bored? Head on over to my blog and see what I'm up to.

Microsoft XNA MVP


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 10:12 am 
Fish Doggy
User avatar

Joined: Mon Jun 27, 2005 4:50 pm
Posts: 1705
Location: Ontario, Canada
What!? How? Any proper level generator would/should have this built in by default.

_________________
In brightest day, in blackest night. No evil shall escape my sight. Let those who worship evil's might, beware my power... Green Lantern's light!
Twitter!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 10:13 am 
P2k
User avatar

Joined: Tue Aug 23, 2005 5:11 am
Posts: 2145
NowSayPillow wrote:
What!? How? Any proper level generator would/should have this built in by default.


Agreed. It is not like it is more effort to do (it is actually less since you don't have to come up with a way to store or transmit level data).


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 12:11 pm 
King Code Monkey
User avatar

Joined: Wed Sep 01, 2004 3:05 pm
Posts: 11182
Location: Abingdon, MD
It is more effort in that you have to give the player a way to indicate that he wants to replay a level. As for the level generator having this by default I haven't seen the code yet so don't know how Jasmine is doing it.

I'm not saying it can't be done, but for now it's not part of what the project is supposed to do. The project needs to get done without any scope creep.

_________________
Bored? Head on over to my blog and see what I'm up to.

Microsoft XNA MVP


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 9:25 pm 
Fish Doggy
User avatar

Joined: Mon Jun 27, 2005 4:50 pm
Posts: 1705
Location: Ontario, Canada
Even if they can't enter a seed to be able to play the level again the level should still be created using a seed. If only to make it easier to send the map data over the network.

_________________
In brightest day, in blackest night. No evil shall escape my sight. Let those who worship evil's might, beware my power... Green Lantern's light!
Twitter!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 9:40 pm 
King Code Monkey
User avatar

Joined: Wed Sep 01, 2004 3:05 pm
Posts: 11182
Location: Abingdon, MD
As Jasmine already has code to generate the levels (and pretty good looking ones at that!) we'll have to wait and see what the code looks like.

_________________
Bored? Head on over to my blog and see what I'm up to.

Microsoft XNA MVP


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 9:54 pm 
P2k
User avatar

Joined: Tue Aug 23, 2005 5:11 am
Posts: 2145
Even if his code is not set up properly for seeding, I will happily modify it to allow seeding. That was my primary interest in working on the random level generator anyway.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 11:44 pm 
Fish Doggy
User avatar

Joined: Mon Jun 27, 2005 4:50 pm
Posts: 1705
Location: Ontario, Canada
Struan wrote:
Even if his code is not set up properly for seeding, I will happily modify it to allow seeding. That was my primary interest in working on the random level generator anyway.

This.

_________________
In brightest day, in blackest night. No evil shall escape my sight. Let those who worship evil's might, beware my power... Green Lantern's light!
Twitter!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2009 1:59 pm 
Corpse Bride
User avatar

Joined: Tue Jul 01, 2008 11:44 pm
Posts: 2217
Location: England
Here.. I'm tired of holding onto this thing :x... I can't do anymore till Machaira decides what strength the monsters are going to be, and/or builds a way of testing/tweaking them.

It should be fairly simple to convert, although I think some variables will no doubt need converting from singles to integers. And a random number routine making for seeding.

Struan, the random numbers don't need to be that random, because the dungeon layout is kind of chaotic. I would think a simple
Code:
Public Function rnd()
seed = (a*seed+b)%m
rnd = seed/m
End Function

to be sufficient.


Last edited by Jasmine on Sat Aug 20, 2011 2:55 pm, edited 3 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2009 7:00 pm 
P2k
User avatar

Joined: Tue Aug 23, 2005 5:11 am
Posts: 2145
I think I get what it is doing, but could you add some comments on the variables just so I am sure what each variable is supposed to represent.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2009 7:19 pm 
Corpse Bride
User avatar

Joined: Tue Jul 01, 2008 11:44 pm
Posts: 2217
Location: England
Struan wrote:
I think I get what it is doing, but could you add some comments on the variables just so I am sure what each variable is supposed to represent.


I will edit that now.

Also, the random number function described works. I've just tried it, so you can add the seed as an argument to the generator function. :)


Code:
Dim seed as Long

Function Rand() as Single
a=31
b=7
m=2^16 - 1

seed=(seed*a+b) MOD m
Rand = seed/m
End Function



edit: (+15 minutes) comments added. I hope that's adequate. Ask any more questions.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group