Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:13 16 Feb 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Dev Diary: Space RPG - Definitely not Star Trek.

     Page 4 of 4    
Author Message
PeteCotton

Guru

Joined: 13/08/2020
Location: Canada
Posts: 456
Posted: 06:48pm 15 Feb 2025
Copy link to clipboard 
Print this post

  George H said  That video is really cool Pete!  Very inspiring!


Thank you very much George.
 
PeteCotton

Guru

Joined: 13/08/2020
Location: Canada
Posts: 456
Posted: 05:50am 16 Feb 2025
Copy link to clipboard 
Print this post

Today's update was a bit more involved than I had expected.

It started off innocently enough. I only hold the local star system in memory, and keep the star systems not being used, on the SD card. So, if you jump from one star system to another, I save the current star system data (about 1 second) and then load the next star system (about another second). This is an unacceptable delay, so I sat down today and re-wrote the save and load routines, and by compacting the data down (i.e. ignoring bits of space with nothing in it) I got it down to 300ms for save and 150ms for load. Much more acceptable.

But this task highlighted something that has been gnawing away at me. I use arrays for everything, and because I'm a C/C# programmer - I use base zero arrays (i.e. the first element in array X is X(0) as opposed to base 1 arrays where the first element would be X(1)).

This is no problem for the CMM2, which is happy with either. However, most BASIC languages only allow base 1 arrays. And if anyone ever want to convert Mascii-Trek to another platform they would have to fix this - and these arrays are everywhere in the code. Of course, I could ignore this problem (this is not my issue) - but I figured that as the program grew, this problem would only get bigger and bigger for the person doing the converting. There's also that nagging feeling that by not taking the time to fix it, I was taking a short cut.

So I took a backup of everything (just in case) and started "fixing" the whole program to work with base 1 arrays. Here we are, 3 hours later - and it's finally done. It seems to work just as it did before, and now I can relax in the knowledge that it's not something that will gnaw away at my conscience anymore. I also set the "OPTION BASE 1" at the start of the program, to make sure I don't slip back into old habits by accident  

As an aside, I couldn't work out how to read multiple variables with the INPUT # command. It's not a big deal, as I just ended up putting each variable on a new line - but I'm assuming I'm missing something fundamental. I'll start another thread for it.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7151
Posted: 08:27am 16 Feb 2025
Copy link to clipboard 
Print this post

Interesting...
All the BASIC versions I've used have defaulted to base zero, I think.
Anyway, taking 2 seconds to fly between star systems seems fairly acceptable. :)

Interesting info on arrays

EDIT - deleted some wrong info. :)
.
Edited 2025-02-16 18:37 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
     Page 4 of 4    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2025