Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4]

Author Topic: Intellectual Property & stuff  (Read 5806 times)

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: Intellectual Property & stuff
« Reply #45 on: December 21, 2009, 08:38:10 pm »

Yes. Python is fast and easy to program, but  runs slowly, but with a few tricks you can do some especialy preformance critical things in c.
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

Savok

  • Bay Watcher
    • View Profile
Re: Intellectual Property & stuff
« Reply #46 on: December 21, 2009, 11:45:27 pm »

Quote from: Savok
Would this be impossible or cause a significant speed penalty if I used Java?
You'll probably want to read up on the Java Native Interface.
Thanks, but I've done that already. I guess a better way to ask that would be "would using a c++ library via the JNI cause a significant speed penalty?"
Logged
So sayeth the Wiki Loremaster!

Toksyuryel

  • Bay Watcher
    • View Profile
Re: Intellectual Property & stuff
« Reply #47 on: December 22, 2009, 03:52:08 am »

Yes. Python is fast and easy to program, but  runs slowly, but with a few tricks you can do some especialy preformance critical things in c.
Try using Stackless. It's very fast.
Logged

Shades

  • Bay Watcher
    • View Profile
Re: Intellectual Property & stuff
« Reply #48 on: December 22, 2009, 04:10:32 am »

Yes. Python is fast and easy to program, but  runs slowly, but with a few tricks you can do some especialy preformance critical things in c.
Try using Stackless. It's very fast.

I found that the fast startup time of python made it good for very small scripts (under a couple of k) and anything bigger the faster interpretation of php made that make more sense, espcially once you have byte code caches. I've not used stackless so I'll have see how it is, I like the mircothread concept though (for similar reasons erlang is fun, but I'll still learning at that)

Perl seems to be faster than either especially with text manipulation stuff but I wouldn't recommend anyone goes and learns that it's not the most friendly language.
« Last Edit: December 22, 2009, 04:12:18 am by Shades »
Logged
Its like playing god with sentient legos. - They Got Leader
[Dwarf Fortress] plays like a dizzyingly complex hybrid of Dungeon Keeper and The Sims, if all your little people were manic-depressive alcoholics. - tv tropes
You don't use science to show that you're right, you use science to become right. - xkcd

Googolplexed

  • Bay Watcher
  • My avatar is of whitespace, Not the firefox logo
    • View Profile
Re: Intellectual Property & stuff
« Reply #49 on: December 22, 2009, 07:19:38 am »

Savok, you don't think the code is great ? Well maybe not looking at it from years of experience or anything, but it takes most people alot more then a few weeks to learn to code somewhat effectively on their own.

Threading, Using Polling, Integration between UI and game-logic. The fact that you care about that's great and its a good thing to think about, But remember its your first small project. Don't be to hard on yourself.

And its great to see a good attitude on the project with regards to it as a learning one. You might need to learn a bit about algorithms before fully attempting it though.
Logged

FlexibleDogma

  • Bay Watcher
  • xGiant Cave Spider Silk Sockx Merchant
    • View Profile
Re: Intellectual Property & stuff
« Reply #50 on: December 22, 2009, 09:04:49 am »

Yes. Python is fast and easy to program, but  runs slowly, but with a few tricks you can do some especialy preformance critical things in c.
Try using Stackless. It's very fast.

I found that the fast startup time of python made it good for very small scripts (under a couple of k) and anything bigger the faster interpretation of php made that make more sense, espcially once you have byte code caches. I've not used stackless so I'll have see how it is, I like the mircothread concept though (for similar reasons erlang is fun, but I'll still learning at that)

Perl seems to be faster than either especially with text manipulation stuff but I wouldn't recommend anyone goes and learns that it's not the most friendly language.

As long as you aren't reading code from someone who believes that "less lines is always better" and loved the Obfuscated Perl Contest Perl really isn't that bad.  Seeing "use strict" at the top of a program should give you a warm fuzzy feeling since it indicates that the programmer wasn't being TOO hacky or lazy.

If you have any interest in systems administration I'd recommend learning Perl, if for no other reason other then you will bump into Perl scripts on *nix boxes fairly frequently.
Logged

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: Intellectual Property & stuff
« Reply #51 on: December 22, 2009, 09:46:37 am »

I just took the opportunity to check out your code Savok. Definitely ahead of the curve for someone with your experience. If you keep writing java (and you should, even if you pick another language to learn and use as well), you should get used to adding javadoc comments to every class and method. This has two advantages, it can help you keep your own code strait for yourself, and it can be used to automatically generate a javadoc website explaining your interface when you get to the point where you are going to want to work with others on a large project.

Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Savok

  • Bay Watcher
    • View Profile
Re: Intellectual Property & stuff
« Reply #52 on: December 22, 2009, 08:10:04 pm »

Savok, you don't think the code is great ? Well maybe not looking at it from years of experience or anything, but it takes most people alot more then a few weeks to learn to code somewhat effectively on their own.

Threading, Using Polling, Integration between UI and game-logic. The fact that you care about that's great and its a good thing to think about, But remember its your first small project. Don't be to hard on yourself.

And its great to see a good attitude on the project with regards to it as a learning one. You might need to learn a bit about algorithms before fully attempting it though.
I just took the opportunity to check out your code Savok. Definitely ahead of the curve for someone with your experience. If you keep writing java (and you should, even if you pick another language to learn and use as well), you should get used to adding javadoc comments to every class and method. This has two advantages, it can help you keep your own code strait for yourself, and it can be used to automatically generate a javadoc website explaining your interface when you get to the point where you are going to want to work with others on a large project.
:D *encouraged*

I tried to do some javadoc comments, but when I run it from the command line it doesn't like that my .java files are sometimes encoded in UTF-8 w/o BOM. (since I'm working with CP437, I have to use a bunch of unicode characters, which are then translated to CP437 for output. This would actually be pretty easy to expand to all of Unicode if I had a tileset.)
I've gotten my most recent work to a point where it's not too embarrassing to show to people; if anybody actually wants to see it (and by the download counter on the last one, it seems they do), they can find it here (source files are inside the jar - open it). I've edited the OP to reflect this.

If you don't mind, I have a short java question whose answer I couldn't find from hours of searching: If you've compiled the program to a .jar, how do you get a list of the files in the .jar? Since the program doesn't know what files are in there and it wants to dynamically load them, this is troublesome.
« Last Edit: December 22, 2009, 08:16:00 pm by Savok »
Logged
So sayeth the Wiki Loremaster!

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: Intellectual Property & stuff
« Reply #53 on: December 22, 2009, 09:13:58 pm »

"Since the program doesn't know what files are in there and it wants to dynamically load them, this is troublesome."

I am not sure I entirely understand your question.

A .jar is just technically a zip file, you can find a list of the files it contains by opening it with any archive viewer.

What is "the program" that can not find the files? your IDE? java? javadoc?
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Intellectual Property & stuff
« Reply #54 on: December 22, 2009, 09:18:06 pm »

I think he wants to manually load classes at runtime.  I've never messed around with that though, so I can't offer much in the way of advice.  I'm curious what he's using it for though.  Dynamic generation of creature classes, maybe?
« Last Edit: December 22, 2009, 09:23:19 pm by Footkerchief »
Logged

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: Intellectual Property & stuff
« Reply #55 on: December 22, 2009, 09:50:35 pm »

Ah, looking at the code a bit more, I see the issue. He is not using dynamic class loading. but loading a resource file that is inside the jar.

These links should provide an answer to your problem.
http://stackoverflow.com/questions/574809/java-load-a-resource-contained-in-a-jar
http://forums.sun.com/thread.jspa?threadID=278932
http://www.javaworld.com/javaworld/javatips/jw-javatip49.html

Dynamic class loading is a really sweet (though advanced, don't worry about it right now) feature. Its a really easy way to implement a quick and easy plugin system without linking and compile issues. Did you know that the first generation of First Person Shooters to allow mods needed to recompile themselves each time a mod was added or removed?
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Shades

  • Bay Watcher
    • View Profile
Re: Intellectual Property & stuff
« Reply #56 on: December 23, 2009, 04:09:02 am »

Dynamic class loading is a really sweet (though advanced, don't worry about it right now) feature. Its a really easy way to implement a quick and easy plugin system without linking and compile issues.

Yer the Java reflection stuff is one of the better systems I've seen in a compiled language. Interpreted ones tend not to have this problem for plugins. Java makes it very easy.

Did you know that the first generation of First Person Shooters to allow mods needed to recompile themselves each time a mod was added or removed?

I didn't. The earliest moddable fps I can think of is Quake which used QuakeC for modding, this was bytecode and compiled I guess but the quake engine itself didn't need to recompile itself. Interpreted scripts make for much easier modding these days, at the cost of (some) speed.
Logged
Its like playing god with sentient legos. - They Got Leader
[Dwarf Fortress] plays like a dizzyingly complex hybrid of Dungeon Keeper and The Sims, if all your little people were manic-depressive alcoholics. - tv tropes
You don't use science to show that you're right, you use science to become right. - xkcd

Savok

  • Bay Watcher
    • View Profile
Re: Intellectual Property & stuff
« Reply #57 on: December 23, 2009, 11:30:24 pm »

Ah, looking at the code a bit more, I see the issue. He is not using dynamic class loading. but loading a resource file that is inside the jar.

These links should provide an answer to your problem.
http://stackoverflow.com/questions/574809/java-load-a-resource-contained-in-a-jar
http://forums.sun.com/thread.jspa?threadID=278932
http://www.javaworld.com/javaworld/javatips/jw-javatip49.html

Dynamic class loading is a really sweet (though advanced, don't worry about it right now) feature. Its a really easy way to implement a quick and easy plugin system without linking and compile issues. Did you know that the first generation of First Person Shooters to allow mods needed to recompile themselves each time a mod was added or removed?
Apologies for my fail use of the word "dynamic"... I don't know much of the jargon yet.

Er... thanks for the help, but I already know how to do that. My code does that quite similarly (exactly the same? not sure.) to the solution on stackoverflow. What I'm trying to do is get a list of the... things (files, I think) inside a jar without beforehand knowledge of them.
Logged
So sayeth the Wiki Loremaster!

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Intellectual Property & stuff
« Reply #58 on: December 23, 2009, 11:46:20 pm »

What exactly do you need to do that for?  I'm asking because, well, it strikes me as such a weird question that I'm guessing there's an easier way to do whatever it is you're doing.

As for an actual answer, you use this: http://java.sun.com/javase/6/docs/api/java/util/jar/JarFile.html

Specifically entries(), most likely.  A lot of the useful methods for JarEntry (the type returned by entries()) are inherited from ZipEntry, so make sure to check those out.
« Last Edit: December 23, 2009, 11:50:36 pm by Footkerchief »
Logged

Savok

  • Bay Watcher
    • View Profile
Re: Intellectual Property & stuff
« Reply #59 on: December 24, 2009, 12:07:10 am »

ooookay. I think I'll just stop trying to do this. I had an unknown number of arbitrarily named *.map files, and I wanted to automatically discover all of their names so said names could be presented to the user. Since I'm going to totally redo this system, and since it currently works as long as I don't put everything in a jar, it's probably best not to spend too much time on it.

This is my only remaining question: "I tried to do some javadoc comments, but when I run it from the command line it doesn't like that my .java files are sometimes encoded in UTF-8 w/o BOM - the only Unicode format I've gotten javac to accept."

Again, thanks for the help!
« Last Edit: December 24, 2009, 12:08:54 am by Savok »
Logged
So sayeth the Wiki Loremaster!
Pages: 1 2 3 [4]