Ye Olde Blah

ShiningSource.org => General Programming Forum => Topic started by: Elvenfyre on September 06, 2005, 04:52:36 pm



Title: My Java Experience
Post by: Elvenfyre on September 06, 2005, 04:52:36 pm
So I don't know if you guys know my current Java Project, but it's to make a shop system with shining force feel - and considering I only just learnt how to draw stuff to the screen with it earlier this evening I'm happy with my progress for the day.

I really should be working in with the existing BABS and SSCS classes etc, but I figure I'll make my own independent system in order to learn how the heck it works - and by then I might be able to understand enough of the language to tie it in with existing party member inventory structure and such that is necessary.


Title: My Java Experience
Post by: Elvenfyre on September 06, 2005, 04:57:51 pm
Why do I bother to post this, I just realised.  Well I find it a lot easier to tell people about my baby steps and then I feel less frustrated even if I don't get anywhere :)

(http://www.jaesign.com/desmond/java/first.jpg)

this is the starting point where i start with loops and drawing stuff to the screen.  
A list of what I see as the steps will probably help me too.
Importing pictures into the program to display as the weapons.
Gathering weapon name, price and picture information from an external text file to fill the shop class.
user input to move selection box between items.
user input to select buy or cancel.

otherstuff...
money calculations, item placement into inventory, chit-chat responses by the shopkeeper and "are you sure" yes no decisions.  Selling items back.


Title: My Java Experience
Post by: Elvenfyre on September 06, 2005, 06:05:24 pm
OK so I've managed to work out key listening, and made a red selector border thing that moves between the items.

(http://www.jaesign.com/desmond/java/second.jpg)

http://www.jaesign.com/desmond/java/shop.html

You have to click on the window, arrow keys to move it.
I'm proud :P


Title: My Java Experience
Post by: Elvenfyre on September 06, 2005, 08:54:42 pm
I think I've got classes sorted... umm, well ok here's the thing.
I've spent quite a while trying to get it to pull the amount of weapons and then the weapon details from an external file and have so far been unsuccessful - but using my items class and creating instances of weapons inside the shop class is working fine so it's only a matter of time.
Must go to sleep now though.

(http://www.jaesign.com/desmond/java/third.gif)

http://www.jaesign.com/desmond/java/shop.html


Title: My Java Experience
Post by: Devlyn on September 06, 2005, 09:27:24 pm
Hi Elv,

Check the java Properties object. It's great for loading plain text stuff from external files :).


Title: My Java Experience
Post by: Ty on September 06, 2005, 10:11:40 pm
Nice work there Elv, especially if you're just starting with Java and OO programming. I always liked coding shops, don't know why.

Looking forward to your first Shining game ;)


Title: My Java Experience
Post by: Elvenfyre on September 07, 2005, 10:25:39 am
Haha thanks guys :)  I think I'll stick with the shop system for now haha.

Well Devlyn I have a problem with the Properties object- I'm using FileInputStream the same way you use it for your entityfile and itemfile, and it's compiling, but on loading in the browser it isn't running(properly) - open java console and it says it doesn't have access to open the shopfile  : /
I don't know why this would be ... as far as I know there are no permissions I have to give it, this computer and file system is about as secure as a gazebo.


Title: My Java Experience
Post by: Elvenfyre on September 07, 2005, 02:19:07 pm
Since I'm a little stuck on importing weapons from a file and I really want to do that, I've decided to start tackling this whole shop system issue from the top down now that I am getting my head around subroutines - and what ones I'll need to make this thing work.

So I've got a subroutine for building the blue boxes with the borders that make it look shining-force-esque
Come up with a speech script for the chit chat so I can modify it as time goes by to have it make little bubbles of sound and take its time "speaking" (typing out the words) - for now it just uses the right font in the right place.
And I've used my buy and sell interface buttons and made a toggle for that with the up and down keys, and pathing so you can cancel and confirm at each step.

(http://www.jaesign.com/desmond/java/fourth.gif)

http://www.jaesign.com/desmond/java/shops.html

this is a different link from those above since I've started a new class to begin again.

Next is entering the buy menu, displaying the class I made last night of items, and allowing purchase.


Title: My Java Experience
Post by: Elvenfyre on September 07, 2005, 03:11:13 pm
moved my previous paint job of the top menu into its own subroutine and pulled it into the Shops class, so you can now go one step further.

(http://www.jaesign.com/desmond/java/fifth.gif)

http://www.jaesign.com/desmond/java/shops.html

(sorry about the spam, but to be honest, if I wasn't bratwurstming the babysteps here I'd probably give up heheh, planning more than an hour at a time is daunting when it is this frustrating.  starting to become clearer now though)


Title: My Java Experience
Post by: Ty on September 07, 2005, 03:36:58 pm
It certainly looks like you've got everything under control! That's a pretty sweet looking shop you've got there. Does this mean BABS will be getting a shop too ;)


Title: My Java Experience
Post by: Elvenfyre on September 07, 2005, 03:53:50 pm
Yeah well as long as I can get these external files to write!
I'm sure once I get enough practise in and take another look at it I'll be able to figure it out.

the idea is that you have your own plaintext items file..

//types: sword, ax, arrows, staff, lancespear, etc etc
ShortSword.name="Short Sword"
ShortSword.type="Sword"
ShortSword.price=80
ShortSword.wimage="items\shortsword.gif"
ShortSword.attackmod=15;
ShortSword.defensemod=0;
(and so on and so on)

and you write these out for each item you want in your game inside the one file.  your party who are equipped with whatever weapons pull the info from this file, and so do shops.

You also have a plaintext shop file, which you give each shop a name (town based, presumably) - and then you just list what items it has.
Pacalon.name="Pacalon Weapons Store"
Pacalon.type="Weapons"
Pacalon.item.1="ShortSword"
Pacalon.item.2="SilverArrows"

doing this for each shop.  at first glance it means short swords cost the same price everywhere, but you could be smart and give it a different variable name(ShortSword2, say) and leave all of the info the same except price.

I've just completed selecting a weapon and the Yes-No menu for buying it.  Will just complete the yes selection routine to modify your gold and take you back to the buy menu, and then post the screenie.


Title: My Java Experience
Post by: Elvenfyre on September 07, 2005, 04:14:14 pm
ok so I even managed to put in similar nuance as shining force to try to keep the feel, when you decline to purchase a weapon you're looking at.
I also managed to make it figure out whether you have enough gold to buy it before reducing your gold by that amount.

I'm not sure whether I'll work on incorporating the whole "who gets to hold the item" thing just yet, or whether I'll go back to making the outside files work.. we'll see.  I wanna give the external files another bash but I don't hold much hope.

(http://www.jaesign.com/desmond/java/sixth.gif)

http://www.jaesign.com/desmond/java/shops.html

YOU CAN NOW BUY THE STUFF :D


Title: My Java Experience
Post by: Elvenfyre on September 07, 2005, 04:17:09 pm
as a side note, my firefox doesn't seem to be refreshing the page to show the newer version.. I don't know quite why that is it's possibly because java virtual machine is being a bitch (i do know this shop only works with the latest jvm, when i got someone else to test it earlier they had to update)

My IE however is refreshing and using it fine after a CTRL-Refresh.

weird.

edit: I think it was because i wasn't closing all my firefox windows before reopening to view it.

That's it for the night for me, tiredness has just hit.


Title: My Java Experience
Post by: Elvenfyre on September 08, 2005, 02:34:38 am
Right instead of doing work today I started doing this haha.

So I've managed to prove effectiveness of the system by implementing 3 shops.

Now the gold you get lasts for the entirety of the Load - so if you visit more than one shop you only have what gold you kept from visiting the other shop.

So pressing 1, 2 or 3 in the initial black screen is meant to have the same effect as visiting different towns weapon stores.

http://www.jaesign.com/desmond/java/shops.html

I think I'll give the external file thing one more shot now.


Title: My Java Experience
Post by: Elvenfyre on September 08, 2005, 06:27:59 am
Another update.
So I've built a Party class in order to make sure my items are working and finish off the shops processes.

Now you designate who holds the item, it checks whether you're the right character type to equip it, and asks whether you want it anyway, if you want it equipped if you can, and also checks if your item slots are full.

I've still got to make equipped icons and show the modifiers for an item if it's equippable (like attack 42->45 rather than the word "equippable").

Now I've got to work on the sell menu using the same party item system and probably will incorporate a new feature in shops, being sellpercentage so that you can get more for your old sword in tassar than you do in milton.

(http://www.jaesign.com/desmond/java/eighth.gif)

http://www.jaesign.com/desmond/java/shops.html


Oh one other thing of note, I've increased the height of the window to 375, so that I've got an aspect ratio of 4:3.


Title: My Java Experience
Post by: Elvenfyre on September 08, 2005, 09:01:19 am
I realised the version above didn't in fact GIVE you the item once you bought it - now it does.  This gave me a bug which is now fixed handily.

So selling works too now.
Instead of using the shining force style of pushing your items down so the top slot is always the last one full, I've done something i believe is a little smarter and simply run a check routine before going into selection(maybe not, we'll see later I guess).

(http://www.jaesign.com/desmond/java/ninth.gif)

http://www.jaesign.com/desmond/java/shops.html


Title: My Java Experience
Post by: Elvenfyre on September 08, 2005, 10:49:41 am
OK so I've pretty much finished what I set out to achieve, a basic shop system.

What's left?  There are some tidying things, a couple more modules, and then some stuff I want to work on for myself.

I need to show what item is equipped with a little symbol.

I need to expand the item class to include all of the features of items that will be necessary.

I need to expand the shop class to include repair percentages and deal types so I can place in those menus.

Also I want to make work on the speech bundle to roll along at a speed, a keypress automatically finishing the sentence, and text "scrolling" up as new text appears under it if appropriate.

Another thing would be the swoosh effect of various menu and text backing boxes on the screen - depending on their final position in original shining force 2 they would "swoosh" in from outside the viewable screen into place - then the content appearing on them.  when leaving a menu or text box they would "swoosh" out again.
Lastly, I've been thinking about sounds, not soundtrack so to speak - but for example the swoosh and unswoosh sound, speech sound burbling, and selection clicks.