Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: The Concept of Entities -- Can't wrap my mind around it.

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default The Concept of Entities -- Can't wrap my mind around it.

    Hey, I've been learning java for a while, and I have some experience modding other games made in Java, and I'd like to make my own game. I feel I've learned enough to get started, but there's one thing that I can't seem to wrap my mind around:

    The concept of entities.

    Specifically, the concept of creating an object/entity with its data, and then saving and loading this data from a file that can't be easily edited by the user.

    Does anybody know a good tutorial about this, or can help me directly?

    Just to clarify, I'm talking about things like the blocks and mobs in minecraft, created by the game as it goes, and with properties that can be remembered upon re-opening the game.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: The Concept of Entities -- Can't wrap my mind around it.

    You should read up on Object oriented programming (OOP). There are many books and papers on the topic.
    Start with Wikipedia and Google for an unending list of sites to read.

  3. #3
    Member
    Join Date
    Jun 2011
    Posts
    182
    My Mood
    Where
    Thanks
    15
    Thanked 8 Times in 8 Posts

    Default Re: The Concept of Entities -- Can't wrap my mind around it.

    An entity is just defined by its own object. For instance, I can't guarantee this since I haven't looked at Minecraft's source code, but I'll bet you that the creeper has its own class. Its just an object.

    You can save that object using serialization. Check the java.io package of Object I/O streams.

    I don't know how Notch designed his implementation with block data, but it has to be either a serialized object or just bytes/number values written to a file that the program parses.

    It's all up to YOU how you want to implement the saving and loading of data. There are tons of methods to doing so. You can come up with your own file format if you want...

Similar Threads

  1. Java oops concept video for 10 min
    By jessie143143 in forum The Cafe
    Replies: 1
    Last Post: October 10th, 2011, 06:50 AM
  2. Need help with a interface concept
    By drakenlord in forum Object Oriented Programming
    Replies: 2
    Last Post: September 13th, 2011, 02:17 PM
  3. Doubt in Encapsulation concept
    By nareshn in forum Object Oriented Programming
    Replies: 1
    Last Post: January 19th, 2011, 02:20 AM
  4. Why wont the Button wrap?
    By Taylorleemusic in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 1st, 2010, 12:03 AM
  5. [SOLVED] The concept of Server and Client
    By rendy.dev in forum Java Theory & Questions
    Replies: 3
    Last Post: January 18th, 2010, 04:13 AM