Blogus Maximus

Rubbing people the wrong way since 1970...

  Home  |   Contact  |   Syndication    |   Login
  1350 Posts | 10 Stories | 2173 Comments | 1336 Trackbacks

News






Google My Blog

Catch me at: The List!


My InstallScript Utility Belt My Amazon Wishlist
My Standard Disclaimer

Men who feel strong in the justice of their cause, or confident in their powers, do not waste breath in childish boasts of their own superiority and querulous depreciation of their antagonists.
--James Russell Lowell, 1861


Twitter












Tag Cloud


Archives

Post Categories

Image Galleries

Blogs

Code Camps

CTown Geeks

Geeky Webcomics

High Geek

Magenic Blogs

Microsoft Blogs

My Articles

My Sites

PodCasts

UG

XNA

I'm keeping to my original decision. I haven't looked at any game development stuff at all, with the exception of some late-night work on Heroic Adventure! (as I said I would.) 

For example, I haven't looked at the new XNA refresh, though if you would like to, it's being splashed across every mildly game dev related blog between here and Seattle. You should have no trouble finding it.

Most of my days lately, when not being threatened by crazed store owners, I have been studying my butt off for the new .NET 2.0 certs. I'm using a combination of books and Transcenders and I feel like it's going fairly well. Since I already have my MCSD.NET, I only need to take two upgrade exams.

Damn there's a lot of stuff in the upgrade exams. Between the flashcards and the practice exams, I've crammed so much stuff in my head it's about to explode.

So enough about that for now. I'm curious about something...

In Heroic Adventure!, I have an array where each cell contains information about the corresponding location on the map. One of the data items in the cell is Monster, which is an integer that corresponds to the index of an array of monster objects. As monsters move about the map, this value moves from cell to cell, and the Monster value of the previous cell is set back to 0. When a monster is killed, the object is removed from the array and the Monster value at that location is set to 0.

Having a separate Monster array makes some things easier, such as handling the Monster turn. I can loop through the Monsters and perform whatever actions, rather than going through every cell of the Map array to see if a monster is there.

So my question is, is this the "right" way to be doing this? Should I be sticking the Monster objects right into the map array, or doing it like I am now, where one array effectively points to the other?
posted on Wednesday, April 25, 2007 12:34 AM

Feedback

# re: keeping my word 4/25/2007 1:27 AM Jason Olson
I would personally store the monster objects directly in the map cells. Just storing the indices sounds like premature optimization to me. I think there might be other ways to solve the "turn" issue. Even if you looped through every single item on the map and "updated" just the monsters, that should be fine until you can show that it's a performance problem.

Just my $0.02.

# re: keeping my word 4/25/2007 6:50 AM Sam Judson
You could store then monster object in both places - after all 'objects' are really only reference pointers.

Dim m1 As New Monster()
cell(0)(1).Monster = m1
monsterArray.Add(m1)

You can then access it via the monster array or via the cell property.


# re: keeping my word 4/25/2007 7:14 AM Jay Miller
I kept the information in both places, like Sam suggested, except that I kept a collection of monsters in each cell so I could support multiple monsters in a cell based on their size.

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: