News:

Look at this spiffy theme!

 

Akalabeth Stuff (Ultima 0)

Started by RT-55J, Wed, 2025 - 09 - 24, 11:37 PM

Previous topic - Next topic

RT-55J

Quote from: RT-55J on Sat, 2025 - 10 - 04, 11:21 PMINT(RND(1)^5 * 4.5)

Okay. I did some spreadsheet tomfoolery and approximated the distribution of integers from that function with this daisy-chained IF-ELSE series:

#A = RANDOM ' Random 16-bit number

IF #A < 42231 THEN
    TerrainMap(X+Y*OVERWORLD_SIZE) = 0
ELSEIF #A < 52608 THEN
    TerrainMap(X+Y*OVERWORLD_SIZE) = 1
ELSEIF #A < 58267 THEN
    TerrainMap(X+Y*OVERWORLD_SIZE) = 2
ELSEIF #A < 62323 THEN
    IF RANDOM(2) = 1 THEN
        TerrainMap(X+Y*OVERWORLD_SIZE) = 3
    ELSE
        TerrainMap(X+Y*OVERWORLD_SIZE) = 0
    END IF
ELSE
    TerrainMap(X+Y*OVERWORLD_SIZE) = 4
END IF

The results look a bit better.

RT-55J

Note: I just profiled the performance of the world generator. My version (compiled with CVBasic and not using floating point arithmetic) takes 12 frames. The original version takes around, I dunno, 33-ish seconds. That's like 150 times faster.

RT-55J

everybody movement

neen


RT-55J

The people crave to pass the mountains.

RT-55J

Anyhow, I was trying to figure out how to print a string at a pointer, and learned a distressing truth:

https://github.com/nanochess/CVBasic/blob/master/examples/strings.bas

' This is a macro, CVBasic doesn't process strings

neen


RT-55J

Okay I got a proof-of-concept working for the proper zoomed-in overworld view (TODO: render the player).

This feels dizzyingly fast, for the record.

RT-55J

I swear, either I'm not understanding how CVBasic handles strings and pointers, or the language is genuinely hampered in those respects. (I swear both C and assembly would both be easier to handle here.)

Maybe I should ask for help idk.

neen

is cvbasic the only basic fit for the job? idk how to help  :pensive:

RT-55J

I'm not fond of how it works, but I cribbed the "get_string(where, num)" macro from the strings.bas and it suits my purposes well enough.

The majority of the text here is stored in "arrays" of strings (that is to say, they are a contiguous set of strings, separated by null terminators (the get_string macro iterates from the beginning of the list it's given every time to get the desired string (rather than do something reasonable like dereferencing a pointer or something (I cannot stress how much less this would bother me if I was programming in C or ASM here)))).

tl;dr I got it working how I want, from a "replacing lines of BASIC code" and a player-view perspective. The issue is that I do not like how the solution works between those two points (many such cases).

RT-55J

tonight i put a player sprite on the overworld

also here's a gif to give you an idea of what i meant by "dizzyingly fast"

RT-55J

The shop is pretty functional at this point. That cursor there should be pretty generalizable too!

The main issue is that CVBasic doesn't let me easily tap the rising edge of inputs, so I have to put in some ugly delays to prevent it from being unusably fast. I need to find a more rigorous approach here.

The stats here are simply RANDOM(21)+4. The original code is SQR(RND(1))*21+4 to slightly nudge the distribution towards the upper end of the range. I'm not sure what the best approach to replicate this would be, without floating point math...

RT-55J

Note to self: Get an Apple II emulator set up so I can investigate the dungeon rendering code directly.

RT-55J

You can roll your stats and select a class.

The first two parts of the this screen (selecting an RNG seed and selecting a difficulty level) are not implemented because I haven't coded a number selecting widget.