Is there any way to speed up the processing of code? (Sample Programs)

by Joseph_f2, Wednesday, March 25, 2015, 13:11 (826 days ago)

I do have the full code but it's not done/working right now so here's a example of it, this is going to be a Castle Wolfenstein type game, with X Y and Z, why make it in BASIC because I have a BASIC interpreter on my iPhone 3G(Running Whited00r).

Just so you know I have not tested this but it's only a example of my code, any thing you need know just ask.
------------------------------------------------------------------------------------------

What can I do to speed this up?:

REM This is just some of my code.
REM Variables:

REM mapN is short for Map North, other map variables would be in this just but I don't
REM it's think's needed, like mapS, mapW, mapE.
Dim mapN(1, 1) REM Make a mapN array with the size of 1, 1 I think it's the minimum size I REM can set it to

REM The Size of the map.
mapSize = 0


REM -------------------------
REM Program start's here:
REM -------------------------
Gosub Initialize


loop:

Gosub Logic REM Goes to the Logic sub.
Gosub Draw REM Goes to the Draw sub.

Goto loop

Initialize:

REM Finds a free file number to use for the map file.
fileNumber = freeFile

REM Open's Map1.txt at fileNumber.
open fileNumber, "Map1.txt"

REM Change the Map Size.
mapSize = int(read(fileNumber))

REM Change the Size of mapN array to mapSize(Take a look at my map file for info)
Redim mapN(mapSize, mapSize)

REM -----------------------------------
REM The main thing that slow's my game:
REM I repeat this a 4 times for each map variable, so once for mapN, mapS, mapW, mapE

For column = 0 to mapSize
For row = 0 to mapSize

mapN[column, row] = int(read(fileNumber))

Next row
Next column

close fileNumber

Return

Logic:

REM Logic goes here.

Return

Draw:

REM Draw images.

Return

----------------------------------------- Map info ------------------------------------------
What my map file looks like if you want to know:
Stuff starting with "//" is not part of my map file it's just comment.

10 //Map Size as 10 by 10.
1 0 0 0 0 0 0 0 0 1 //1 is a wall and 0 is nothing, other number will utilise later.
1 0 0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 1 1 1 1 1 1 1
1 0 0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 1 1 1


Complete thread:

 RSS Feed of thread

powered by my little forum