Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Stonemonkey

Pages: [1] 2 3 4 5 6 7 8 ... 53
1
This is it on an electron emulator now, with double buffering and vsync, it has to clear the palette halfway down the screen to hide stuff and with a lack of decent timers in the electron that involves a delay loop to get it blanking in the right place so it's now running at 16.67fps

https://youtu.be/kuY20dXXdb8

2
It's software, no hardware tricks. I'm doing this to work on the Acorn Electron, it's  the BBC's slightly crippled little brother. The Electron was my first comp for Christmas '83 I think.
The BBC might be able to do this in hardware with some custom screenmodes but the Electron definitely couldn't, and the electron generally ran at about half the clock rate of the BBC.
Even though it was a bit crippled it was made to be compatible with the BBC and the memory layout for the screen was a bitch, it was designed more for text than graphics so each consecutive 8 bytes go down vertically then it jumps back up to the top of the next character (or half character depending on colour mode), in the mode I'm using it's just 4 colours and lowest res so each byte contains 4 pixels in a stupid layout, the rightmost pixel comes from bits 0 and 4 and left pixel bits 3 and 7, processing that for per pixel scrolling is way too much work for a 1MHz 6502 so I've created 4 buffers each at 2K to store the current screen then select which one to use depending on X AND 3 but the buffers have a more logical layout than the screen and I've come up with a way to copy them pretty quickly (am looking to see if I can speed it up a bit more too)
The other thing is that in the mode I'm using the pixels aren't square so I'm doubling them up one above the other to make them square which helps with speed and cuts down on the memory of my buffers.
Whatever I do with it it's just gonna end up half the screen height and not the full width either,  and just be 128x64 pixels (after doubling up)

3
Cool stuff, I'm planning on double buffering but at cost of halving the height of the display, got very little ram to play with, 32k total with 10k used by screen and some other used by OS. I think rotation might be a step too far for the 1MHz electron that I'm going to be putting this onto.

4
A peek at what I'm working on, this is on a BBC emulator that I'm using on my phone so I can do some coding wherever I go but will be moving it over to the electron emulator on the PC to see how that handles it. A scrolling demo that just wraps around at the moment and no vsync or anything so there's some screen tearing.

https://youtube.com/shorts/ZeoV1Q8p4jE?feature=share

5
I am back in time to my first comp again, the mighty acorn electron, to see what I can get it to do.
Unfortunately not the actual machine and just an emulator.

6
I am attempting to do something along the lines of this:

https://youtu.be/Jd3-eiid-Uw

Not with any Wii hardware though, some time ago I got a USB 3D camera attachment for  my phone and recently I tried connecting it to my PC and it shows up as 2 video devices, so I'm trying to use it to track my head. Also, I use a passive 3D TV as my monitor so my plan is to attach some LEDs to a pair of 3D glasses so I can do the headtracking along with stereoscopic rendering.
I've only started this over the past day or two and have something thrown together which shows promising results along with some problems to overcome.
Unfortunately I reckon it's probably quite a unique setup and not many people will have the hardware required for this.

7
General chat / Re: New 6502 based machine possibly.
« on: December 27, 2019 »
Hey Loopy, how's it going?

8
General chat / Re: New 6502 based machine possibly.
« on: October 26, 2019 »
Hi Nino, not sure if I'd come across the 8 bit guy before, as I just found him while I'm working on some 6502 stuff just now but he has some interesting videos and I like the look of the machine he's working on. I'm not too up on the intricacies of timing between parts of the systems but interesting to see some of it, I came across some vids of someone building their own CPU and display hardware too but can't remember what the channel was.

9
General chat / New 6502 based machine possibly.
« on: September 13, 2019 »
Hi all, how's everyone doing? Not been around for a long time so probably don't know many here. Hi Nick.
Something came up on YouTube, actually, I'd downloaded an emulator of my first computer and I've been attempting to do something on it so after looking some things up this guy came up as recommended and he's working on something I thought might be of interest here. He's designing a 6502 based machine and using currently available off the shelf chips for sound and graphics. It's still very much in the design phase and nothing is finalised but he goes into a fair bit of detail about it's current standing and his plans in part 2.

Part 1:
https://youtu.be/ayh0qebfD2g
Part 2:
https://youtu.be/sg-6Cjzzg8s

10
Game Showcase / Re: Andromeda Wing
« on: September 11, 2017 »
Even though I had an Amiga, I think I only ever played xenon 2 on the ST and even from such l long time ago I could see the influence on your game, looks great.

11
Projects / Re: starting with android
« on: September 05, 2017 »
Cool rbz, makes me wonder if there's a way parallax mapping could be used effectively in a sprite based game.

12
Projects / Re: starting with android
« on: September 05, 2017 »
Yep, it's fairly slow. A couple of areas to improve are height map traversal, at the moment it steps through the height map 1 step at a time. The other area is reworking it in inline asm, there is some asm but doing the whole inner loop should help things a bit.
I'll have a look at your work when I get home.

13
Projects / Re: starting with android
« on: September 03, 2017 »
Finally got round to porting this onto android, it works but is a bit slower than the pc version although some improvement should be possible. It's software rendered parallax mapping, each face of the cube is made of 2 tris with the depth effect created by the mapping.

Rotate your device onto its side to get fullscreen otherwise it'll be quite small.

When installing the apk, it will ask for permissions, the program does nothing dodgy but the app (c4droid) I'm using to write this automatically adds the permission requests.

https://drive.google.com/file/d/0B4tuUL8KZB7UR2ZCcld4S3hHYTg/view?usp=drivesdk

14
General chat / Re: The Welcoming Committee
« on: September 02, 2017 »
 :hi:

Good luck with getting back into the coding

15
I can imagine exactly what it's like, I used to build electronics stuff with various kits and breadboards. Mostly analog with some logic, never went as far as processors though.

It's surprising how simple the parallax mapping is to add, as long as your vectors are in texture space, it's just a case of casting the vector across each pixel until z>pixel height. Optimizing is more difficult and I've not really done that yet other than optimizing the loop as much as possible (using abrash's mmx trick for putting u and v together for texture lookup). But I need to look at the algorithm to see if there's any better way to speed it up.

The code is a huge mess but pm me if you want to have a look.

16
Hi nino, that project sounds pretty cool, ive always fancied trying putting some hardware together. Would be great to see your results.

The thing I'm working on, it was kind of by accident. I was working on normal mapping by transforming the light and camera vectors into texture space and interpolating them across the triangle for diffuse and specular lighting with a normal map mostly using SSE code. Then realised i had the camera vector in texture space and could raycast through the heightmap of the normal map, pretty much like casting through a voxel height terrain. Turns out it's very similar to parallax occlusion mapping done in pixel shaders.

17
Freebasic / Re: Dot Tunnel
« on: November 23, 2016 »
It's based on qbasic and I think you can still run qbasic code with some settings. It might depend how you code but I find it translates to c++ quite easily and writing in some assembly is pretty easy too.

18
Freebasic / Re: Dot Tunnel
« on: November 22, 2016 »
The'any' thing just means the value in memory isnt set at the declaration.

When you declare variables in a function, the compiler writes the function to take enough memory off the stack to store all the variables within a function, that part takes the same amount of time regardless of how many variables/arrays there are.  So there's no advantage to declaring global variables over local variables in a function.

But when there's something like this in a function

Dim as integer a,b

Then the function initialises them to 0 which has to be written into the memory the variable occupies.
However, using

Dim as integer a=any,b=any

When you dont care what the value is (in the code above, screeninfo writes the screen dimensions into the variables) you can use'any' and it just leaves whatever garbage is in the memory location.

The compiler also shares memory locations between variables in different scopes (inside FOR/NEXT WHILE/WEND IF/THEN/ENDIF etc.) and you can see what's where using any, I wouldn't recommend relying on such a thing to share data between scopes though.

Code: [Select]
sub test
    scope
        dim as integer a=123,b=456
    end scope
   
    scope
        dim as integer x=any,y=any
        print "any:  "x;":";y
    end scope
   
    scope
        dim as integer s,t
        print s;":";t
    end scope
end sub

test
sleep
end

my use of it there won't have much impact but there are times with declaring arrays or allocating memory where it could have a larger impact but you have to be sure that you're not relying on any element within an array or chunk of memory being zero initially.

19
Freebasic / messing around with dot tunnel code
« on: November 22, 2016 »
what started out as meant to be some sort of tunnel code but with some modification. No idea what it is.

Code: [Select]
const pi2=3.141592*2.0

type star
as single x,y,z
as ulong colour(0 to 100),shade
as single radius
as single num_points
end type

type starfield
as integer num_stars
as star ptr star_list
as single max_z,min_z,z_speed
as ulong colourmap(0 to 255)
as ulong colourindex(0 to 100)
as ulong colourdelta(0 to 100)
end type

function create_starfield(byval num_stars as integer,_
byval radius as single,_
byval num_points as single,_
byval max_z as single,_
byval min_z as single,_
byval z_speed as single)as starfield ptr
dim as starfield ptr starfield=new starfield
starfield->star_list=new star[num_stars]
for star as integer=0 to num_stars-1
starfield->star_list[star].radius=radius+radius*sin(star/num_stars*pi2)
starfield->star_list[star].num_points=num_points
starfield->star_list[star].z=min_z+((max_z-min_z)/num_stars)*star
next
starfield->max_z=max_z
starfield->min_z=min_z
starfield->z_speed=z_speed
starfield->num_stars=num_stars
for i as integer=0 to 255
    dim as ulong red,gre,blu
    red=128+127*sin(i/256.0*3.141592*4)
    gre=128+127*sin(i/256.0*3.141592*2)
    blu=128+127*cos(i/256.0*3.141592*2)
    starfield->colourmap(i)=(red shl 16)or(gre shl 8) or blu
next
for i as integer=0 to 100
    starfield->colourindex(i)=rnd*&hffff
    starfield->colourdelta(i)=rnd*&hfff
next
return starfield
end function

sub process_starfield(byval starfield as starfield ptr)
static as single angle=0
static as single amplitude_angle=0
static as single horizontal_angle=0
static as single vertical_angle=0
for star_count as integer=0 to starfield->num_stars-1
dim as star pointer star=@starfield->star_list[star_count]
star->z-=starfield->z_speed
star->x+=(rnd-.5)*10.0
star->y+=(rnd-.5)*10.0
star->shade=(star->shade*&hfa)shr 8
if star->z<starfield->min_z then
    for i as integer=0 to star->num_points-1
        star->colour(i)=starfield->colourmap(starfield->colourindex(i) shr 8)
        'starfield->colourindex(i)=(starfield->colourindex(i)+starfield->colourdelta(i))and &hffff
    next
   
star->shade=&hffff
star->z+=starfield->max_z-starfield->min_z
star->x=(100+300*sin(amplitude_angle))*sin(angle)+300*sin(horizontal_angle)
star->y=(100+300*sin(amplitude_angle))*cos(angle)+300*sin(vertical_angle)

angle+=0.01
amplitude_angle+=.0086
horizontal_angle+=.013
vertical_angle+=0.0043

end if
next

    for i as integer=0 to 100
        'star->colour(i)=starfield->colourmap(starfield->colourindex(i) shr 8)
        starfield->colourindex(i)=(starfield->colourindex(i)+starfield->colourdelta(i))and &hffff
    next
   
end sub

sub draw_starfield(byval starfield as starfield pointer)
dim as integer w=any,h=any
screeninfo (w,h)
for star_count as integer=0 to starfield->num_stars-1
dim as star pointer star=@starfield->star_list[star_count]
for p as single=0 to star->num_points-1
dim as single x=(w shr 1)+w*(star->x+star->radius*sin(p*pi2/star->num_points))/star->z
dim as single y=(h shr 1)-w*(star->y+star->radius*cos(p*pi2/star->num_points))/star->z
dim as ulong c=star->shade shr 8
dim as ulong col=star->colour(p)
pset (x,y),((((col and &hff00ff)*c)and &hff00ff00)or(((col and &hff00)*c)and &hff0000))shr 8
next
next
end sub

sub main
screenres 640,480,32,2
screenset 0,1
dim as starfield ptr starfield=create_starfield(300,400,7,2000,10,50)
for i as integer=0 to 1000
process_starfield(starfield)
next
dim as single t=timer
while inkey<>chr(27)
    while t<timer
        process_starfield(starfield)
        t+=0.02
        wend
draw_starfield(starfield)
flip
cls
wend
end sub

main

or

Code: [Select]
const pi2=3.141592*2.0

type star
as single x,y,z,rotation
as ulong colour(0 to 100),shade
as single radius
as single num_points
end type

type starfield
as integer num_stars
as star ptr star_list
as single max_z,min_z,z_speed
as ulong colourmap(0 to 255)
as ulong colourindex(0 to 100)
as ulong colourdelta(0 to 100)
end type

function create_starfield(byval num_stars as integer,_
byval radius as single,_
byval num_points as single,_
byval max_z as single,_
byval min_z as single,_
byval z_speed as single)as starfield ptr
dim as starfield ptr starfield=new starfield
starfield->star_list=new star[num_stars]
for star as integer=0 to num_stars-1
starfield->star_list[star].radius=radius+radius*sin(star*pi2/num_stars)
starfield->star_list[star].rotation=star*pi2/num_stars*2
starfield->star_list[star].num_points=num_points
starfield->star_list[star].z=min_z+((max_z-min_z)/num_stars)*star
next
starfield->max_z=max_z
starfield->min_z=min_z
starfield->z_speed=z_speed
starfield->num_stars=num_stars
for i as integer=0 to 255
    dim as ulong red,gre,blu
    red=128+127*sin(i/256.0*3.141592*4)
    gre=128+127*sin(i/256.0*3.141592*2)
    blu=128+127*cos(i/256.0*3.141592*2)
    starfield->colourmap(i)=(red shl 16)or(gre shl 8) or blu
next
for i as integer=0 to 100
    starfield->colourindex(i)=rnd*&hffff
    starfield->colourdelta(i)=rnd*&hfff
next
return starfield
end function

sub process_starfield(byval starfield as starfield ptr)

static as single angle=0
static as single amplitude_angle=0
static as single horizontal_angle=0
static as single vertical_angle=0
for star_count as integer=0 to starfield->num_stars-1
dim as star pointer star=@starfield->star_list[star_count]
star->z-=starfield->z_speed
star->x+=(rnd-.5)*10.0
star->y+=(rnd-.5)*10.0
star->shade=(star->shade*&hf0)shr 8
if star->z<starfield->min_z then
    for i as integer=0 to star->num_points-1
        star->colour(i)=starfield->colourmap(starfield->colourindex(i) shr 8)
        'starfield->colourindex(i)=(starfield->colourindex(i)+starfield->colourdelta(i))and &hffff
    next
   
star->shade=&hffff
star->z+=starfield->max_z-starfield->min_z
star->x=(100+300*sin(amplitude_angle))*sin(angle)+300*sin(horizontal_angle)
star->y=(100+300*sin(amplitude_angle))*cos(angle)+300*sin(vertical_angle)

angle+=0.01
amplitude_angle+=.0086
horizontal_angle+=.013
vertical_angle+=0.0043

end if
next

    for i as integer=0 to 100
        'star->colour(i)=starfield->colourmap(starfield->colourindex(i) shr 8)
        starfield->colourindex(i)=(starfield->colourindex(i)+starfield->colourdelta(i))and &hffff
    next
   
end sub

sub draw_starfield(byval starfield as starfield pointer)
dim as integer w=any,h=any
screeninfo (w,h)
for star_count as integer=0 to starfield->num_stars-1
dim as star pointer star=@starfield->star_list[star_count]
for p as single=0 to star->num_points-1
dim as single x=(w shr 1)+w*(star->x+star->radius*sin(star->rotation+p*pi2/star->num_points))/star->z
dim as single y=(h shr 1)-w*(star->y+star->radius*cos(star->rotation+p*pi2/star->num_points))/star->z
dim as ulong c=star->shade shr 8
dim as ulong col=star->colour(p)
pset (x,y),((((col and &hff00ff)*c)and &hff00ff00)or(((col and &hff00)*c)and &hff0000))shr 8
next
next
end sub

sub main
screenres 640,480,32,2
screenset 0,1
dim as starfield ptr starfield=create_starfield(800,180,12,1000,10,10)
for i as integer=0 to 1000
process_starfield(starfield)
next
dim as single t=timer
while inkey<>chr(27)
    while t<timer
        process_starfield(starfield)
        t+=0.02
        wend
draw_starfield(starfield)
flip
cls
wend
end sub

main


20
Freebasic / Re: Dot Tunnel
« on: November 22, 2016 »
Here's a quick example of the sort of way I would do it, it's maybe not exactly the sort of dot tunnel you're after but it should be easy to modify although everyone's got different styles of coding.

Code: [Select]
const pi2=3.141592*2.0

type star
    as single x,y,z
    as single radius
    as single num_points
end type

type starfield
    as integer num_stars
    as star ptr star_list
    as single max_z,min_z,z_speed
end type

function create_starfield(byval num_stars as integer,_
                            byval radius as single,_
                            byval num_points as single,_
                            byval max_z as single,_
                            byval min_z as single,_
                            byval z_speed as single)as starfield ptr
    dim as starfield ptr starfield=new starfield
    starfield->star_list=new star[num_stars]
    for star as integer=0 to num_stars-1
        starfield->star_list[star].radius=radius
        starfield->star_list[star].num_points=num_points
        starfield->star_list[star].z=min_z+((max_z-min_z)/num_stars)*star
    next
    starfield->max_z=max_z
    starfield->min_z=min_z
    starfield->z_speed=z_speed
    starfield->num_stars=num_stars
    return starfield
end function

sub process_starfield(byval starfield as starfield ptr)
    static as single angle=0
    static as single amplitude_angle=0
    static as single horizontal_angle=0
    static as single vertical_angle=0
    for star_count as integer=0 to starfield->num_stars-1
        dim as star pointer star=@starfield->star_list[star_count]
        star->z-=starfield->z_speed
        if star->z<starfield->min_z then
            star->z+=starfield->max_z-starfield->min_z
            star->x=(100+300*sin(amplitude_angle))*sin(angle)+300*sin(horizontal_angle)
            star->y=(100+300*sin(amplitude_angle))*cos(angle)+300*sin(vertical_angle)
        end if
    next
    angle+=0.1
    amplitude_angle+=.086
    horizontal_angle+=.03
    vertical_angle+=0.043
end sub

sub draw_starfield(byval starfield as starfield pointer)
    dim as integer w=any,h=any
    screeninfo (w,h)
    for star_count as integer=0 to starfield->num_stars-1
        dim as star pointer star=@starfield->star_list[star_count]
        for p as single=0 to star->num_points-1
            dim as single x=(w shr 1)+w*(star->x+star->radius*sin(p*pi2/star->num_points))/star->z
            dim as single y=(h shr 1)-w*(star->y+star->radius*cos(p*pi2/star->num_points))/star->z
            pset (x,y),&hffffff
        next
    next
end sub

sub main
    screenres 640,480,32,2
    screenset 0,1
    dim as starfield ptr starfield=create_starfield(800,200,50,100000,10,100)
'dim as starfield ptr starfield=create_starfield(400,200,50,2000,10,60)
    for i as integer=0 to 1000
        process_starfield(starfield)
    next
    while inkey<>chr(27)
        process_starfield(starfield)
        draw_starfield(starfield)
        flip
        cls
    wend
end sub

main

Pages: [1] 2 3 4 5 6 7 8 ... 53