Qbasicnews.com

Full Version: Have evil memory issues claimed yet another project?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I hope not. The RTS was going well until... memory problems started popping up. String space and the like.

I frown. I fix. More problems come up. I begin screaming at nobody in particular, etc, etc...

Until I start to look over the code. First, some of the varibles are pretty badly named, I'm not sure what I'm doing there myself; Second, some of the code is really badly done, and seemingly unrecoverable.

Total projects completed to date: 2

(fumes)
Heh, me and neo have no problems with mem Wink.

The "project" is about 7 modules big, and we have 18XXB stack, 35X,XXX array and 5X,XXX string mem left Wink

Use Med. It solved all our problems Wink. With modules of course.
Isn't QB wonderful? :lol:
Im really gonna have to finish QBDBZ one of these days so I can show how I used my memory routines to store all of the large tables needed for the game.

For example, each player can have upto 100 moves defined (complex moves are made by grouping several simpler ones) and each move takes about 66 bytes of information, so that gives:
Code:
100 * 2 * 66 = 13200 bytes

Each move also has an associated list of frames, which stores the sprite to use, the time till the next frame should be displayed and whether or not this frame is a hit or block frame. This takes up:
Code:
100 * 2 * 60 = 12000 bytes

Each of the players sprites (upto 300) also has a structure associated with it for defining the collision boxes etc, these are 38 bytes big so:
Code:
300 * 2 * 22800 bytes


Which gives a total so far of:
Code:
22800 + 12000 + 13200 = 48000 bytes

Thats already pretty big (for QB anyway ;-)) and thats only some of the data that is loaded into memory for the game. Because of the memory routines however, almost all of my conventional memory is still free, which means I can use it for other things such as DQB's blender maps.
*frowns* This thing is unsalvagable. -_-
You could try these memory routines out. They allow you to use functions similar to C's malloc and free to access extended memory and store data. When you want to use the data, you can use the load and store instructions to temporarily work with the data in a normal structure.

It may take a bit of work to incorporate them into your project, but you can store things like maps, player data, text, etc all in extended memory. Ive written a small help file and included an example source file using the routines, but if you want to use them and get stuck, I'll gladly help out.
You may also want to optimize your code. It helps to cut down on memory usage =).