Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (753)
Games in Android Showcase (228)
games submitted by our members
Games in WIP (842)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  my java world project  (Read 1464 times)
0 Members and 1 Guest are viewing this topic.
Offline SwampChicken
« Posted 2008-01-24 02:28:21 »


I'm not very articulate but I will try my best to describe what I'm trying to do.

I'm trying to build a world in java, a world where I can work on pieces/objects (by coding on underlying attributes and/or behaviour) and plug them in (at any time) and watch their interactions which each other.

I intend for my movable "objects" to need only the most basic underlying properties like position / speed / health & temperment.
(temperment being the thing I would adjust differently with different object types)

Once created, I don't want to 'stop' the world (ie: recompile etc), but I want the ability to work on new objects at a later date and introduce them when I want. I want to leave my world on always (24/7) and in the meantime, when I code up new 'things' I can introduce them somehow to the world and let them roam free...

I don't want fancy graphics.
No intention for any network stuff or anything like that. (actual intention is more of a personal petri-dish. Wink )
The 'world' can be a simple black jframe/jpanel.
Object will be a represented graphicly by a single moving pixel. (different object types to be different colours)
I want  it to be turn-based, so an engine/heartbeart simply lets each 'object' take it's turn.
I also need some type of textfield or flat-file that logs events... (for when interactions occur when I'm asleep)
Other than the 'world' panel, I need some open-file dialog? or some component as a facility to 'introduce new objects... (or maybe just use a menuitem to a dialog?)

Anyway... that above isn't too hard to figure out...

...which brings me to the crux of my problem:

What I don't understand is how I would design the infrastructure to 'load' new obejcts into my 'world' once the world is running... I don't know how, or even if I can do this??

Offline Noya

Senior Newbie

« Reply #1 - Posted 2008-01-24 13:41:46 »

If I get you right, you want to dynamicly load java-code / classes at runtime? I'm not into that, but I think I can give you some pointers: The java ClassLoader provides methods for loading classes at runtime. After loading a class you use a concept called reflection to access members and methods of the loaded class. I'd suggest to write an interface that all objects implement, so you can load them, cast them to that interface and call the interface-methods to move / place / whatever the object.

If I got you wrong and you just want to load objects with different properties (not behaviour), then you should just write conifg-files for those objects and load these.

What you also could do is to make a regular backup of the complete world state. To introduce new objects you would just save the world-state, recompile and restart your project, and reload the world-state again. Even if you don't want to introduce objects this way, a regular backup is important, as you don't want to loose the evolution of your 24/7 world just because of a bug in the code or something Smiley
Offline SwampChicken
« Reply #2 - Posted 2008-01-30 02:13:13 »

Ok, thanks for the tip Noya.
I will look into some examples on 'Reflection' and try to code something up.
Pages: [1]
  ignore  |  Print  

nelsongames (19 views)
2018-04-24 18:15:36

nelsongames (17 views)
2018-04-24 18:14:32

ivj94 (608 views)
2018-03-24 14:47:39

ivj94 (53 views)
2018-03-24 14:46:31

ivj94 (401 views)
2018-03-24 14:43:53

Solater (66 views)
2018-03-17 05:04:08

nelsongames (111 views)
2018-03-05 17:56:34

Gornova (176 views)
2018-03-02 22:15:33

buddyBro (747 views)
2018-02-28 16:59:18

buddyBro (94 views)
2018-02-28 16:45:17
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!