Sunday, August 21, 2011

Randomness

I stumbled across something entirely by accident that I'm quite happy about while working on a specific event for the game. Basically the game now will preload an event and figure out all the outcomes for the event before you click on a button for the event. This brings up the potential for very randomized events, possibly mazes, occasional random twists, etc.

I know it's nothing revolutionary and I won't rush the utilization of this yet (as I still barely grasp it) but it brings up some very exciting possibilities for future events. Things continue to go fairly well, I'll try to write a full recap on Pornicle's new events (including the Pub and Backwater District) without giving too much away and ramble further about the new event system in more detail.






3 comments:

  1. Interesting... you seem to have worked it out without my help, I would be interested in seeing what your solution was.

    ReplyDelete
  2. It's probably very clunky by programming standards and assured to make any real program vomit with rage but basically I have an object called Location which is tied to a sub-object called ActionButtons (which lists the possible buttons 1 - 12). Each Action Button is then tied to yet another sub object which has an event object. Those event objects can potentially have their own actions (1-12) which are tied to more events and so on.

    In order to insert the data into the event objects, a function is used (with enums to make looking it up understandable for me...probably a better way to do this though lol) to populate the events. This is where I ran into infinite loops with some events as you can probably imagine endless chains of events resulting from some possibilities. I eventually found a way to make these loops stop and it works wonderfully now.

    When a player clicks an action (1 - 12) it then sends the event (and all subsequent events tied to that action) to an object called PlayerEvents. If the event has actions, they appear on the screen. Once a player clicks on an action, (something I named for my own amusement) the nom nom clause eats the the previous event and replaces it with the next event(s) down the chain.

    I hope that makes some sense, maybe you can understand what I was asking a bit better as well :p

    ReplyDelete
  3. Well... there is a more efficent way... and I think I'll implement it for my implementation, essentially you create a collection of all of your events, each of your events declares certain properties... you can then use Linq to query against the collection, so what an event would do is rather than saying this is the tree that's valid from me. It would just query for the next level of the tree when you get there.

    ReplyDelete

Follow us by Email!

Total Visitors