My friend and I are in the process of build a MUD in java. We took Java in highschool, he is continuing with computer science in his college, I am not. I am surprised how much I do remember, but there is a lot I have forgotten.

Previously my friend and I decided to create an Array of room objects, where each room is given a four digit ID, which is its place on a four dimensional grid (X, Y, Z, and region).

He is now worried this will take up too much memory and suggests using a linked list in which each node/room is connected with the one that created it.

I would love to hear some thoughts from others. Thank you.

Whether you have an array, linked list, or any other kind of collection, you are only talking about the way the references to the rooms are stored. Java references use no noticeable memory compared to the Objects themselves, so your friend should not worry. Chose your array/list etc based only on how easy it makes the code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.