Ye Olde Blah

Project Specific Discussion => SMEE / BABS / Shiny Sword Discussion => Topic started by: christian1982 on December 28, 2009, 08:40:37 am



Title: searching java code
Post by: christian1982 on December 28, 2009, 08:40:37 am
Hi everyone,

I'm new here and I am searching for the Java Sourceode of B.A.B.S. 2.25 or 2.5.
I like Java, so I would be happy to read the sources

Thank you for help


Title: Re: searching java code
Post by: Ty on January 01, 2010, 07:14:52 pm
I have the source hanging around somewhere, so I'll take a look for it this weekend and upload it sometime next week (unless Elv or Dev beat me to it) :)


Title: Re: searching java code
Post by: Devlyn on January 01, 2010, 11:30:58 pm
Actually, I have no copy of the code whatsoever since my harddisk crashed a year or so ago O_O.


Title: Re: searching java code
Post by: Elvenfyre on January 04, 2010, 06:38:55 am
I emailed you a copy a few months ago dev.. or maybe your email address has changed, pm me a new one so I can send it.


Title: Re: searching java code
Post by: Devlyn on January 05, 2010, 07:46:44 am
lol! Actually I found it in my mailbox now! Must be getting Alzheimer :P.


Title: Re: searching java code
Post by: Ty on January 05, 2010, 03:33:39 pm
OK, the source code is now available here: BABS 2.5 source code (http://www.shiningsource.net/downloads/babs-2-5-src/). If there's any mistakes in the readme or files missing / corrupt, let me know and I'll fix them ASAP :)


Title: Re: searching java code
Post by: Devlyn on January 05, 2010, 07:07:28 pm
Ah, this is great news for Shining Fangame developers! Again :P.


Title: Re: searching java code
Post by: Ty on January 05, 2010, 08:10:37 pm
Just wait until the Shining Online source code is released:P


Title: Re: searching java code
Post by: Devlyn on January 05, 2010, 10:28:43 pm
I think you should :D. It's either that or rewriting it in Lisp if you ask me :P.


Title: Re: searching java code
Post by: Elvenfyre on January 06, 2010, 07:49:31 pm
I thought we were using Lisp all along?!?!!?? 
Oh wait no no, that's just my terrible code writing style.



Title: Re: searching java code
Post by: Devlyn on January 09, 2010, 12:08:43 pm
Well, if you consider that we programmed in a language originally intended for coffee machines I think our code doesn't look half bad actually ;).

if(sugar) {
  sweetness++;
}
if(milk) {
  creaminess++;
}
if(decaf) {
  loser++;
}


Title: Re: searching java code
Post by: christian19822 on July 23, 2010, 06:26:02 pm
I am reading the sources,
but in my opinion this is just a copy and paste thing of C/C++ there are some things missing/ wrong like names, comments code formatting etc.
I'll try my best but I give no guarantee that I'm finished soon ;)


Title: Re: searching java code
Post by: christian19822 on July 24, 2010, 08:19:33 am
who (the hell) wrote this code?

Quote
      else if(key == KeyEvent.VK_DOWN) {
        if(battleModeOption < 4) battleModeOption = 3;
        else if(battleModeOption > 9 && battleModeOption < 13) {
          if(Buffer.Player().spell[battleModeOption-9] != null) {
            battleModeOption++;
            spellLevelChoice = Buffer.Player().spell[battleModeOption-10].level;
          }
        }
      }
      else if(key == KeyEvent.VK_LEFT) {
        if(battleModeOption < 4) battleModeOption = 1;
        else if(battleModeOption > 9 && battleModeOption < 13) {
           if(spellLevelChoice > 1) {
             spellLevelChoice--;
             //System.out.println("--:" +spell_lv_choice);
           }
        }
      }

these elseif-Cases are disjoint, so you don't ever need an elseif.
The same problem exists at th battlemodeOptions...  ???


Title: Re: searching java code
Post by: christian19822 on July 24, 2010, 08:51:45 am
I must have been Bill Gates:

the code works, but you never understand why  8)


Title: Re: searching java code
Post by: Devlyn on July 24, 2010, 10:16:18 am
I wrote that code.... loooong time ago, back in the days when I was still a very crappy programmer :P.

Although, disjoint else-if statements are actually faster in some programming languages. ;)


Title: Re: searching java code
Post by: Aura4 on July 24, 2010, 10:45:02 am
Although, disjoint else-if statements are actually faster in some programming languages. ;)
Yes, that's right, and that's why it's absolutely correct to use them.


Title: Re: searching java code
Post by: christian19822 on July 24, 2010, 01:46:22 pm
I don't want to blame anyone here...

Ähm...but: Using 4-5 time the charAt(0) method in an if-else structure isn't really fast.
a switch would only once evaluate this method and then jump in the current cases; and a switch has also a deflaut-case...

...going to correct code...


Title: Re: searching java code
Post by: christian19822 on July 24, 2010, 03:27:15 pm
my Code correction is for example like this.
Open the code in a java editor (like eclipse) to see the differences:

Code:
	public void targetExecutionCode() {

    /** A.I. targeting execution code!!! */

/** join the if-s
    if(Buffer.Player().ai == true && mode == Constant.selectYourTarget) {
    if(animationIterator == animationDelay-1) {
    contentPane.remove(screen);
*/
    if((Buffer.Player().ai == true) && (mode == Constant.selectYourTarget)
    && (animationIterator == animationDelay-1)) {
   
    contentPane.remove(screen);


       
    /**
    * a switch replacing the commented if-else structures
    */
    switch(attackType) {
   
    case Constant.normalAttack :
    if (Buffer.Player().range > 2) {
    attackType = Constant.rangedAttack;
    }
    battleAnimation = new MeleeSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
    battleAnimation.setBounds(0,0,maxX,maxY);
    /* TODO: Stop local animation loop? */
    contentPane.add(battleAnimation);
    break;
   
    case Constant.rangedAttack :
    rangedAnimation = new RangedSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
    rangedAnimation.setBounds(0,0,maxX,maxY);
    /* TODO: Stop local animation loop? */
    contentPane.add(rangedAnimation);
   
    break;
   
    }// switch
    } // combined if
} // end of targetExecutionCode()

/**
* Replaced if-else structure in targetExecutionCode()
*
* case constant.normalAttack

*      if(Buffer.Player().range > 2 && attackType == Constant.normalAttack) {
    attackType = Constant.rangedAttack;
    }

    if(attackType == Constant.normalAttack) {
    battleAnimation = new MeleeSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
    battleAnimation.setBounds(0,0,maxX,maxY);

    TODO: Stop local animation loop?
    contentPane.add(battleAnimation);
    }
    else if(attackType == Constant.rangedAttack) {
    rangedAnimation = new RangedSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
    rangedAnimation.setBounds(0,0,maxX,maxY);

    TODO: Stop local animation loop?
    contentPane.add(rangedAnimation);
    }
    a complicated way to call repaint()
    this.paint(this.getGraphics());
    mode = Constant.modeAttack;
    changing the sound
    JukeBox.PlayBattleTune(); */



I know its big, but I haven't any email adresses...


Title: Re: searching java code
Post by: christian19822 on July 24, 2010, 03:29:19 pm
maxY maxY and some other new variables are calculated before or are Object-Variables (see this. Operator in a Java tutorial)

The Constant.xxx values are the same as they are in the orginal-code:
Code:
	public static final int overlandWalking = 0; 
public static final int standardMenuActive = 1;
public static final int selectYourTarget = 2;
public static final int modeAttack = 5;
public static final int statusCheck = 6;
public static final int endOfTurn = 7;
[/code}
etc...


Title: Re: searching java code
Post by: Ty on July 24, 2010, 03:31:07 pm
If you have any experience with Subversion, I could host the current babs code.


Title: Re: searching java code
Post by: christian19822 on July 24, 2010, 03:32:27 pm
I am more likely with zip versions, or tell me more about it I'll look after subversion later...;)


Title: Re: searching java code
Post by: Ty on July 24, 2010, 03:36:59 pm
The official subversion site (http://subversion.apache.org/) doesn't really give much info, but if you're using Windows I'd advise looking at TortoiseSVN (http://tortoisesvn.net/). It makes checking things in and out much easier.

If you're happier with zip files, you can just post them here as attachments (maybe in their own thread to make them easier to find).


Title: Re: searching java code
Post by: Devlyn on July 24, 2010, 04:53:48 pm
Hmm... BABS on Subversion would be awesome! It would also make it much easier for me to check the code from anywhere and help people working on it whenever they get stuck ;).


Title: Re: searching java code
Post by: Ty on July 24, 2010, 05:21:51 pm
Okey doke, I'll set it up today. If anyone would like access to it, just pm your desired username / password and I'll add your account & pm you the access details.


Title: Re: searching java code
Post by: christian19822 on July 24, 2010, 09:39:28 pm
can anyone explain me waht  these variables mean


Code:
	private int up = 0;
private int down = 0;
private int left = 0;
private int right = 0;

/**equals 1 if particular button was once pressed and not released yet.*/
private int opup = 0;
private int opdown = 0;
private int opleft = 0;
private int opright = 0;

and which values they takes and what does these values mean.
Sometimes they take the value 3 - I can't imagine what that should mean?


Title: Re: searching java code
Post by: christian19822 on July 24, 2010, 10:31:11 pm
under

http://www.informatik.uni-freiburg.de/~marquard/

in the very last line you find a the partially corrected [BattleFrame.java] sourcefile


Title: Re: searching java code
Post by: Elvenfyre on July 25, 2010, 03:15:07 am
Thanks for this christian, I really appreciate all of your efforts.

I have probably also corrupted the code with my style as well, so don't blame all the issues on Devlyn.
However unfortunately in my case you won't have reasonable explanations, since my method at the time simply required the end result to work in general, rather than being fast, efficient, or bug free ;)



Title: Re: searching java code
Post by: christian19822 on July 25, 2010, 12:35:14 pm
I don't blame anyone - I'm just reorganizing the code.

the newest code can be found at

http://www.informatik.uni-freiburg.de/~marquard/

please have a look at it, if it works how you expected it
 ;)


Title: Re: searching java code
Post by: christian19822 on July 25, 2010, 12:39:28 pm
what's about subversion? - I read it ;)


Title: Re: searching java code
Post by: christian19822 on July 25, 2010, 09:18:57 pm
hello,

anyone out there ?

I would be happy if didn't have to work alone.... !  :)


Title: Re: searching java code
Post by: christian19822 on July 25, 2010, 09:21:40 pm
can someone tell me how to add files to a post?


Title: Re: searching java code
Post by: Devlyn on July 25, 2010, 10:02:09 pm
Click on additional options below the part of the screen where you type your reply :).


Title: Re: searching java code
Post by: christian19822 on July 25, 2010, 10:19:30 pm
I get only these three options:

 Notify me of replies.     
Return to this topic.    
Don't use smileys.
 ???


Title: Re: searching java code
Post by: christian19822 on July 25, 2010, 10:44:04 pm
I have zipped my code so long - as subversion isn't started.
Here you can find the latest code of mine (everytime I hope...):

http://www.informatik.uni-freiburg.de/~marquard/shinysword/

PS: What is Devilins problem with the euler formula, is that already solved?


Title: Re: searching java code
Post by: Elvenfyre on July 26, 2010, 12:02:35 am
Hi there,
Yeah I'm working full time so if you're all keen right now the best way for me is through a turn based updating system ;)

I've sent you a private message with my contact details.


Title: Re: searching java code
Post by: Ty on July 26, 2010, 12:17:20 am
Subversion repository is now up. I'll PM login details etc.


Title: Re: searching java code
Post by: christian19822 on July 26, 2010, 06:20:29 pm
sorry but my login didn't work...

I'll keep working with zio-Files ;)


Title: Re: searching java code
Post by: Ty on July 26, 2010, 07:56:43 pm
Hopefully the Subversion repository is working now. I've made a few changes to the code, although nothing major (I'm not particularly good with Java :(). Are there any changes that people are after?


Title: Re: searching java code
Post by: christian19822 on July 26, 2010, 08:17:19 pm
thanks ty, now it works.
but I prefer to store my work in zip-Files. I think it is easier because there aren't too much files then ;)


Title: Re: searching java code
Post by: christian19822 on July 26, 2010, 08:23:35 pm
I added a folder [source] in which I moved the trunk folder and my new coding-folders ;)


Title: Re: searching java code
Post by: christian19822 on July 26, 2010, 08:27:08 pm
uuuups 
I deleted the trunk folder  :-[
can someone reload it as a subfolder of the source folder please...  ::)


Title: Re: searching java code
Post by: Ty on July 26, 2010, 08:32:53 pm
I'll fix it up when I get chance :)

Trunk, branches and tags are all top-level folders, so source should go in trunk (which is what I'll do). So when you check code out, check it out from trunk, not all 3 folders (if that makes sense). Anyway, I'll fix it all up :)


Title: Re: searching java code
Post by: Ty on July 26, 2010, 08:44:19 pm
Ok, it's uploading now so should be ready in the next 10 mins.


Title: Re: searching java code
Post by: christian19822 on July 26, 2010, 08:47:02 pm
thanks;

can anyone of you give me a little introduction to the shiniy-sword code
It doesn't have to be much perhaps some notes or something I can work with while editing the code...?


Title: Re: searching java code
Post by: Elvenfyre on July 26, 2010, 09:04:22 pm
yeah, email me.  It will take a couple of days to come up with such notes though.

I don't know if I missed it, but it would be good to hear your overall goal if you have one?


Title: Re: searching java code
Post by: christian19822 on July 26, 2010, 09:13:10 pm
I have read anywhere that you want to split off Smee and Shiny Sword in several parts.
Another thing is perhaps create some packages or some new data-structures to support the game in a better way.
My intention is also to split the game logic from the game representattion.
I have just made a bomberman game with splitted logic and computation - I'll email you ;)


Title: Re: searching java code
Post by: christian19822 on July 26, 2010, 09:44:08 pm
...and I like good commented code.
The best way to make the code easier to understand; I created javadoc-Comments.


Title: Re: searching java code
Post by: Elvenfyre on July 26, 2010, 10:40:36 pm
OK so yes, as far as I am aware they are already separate. . . You may have to be more specific on that comment.

It's good to hear, the whole idea of BABS and SMEE is to allow shining style games to be made by those who aren't programmers.  It would be nice to see improvements by a programmer like yourself which would benefit all.
We do want it to be flexible, and yet easy - which our specific goal : shining style games, should be able to provide.  Asking the game creator only to make content, giving them the advanced ability to use logic to dictate non-linear gameplay seems to be the key.

I proved the existing system could be used as such already, but there are elements left unwieldy and more to the point, difficult to understand on ones own.  Ty was working on some documentation, but I think it's best if we leave him to his shining online project because we all eagerly await that ;)
Perhaps I can get the documentation I started finished when I complete the Saltwater Campaign.


Title: Re: searching java code
Post by: christian19822 on July 26, 2010, 11:00:05 pm
seems like I'm alone at the moment.
So far, if I should work alone I can, but then I think it's better to start a new project than to think and sometimes to guess what the shiny sword code means...
but I'm well interested in your layering system - how is it programmed?
I have also a layering system in my bombermangame there are two classes one active and one passive class each consisting of a double array; this seems like your worldmap...?


Title: Re: searching java code
Post by: christian19822 on July 27, 2010, 12:01:37 am
oh I now understand more about tiles,
this is cool and will have a great effect of my programming style ;)


Title: Re: searching java code
Post by: Elvenfyre on July 27, 2010, 01:25:55 am
Are you currently looking at SMEE for the layering / tile creation functions or BABS for the output?

SMEE is pretty well made imho, and should be understood first to see what information is being provided to BABS in order to understand what's happening there.


Title: Re: searching java code
Post by: christian19822 on July 27, 2010, 03:16:20 pm
I was looking at the Editor SMEE and reading your introdution.
Now I think I better unterstand the Tile-System. Before I didn't for waht this was.
But now I see how some things work and can better reorganizing the code


Title: Re: searching java code
Post by: christian19822 on July 27, 2010, 04:19:05 pm
so far this project takes too much time for me.
Thus I have to stop coding for a few weeks. I realy like it but I can't work here while studying at university and have to get ready for my exams...

I will inform you, if I come again to code this project

best regards
chris


Title: Re: searching java code
Post by: Ty on July 27, 2010, 06:44:50 pm
Thanks for all you've done so far,  we all know how hard it is to find time for these things :) If the latest version of your code is in Subversion, I'll merge in the changes so everyone can get the latest copy.


Title: Re: searching java code
Post by: christian19822 on July 27, 2010, 10:17:41 pm
Hi Ty,

yes the latest version is I think the 26.07.2010.zip.
But there is a problem you can look at: it doesn't start the game.
I have another question:
Can you reoganize the subversion so that my folder is beside the trunk-folder and not contained in it.
Thank chris


Title: Re: searching java code
Post by: Ty on July 27, 2010, 11:42:09 pm
To be honest, Subversion works better with source files instead of zip archives. That way everyone can see what changes were made and can merge their files in a little easier. If you prefer zips, it might be better to upload them here and then we can merge the changes in manually :)


Title: Re: searching java code
Post by: christian19822 on August 06, 2010, 06:24:37 pm
I have a question:
Why don't you  in the Class Tileset
delegate the tiles.size() method to the getLength() method.
You always increase a local varible length, that I think is not really necessary, because all you have to do is to implement the following code
Code:
 * 
 * question
 * why is the method tiles.size() not delegated to the getLength() method:
 *
 *  public int getLength() {
 *  if (tiles == null) return -1;
 *  else
 *  return tiles.size();
 *  }
 *
 *  ???
 * 
 *  because the getTile(9-method is delegated !

I've writed this comment inside the ClassFile ;)


Title: Re: searching java code
Post by: christian19822 on August 06, 2010, 06:31:07 pm
I commited my last code as Revision 12 in the folder
babs\trunk\src

...hoping for answers ;)


Title: Re: searching java code
Post by: Elvenfyre on August 07, 2010, 11:13:10 am
I'd check what functions call getLength in a search of all other files because there might be a more unique loading function which utilises its current form.  just a guess really because I have no idea.


Title: Re: searching java code
Post by: Ty on August 07, 2010, 01:27:57 pm
Just a heads up -- you should update your code before modifying and checking it in, otherwise you'll overwrite the changes people have been making ;)


Title: Re: searching java code
Post by: christian19822 on August 07, 2010, 05:34:14 pm
I only see the calls of the .getLength() method,
but I think we can replace this code !?


Title: Re: searching java code
Post by: christian19822 on August 07, 2010, 05:49:15 pm
I copied the folders containing the images and all into the trunk/src folder to be able to start ShinySword out of eclipse.


Title: Re: searching java code
Post by: christian19822 on August 07, 2010, 10:33:04 pm
...sometime the code is written with a switch , sometimes with an ifelseif structure... taht's funny ;)


Title: Re: searching java code
Post by: Devlyn on August 08, 2010, 09:51:10 am
Call it freeform programming :P.

Or just bad programming even ;)


Title: Re: searching java code
Post by: christian19822 on September 06, 2010, 10:47:56 pm
hello again.

I've some holidays, so I'll program.
Can ynaone explain me what the Values of the [menuplace]-Variable mean. I Want to rename the Constants and give the senceful names ;)


Title: Re: searching java code
Post by: christian19822 on September 06, 2010, 11:06:14 pm
I'll fix it with my Constant.java File ;)


Title: Re: searching java code
Post by: christian19822 on September 08, 2010, 03:34:43 pm
why do we load images in the code and not before instanciating the game ?

Code:
if (selected == "BUY") {
buyImage = Lib_Image.getImage("interface\\i_buy1.gif");
sellImage = Lib_Image.getImage("interface\\i_sell2.gif");
}
             ....


If we load the Images before, for example when the Game starts, it is easier and faster.
Because the images aren't reloaded EVERYTIME we call the method.


Title: Re: searching java code
Post by: Elvenfyre on September 16, 2010, 11:42:38 am
you're right,  i made the shop method as a seperate module and then integrated it, so i never put any of the steps outside of the shop itself.


Title: Re: searching java code
Post by: christian19822 on September 23, 2011, 12:26:15 am
Hello again,

I know its been a while, but in my second job I'm studying ;)

So can anyone help me by explaining me how the

Walkmap.setBlock(int x, int y, int layer, int value) works.

And I have a few other questions:

1) Can anyone desribe me the layers more exactly.
I want to comment a lot of stuff to make the things getting better and isolate the different parts better. But therefore I need someone to answer my question. And please dont hate me if I ask things that are already in the documentation since Im documenting source code which is pretty hard without any answers ;)

2) Source Code
Was there a newer Version than that I worked on I think its. Babs2.5 ypou find a link to it here:

http://www.informatik.uni-freiburg.de/~marquard/shinysword/

And the main question: How should we order the sourcecode. Normally the first things are attributes and then the methods. The getter and setter methods can get a seperate place before the more complex methods. I discouvered you writing the attribute and getters and setters for each attribut one after another. I'd like to order the sourcecode first attributes and then methods. Does anyone have better ordering.

3) I try only to comment the code, but I've also seen some (unecessary?) programming lines which I will to "correct" or make more efficient. So who is the guy in China I can talk to if I have some questions or ideas?

Thanks a lot for answering
Programming together makes more fun ;)



Title: Re: searching java code
Post by: christian19822 on September 23, 2011, 12:33:17 am
OOpss....

I've seen Develyn is working on Babs 3.
Is there a easy job to program with that I can support you.
Do you need a mathematical background to solve a problem. I also like mathematics. Ie. your problem that you solved with the distances

  *
*P*
  *

to get the cells inside the range... This is a Norm
see

http://en.wikipedia.org/wiki/Norm_%28mathematics%29

Happy to help you

Christian


Title: Re: searching java code
Post by: christian19822 on September 23, 2011, 07:58:53 pm
I found that

http://www.notaboutme.nl/files/BABS3.rar

and will try to work and document it.

If there are newer versions let me know ;)


Title: Re: searching java code
Post by: christian19822 on September 23, 2011, 08:11:46 pm
cooler graphics and a good new sound  ;D

RESPECT !


Title: Re: searching java code
Post by: christian19822 on September 25, 2011, 03:19:05 pm
sorry,

but I'm still waiting fro an answer because i think only work on some code without working with someone other make no sence... ?


Title: Re: searching java code
Post by: Ty on September 25, 2011, 09:20:19 pm
I'm pretty sure Dev & Elv are pretty busy these days, so they won't be able to get back to you for a while. Your best bet is to just work on what you like and then it can be rolled back into the core when they get chance. If you desperately need to get hold of them you can private message them and they should get an email notification.


Title: Re: searching java code
Post by: christian19822 on September 26, 2011, 11:34:01 am
Thanks Ty.

I think I will contact them by PM


Title: Re: searching java code
Post by: Elvenfyre on September 27, 2011, 07:47:19 pm
That's the latest.  Sorry for not replying sooner!  Thanks for your hard work :)


Title: Re: searching java code
Post by: Devlyn on October 03, 2011, 02:59:44 pm
Hi guys,

Yes, I don't think I made a lot of modifications after that BABS 3 release. I currently am composing a lot of new music, and once my music project has advanced, some of that may well find its way into the game again ;).

Oddly enough, my musical work has sparked more reactions lately than my game efforts, so I'm doing more musicy stuff at the moment ;).

If you would like any advice, feel free to contact me by e-mail at d.groen "at" ucl.ac.uk.


Title: Re: searching java code
Post by: Devlyn on October 10, 2011, 09:55:20 pm
Found out today that Chris is using a very outdated version.

The most recent version can be found at http://ccs.chem.ucl.ac.uk/~derek/BABS%203.rar for the record :).