PyTFall > PyTFall: Game design

<-- Archived --> (Items Concept)

<< < (26/26)

Xela:

--- Quote from: DarkTl on December 07, 2015, 03:23:12 AM ---Doesn't it mean that if we send a character with low gold, she will keep wanting to buy random stuff but often will be unable to instead of focusing on cheap items she can afford?

--- End quote ---

Which part? Code will run itself until amount of items requested is 0 or until all options run themselves out. You'll have to be more specific on what concerns you.

DarkTl:
Let's say she has 50 gold, and we have like 200 items she cannot afford and 50 she can.

So we'll have a list of 250 items, and 200 of them will be useless to us from the beginning. Shouldn't we remove too expensive ones from the list after every purchase, or at least before the first purchase?

Xela:

--- Quote from: DarkTl on December 07, 2015, 03:58:38 AM ---Let's say she has 50 gold, and we have like 200 items she cannot afford and 50 she can.

So we'll have a list of 250 items, and 200 of them will be useless to us from the beginning. Shouldn't we remove too expensive ones from the list after every purchase, or at least before the first purchase?

--- End quote ---

In the very beginning would be a nice optimization, would prolly speed things up a little bit. New list would have to be created with:


--- Code: ---total_pool = [i for i in auto_buy_items if i.price <= self.gold]
--- End code ---

or something like that. We'll work with total pool after that... maybe removing all bad trait items using extra check while building this list is a decent idea also...

Those methods have been optimized just once because my first version was really, really slow and faaaaar too complicated. Your proposal seems like a good step towards making it better/faster.

DarkTl:
Should I use a new list every time? Or it's possible to do stuff like pool = [i for i in pool if i.price <= self.gold]?

Xela:

--- Quote from: DarkTl on December 07, 2015, 04:41:09 AM ---Should I use a new list every time? Or it's possible to do stuff like pool = [i for i in pool if i.price <= self.gold]?

--- End quote ---

It's perfectly possible but not very useful since we're building new lists from total pool two or three times. I think my original suggestion of creating a total pool with all badtrait and too expensive items sorted out is best. Than we can use that instead of the global auto_buy_items or whatever that's called.

Navigation

[0] Message Index

[*] Previous page

Go to full version