Author Topic: Oceanfarm  (Read 1336 times)

0 Members and 1 Guest are viewing this topic.

SquareWheel

  • Administrator
  • Cutester
  • *****
  • Posts: 521
  • Cutes: 84
    • View Profile
Re: Oceanfarm
« Reply #15 on: February 04, 2018, 08:05:30 AM »
Storing as files is way cleaner anyway.  Less error-prone, and gives you more system tools to work with (grep, search and replace, whatever else).

And yeah not a real CS guy but storing that in memory is completely insignificant compared to other assets.

hubol

  • Cutester
  • *****
  • Posts: 914
  • Cutes: 156
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: Oceanfarm
« Reply #16 on: February 04, 2018, 04:36:49 PM »
i dont know how game maker stores its data since it seems to be a "dynamically typed" language. but lets assume the worse and say if for some horrible reason everything is stored as a string then it would take (assuming a character is 1 byte, counting only the key and value strings, and not worrying about null-terminating the strings):
[price] = 150 (8B)
[description] = a big nusty (22B)
[stat1] = 6999 (9B)
[stat2] = 7000 (9B)
theres 8 + 22 + 9 + 9 =48bytes. if you had 1000 of these item definitions you would have 48000bytes or 48KB, aka not shit nowadays. textures on the other hand use
(width * height * components[rgb=3 or rgba=4] * subimages) bytes
the main character sprite for cr*z'd is
32 * 32 * 4(idk if gm7 stored all textures in rgba, u could load files with nonbinary alpha transparency in with it so im going to say yes) * 64
= ~262KB. which is still not a huge deal (i think average ram is at least 4GB nowadays) but obviously more significant than a bunch of data.

in general, you neednt worry about storing data, you have plenty of room to play with that. make wise performance choices instead
« Last Edit: February 04, 2018, 06:43:42 PM by hubol »

Giik

  • Cutey
  • **
  • Posts: 70
  • Cutes: 42
    • View Profile
  • Pronouns: He/Him
Re: Oceanfarm
« Reply #17 on: February 04, 2018, 10:10:39 PM »
i dont know how game maker stores its data since it seems to be a "dynamically typed" language. but lets assume the worse and say if for some horrible reason everything is stored as a string then it would take (assuming a character is 1 byte, counting only the key and value strings, and not worrying about null-terminating the strings):
[price] = 150 (8B)
[description] = a big nusty (22B)
[stat1] = 6999 (9B)
[stat2] = 7000 (9B)
theres 8 + 22 + 9 + 9 =48bytes. if you had 1000 of these item definitions you would have 48000bytes or 48KB, aka not shit nowadays. textures on the other hand use
(width * height * components[rgb=3 or rgba=4] * subimages) bytes
the main character sprite for cr*z'd is
32 * 32 * 4(idk if gm7 stored all textures in rgba, u could load files with nonbinary alpha transparency in with it so im going to say yes) * 64
= ~262KB. which is still not a huge deal (i think average ram is at least 4GB nowadays) but obviously more significant than a bunch of data.

in general, you neednt worry about storing data, you have plenty of room to play with that. make wise performance choices instead
the real numbers are actually stored as 32-bit floats, so it's a bit smaller than that.

still though, yeah, i'm overthinking it. ds_map it is, at least until i find something more efficient, if ever.

SquareWheel

  • Administrator
  • Cutester
  • *****
  • Posts: 521
  • Cutes: 84
    • View Profile
Re: Oceanfarm
« Reply #18 on: February 05, 2018, 12:44:38 AM »
Premature optimization is the root of all evil and all that.

hubol

  • Cutester
  • *****
  • Posts: 914
  • Cutes: 156
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: Oceanfarm
« Reply #19 on: February 05, 2018, 01:13:53 AM »
well yeah but i dont think that a map is really a premature optimization

SquareWheel

  • Administrator
  • Cutester
  • *****
  • Posts: 521
  • Cutes: 84
    • View Profile
Re: Oceanfarm
« Reply #20 on: February 05, 2018, 01:31:13 AM »
I thought we were agreeing on that

Giik

  • Cutey
  • **
  • Posts: 70
  • Cutes: 42
    • View Profile
  • Pronouns: He/Him
Re: Oceanfarm
« Reply #21 on: February 05, 2018, 02:12:11 AM »
well yeah but i dont think that a map is really a premature optimization
i think he's talking about me being all worried about if a solution is efficient enough

SquareWheel

  • Administrator
  • Cutester
  • *****
  • Posts: 521
  • Cutes: 84
    • View Profile
Re: Oceanfarm
« Reply #22 on: February 05, 2018, 03:04:15 AM »
Yerp.

Better to keep a clean and maintainable system.  Your future-self will thank you for it.

hubol

  • Cutester
  • *****
  • Posts: 914
  • Cutes: 156
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: Oceanfarm
« Reply #23 on: February 05, 2018, 06:41:49 AM »
suddenly i see

hubol

  • Cutester
  • *****
  • Posts: 914
  • Cutes: 156
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: Oceanfarm
« Reply #24 on: February 05, 2018, 06:50:24 AM »
p.s. in case youre interested, maps (if theyre implemented properly in game maker) run in O(1) (constant time [means good!!!!]) for lookup. this means getting information from the map using a key is really really cheap and could be as cheap as indexing into an array (depends on how hashing works in gm...)

Giik

  • Cutey
  • **
  • Posts: 70
  • Cutes: 42
    • View Profile
  • Pronouns: He/Him
Re: Oceanfarm
« Reply #25 on: February 07, 2018, 04:34:56 AM »


Yaaaaay i did it

i also changed items to arrays so I can store more than just their ID

Giik

  • Cutey
  • **
  • Posts: 70
  • Cutes: 42
    • View Profile
  • Pronouns: He/Him
Re: Oceanfarm
« Reply #26 on: February 18, 2018, 05:20:57 AM »
so i decided to move the project over to GMS2

it works for the most part but tilesets and backgrounds are pretty much completely changed so i gotta wrap my head around how the fuck THOSE work now

Giik

  • Cutey
  • **
  • Posts: 70
  • Cutes: 42
    • View Profile
  • Pronouns: He/Him
Re: Oceanfarm
« Reply #27 on: February 18, 2018, 05:22:24 AM »
this part still works though



so that's cool

hubol

  • Cutester
  • *****
  • Posts: 914
  • Cutes: 156
    • View Profile
    • hubolhubolhubol
  • Pronouns: he/him
Re: Oceanfarm
« Reply #28 on: February 18, 2018, 05:57:38 AM »
why did you move it to Game Making Skunk 2

Giik

  • Cutey
  • **
  • Posts: 70
  • Cutes: 42
    • View Profile
  • Pronouns: He/Him
Re: Oceanfarm
« Reply #29 on: February 18, 2018, 06:15:16 AM »
why did you move it to Game Making Skunk 2
because gms 1 is falling out of support and has an absolutely shitty room editor

apparently there's like a GM/Computer crash with the latest windows update if you go fullscreen with gms 1 too so like fuck it