Page 2 of 2

Re: Jury's Game Thread

Posted: Tue Jun 10, 2008 10:24 am
by Jay
I think i now know how you are organizing the items. You seem to have one attribute per item type, like one attribute for potions, one for small swords, one for big swords... (sorry but you just did not give me any information on how you are doing it...)

Wait, i now get it. The insane amount of items is causing you to look through all items, if one is 0 it won't get displayed, so you have to look for the next... (I am doing it differently, the player has a specific amount of slots, and each slot can store one specific item, or another item...) You can try this:

Code: Select all

ITEMS_DISPLAYED [0] //holds amount of items already displayed
CUR_ITEM [0] //current 'item number' (let's say your attributes are called 'item_1', 'item_2',... one for each of the item types)
ITEM_AMOUNT [0] //amount of current item

//All Item names
ITEMS_NAME
{
   ...
}

DisplayItem[ ()
{
   ITEM_AMOUNT=GetAttribute("item_" # CUR_ITEM,"Player");
   if(ITEM_AMOUNT>0)
   {
      //Y position is calculated with the ITEMS_DISPLAYED
      DrawText(ITEMS_NAME[CUR_ITEM],64,32+ITEMS_DISPLAYED*16,...); 
      DrawText(,64,32+ITEMS_DISPLAYED*16,...); 
      ITEMS_DISPLAYED=StringCopy(ITEMS_DISPLAYED)+1;
   }
   CUR_ITEM=StringCopy(CUR_ITEM)+1;
} ]

You would still have to go through a loop to determine which items are visible. Well, at least you now don't have to fill your array. (Does not save much)

OR:

You use your idea of caching your items.

The thing with the 'unlimited array size' is an old problem in the programming area. You could just fake it by making an array that is EXTREMELY big (Like 500 entries or such) and covers ALL items the player has.
Then you can just use a SCROLLNUMBER and everything is fine. (And just update this giant array when you get into the inventory, it might also help if you used a flag that shows if the array is still valid like ARRAY_VALID, if you pick somthing up, it gets false and the next time you enter the inventory it gets updated)

EDIT: Ah Final Fantasy 4... it's so cool...

Re: Jury's Game Thread

Posted: Wed Jun 11, 2008 10:38 pm
by Juryiel
Yes, now we're communmicating :) Seems like I'll have to make a huge array then to cache things in it to avoid the loop. Hopefully that won't cause memory issues. I'll give it a shot though. I was also thining of making specific slots like you had that are always present (some games including FF do that, you can scroll through the menu pages even though items are not displayed at all). I guess those are the only two ways to go and both will have a big load time when the menu loads but none afterward, which is definatly preferable to many small load times every time the player scrolls. Oh well, no one will use a 6 year old laptop to play it anyway so either way it will probably be fine (and it probably won't ever come out) so I guess I should move on :D

Thanks for your help though! Now that the menu is done I can start working on the battle system which should be much more interesting.

Re: Jury's Game Thread

Posted: Thu Jun 12, 2008 6:18 pm
by Jay
I have no loading times at all. I use Flipbooks to display the items and have attributes that contain which type of item is in one slot. I don't have to run through a loop, i just display all 9 item slots (and therefore the items in them) after another. I could also write a scrolling feature like yours, but i would still hjave no loading times. Drawback is that the items are not automaticly sorted, as they are with your method. But i can live with that, as the player can re-arrange them with te mouse.

Re: Jury's Game Thread

Posted: Wed Jun 25, 2008 10:56 pm
by Juryiel
Thanks for the idea Jay. I finally got around to changing the entire system to use slots and there is no loading time even in that old crappy laptop I'm currently using. I also like the fact that the player can see all the item slots (hundreds of them) so they can know if they've gotten one of every item type. Now if I could get the ShowText thing to not drop my FPS by 5 for each text box it would be perfect.

Work now begins on gameplay and the spell system. Yay!

Re: Jury's Game Thread

Posted: Wed Jun 25, 2008 11:24 pm
by Juutis
Oh wow, this sounds promising. I'm always excited to see new projects with extensive scripting. :)

Juryiel wrote:is there a way to disable rendering 3d work and other such things when I'm in the menu? The menu covers the entire screen and I don't need anything else working in the background. I think this will also help improve performance significantly.
In case you haven't figured out a solution yet: Add a hollow, empty and completely isolated box to the level. Then when you enter the menu, just simply move the camera there.


I'm looking forward to hearing more.

Re: Jury's Game Thread

Posted: Fri Jun 27, 2008 10:43 pm
by Juryiel
Interestingly simple idea Juutis, I can't wait to get home to test it out. I'll have to take about a week or two off to go see some relatives but I'll upload the menu script for anyone who wants to use it after that, and keep the forum updated if anything interesting develops. I'm guessing that the spell system shouldn't take too long since I already have targetting working well.

I really want to get this game mechanics coding out of the way so I can start building the actual game, but as I'm learning first hand it seems like I have to do a bunch of boring stuff before I can do stuff I like such as level design and enemy encounter designs.

Re: Jury's Game Thread

Posted: Sat Jun 28, 2008 9:56 am
by Jay
Juutis wrote: In case you haven't figured out a solution yet: Add a hollow, empty and completely isolated box to the level. Then when you enter the menu, just simply move the camera there.

:shock: You don't know on what ideas you have just brought me, Juutis. This can be used to make a 3d inventory and menu in which the player can select the 3d items / options with the mouse. :D So while you are in the inventory or the menu, view switches to fixed camera and you select it all with the mouse. Awesome! You could make a model of the character and his items are on a table and then use them and they are equipped and you see the results immeadiatly... then there can be different sections of the inventory and the camera will fly around to them/away from them, like 'character statistics', 'view character', 'skills', ... :shock: :D

(of course you had to fill the empty hollow box then)

sorry for going offtopic, i just had to bring that one in.

Re: Jury's Game Thread

Posted: Sat Jun 28, 2008 10:54 am
by Juutis
Wow, Jay! That's awesome! :shock:

You could make some really cool inventories and other menus this way. You could even merge the 2D and the 3D inventory: Make a part of the 2D inventory transparent so you can see to the room. You could then have a 3D model of the main character, for example show, up in that window. You could even rotate the 3D model around. :twisted: :D

Re: Jury's Game Thread

Posted: Sun Jun 29, 2008 5:17 pm
by Danimita92
Problem is you'd have to do this on all levels, right?

Re: Jury's Game Thread

Posted: Sun Jun 29, 2008 5:34 pm
by Juutis
Yes, you would. But isn't that why we have copy-paste? :)

Re: Jury's Game Thread

Posted: Sun Jun 29, 2008 10:11 pm
by Danimita92
Does it work properly though?

Re: Jury's Game Thread

Posted: Sun Jun 29, 2008 11:37 pm
by Jay
Just make it a prefab. I am going ot use this very soon.

Re: Jury's Game Thread

Posted: Tue Jul 22, 2008 5:28 am
by Agentarrow
too bad TT will not use the invo feature