Alice Community  

Go Back   Alice Community > General Discussion > Questions and Comments

Reply
 
Thread Tools Display Modes
The best way to save memory?
Old
jrrTolkien
Senior Member
 
jrrTolkien's Avatar
 
Status: Offline
Posts: 166
Join Date: Feb 2014
Location: Middle-Earth (Merrimack, NH)
Unhappy The best way to save memory? - 06-25-2014, 04:13 PM

What's the best way to make a multilevel game without using too much RAM? I always have way too many models in my games, so it uses up too much virtual memory. Anyway, thanks in advance!

-jrr


Arwen: “I would rather share one lifetime with you than face all the Ages of this world alone.”

-April Signature
   
Reply With Quote
Hmmmmm
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default Hmmmmm - 06-28-2014, 09:52 AM

I think that you just answered your own question! Too many objects.

The answer might be to re-use the existing objects. using Dummies might involve a little more effort on your part, but save some space.

(1) Take everything that you want to use in Scene Two, including the camera, and drop Dummies on them in their Starting Positions.
(2) Write a quick Method using a "doTogether" that moves everything back to their starting positions making sure to use a duration of zero for the moves(will come in handy as a game Starter).
(3) Move everything that needs to be repositioned in Scene Two, including the camera, to their new places, and drop new Dummies on them.
(4) Write a quick Method using a "doTogether" using "set point of view" to migrate everything to their New starting positions making sure to use a duration of zero for the moves.
(5) Repeat for each scene.
(6) Start coding the rest of the game Methods.

Theoretically, the Dummies don't take much space and the transitions will be mostly instantaneous unless you want to throw in Billboards or Fade-ins/fade-outs.

Last edited by MrMoke; 06-30-2014 at 11:02 AM.
   
Reply With Quote
Hmm...
Old
jrrTolkien
Senior Member
 
jrrTolkien's Avatar
 
Status: Offline
Posts: 166
Join Date: Feb 2014
Location: Middle-Earth (Merrimack, NH)
Arrow Hmm... - 06-30-2014, 11:44 AM

Yeah, I tried that once and it made my code reeeeaaaally messy. Theoretically, it would work, though...

-jrr


Arwen: “I would rather share one lifetime with you than face all the Ages of this world alone.”

-April Signature
   
Reply With Quote
Interesting
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default Interesting - 06-30-2014, 02:30 PM

My test program that used an array of four objects, four parallel arrays of markers, and a single method to do the scene transitions took about 1.53MB.

Adding enough duplicate characters to accommodate the additional placements, but no additional code, raised the program size to 6.12MB.

A paltry 400% increase.
   
Reply With Quote
Its the names.
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default Its the names. - 07-04-2014, 04:14 PM

Quote:
Originally Posted by jrrTolkien View Post
Yeah, I tried that once and it made my code reeeeaaaally messy. Theoretically, it would work, though...

-jrr
I think this goes back to using some kind of naming convention to associate your dummy objects with their main objects and sequence in the movie. If one dummy object is used for several objects, then I would name it according to the location it represents. In short, come up with a naming system so that when you look at an object's name (dummy or otherwise) it gives you enough information to remember how it fits into the big picture.


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
True
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default True - 07-05-2014, 08:21 AM

Logical naming is definitely important for readability, especially for someone who might have to maintain your software at a later date. Always consider the people who might have to work on your stuff after you move on, and up, as Mark and I have over the years.

However, for this topic it would mean using multiple Dummy objects as place holders for specific objects that need to be reused at different locations as the world moves one scene to the next.

An easy process if you create a set of parallel arrays, and calls to a single relocate method that accepts a parameter for scene number.

As mentioned, it also saves a significant amount of memory by replacing objects with pointers, and reduces coding.

Structure and efficiency are also keys to success.

Last edited by MrMoke; 07-05-2014 at 08:32 AM.
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default 07-08-2014, 11:50 AM

Quote:
Originally Posted by MrMoke View Post
Logical naming is definitely important for readability, especially for someone who might have to maintain your software at a later date. Always consider the people who might have to work on your stuff after you move on, and up, as Mark and I have over the years.

However, for this topic it would mean using multiple Dummy objects as place holders for specific objects that need to be reused at different locations as the world moves one scene to the next.

An easy process if you create a set of parallel arrays, and calls to a single relocate method that accepts a parameter for scene number.

As mentioned, it also saves a significant amount of memory by replacing objects with pointers, and reduces coding.

Structure and efficiency are also keys to success.
So, if I understand you, there would be an array of dummy objects for each object that moves. The length of the array would be the number of scenes in the movie and you would create a world method called something like "setUpScene" and pass it the scene number.
setUpScene would go through each array setting each object's point of view to the dummy object in the corresponding array.

Is that the procedure you are describing?

Mark


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
On the first pass it was
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default On the first pass it was - 07-08-2014, 01:22 PM

An even better idea that I used to minimize the If Statements was to stack all of the Dummies in a single array, and then use the parameter to compute the offset starting point of the Dummy array.
It cut the sceneChanger method down to a single if/else statement followed by
one-line loop.
Almost as good as having a two-dimensional array

Last edited by MrMoke; 07-08-2014 at 01:29 PM.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.