BBC BASIC for Windows
« 3D Gaming Project »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:50pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1 2 3 4 5 6  ...  8 Notify Send Topic Print
 veryhotthread  Author  Topic: 3D Gaming Project  (Read 1745 times)
Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Re: 3D Gaming Project
« Reply #45 on: Jun 19th, 2016, 10:35pm »

Here is the latest incarnation.

The two objects are now truly independent and any number can now be produced, laborious to set up and a design package will be the next stop. I have said that before, but this time I think I mean it?

When running the program the keys

Z rotates anticlockwise from above
X rotates clockwise from above
' rotates up
/ rotates down

and spacebar exits to BASIC control

https://my.pcloud.com/publink/show?code=XZEp9hZYDnEkKPF3MRtLkVFo6uyI5b4pbky
User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: 3D Gaming Project
« Reply #46 on: Jun 20th, 2016, 01:38am »

That's pretty impressive. Now you got me determined to get my example done..
( some people may say its cheating, but I really think that the first DOOM game was made the same way as I am doing my 3D.. Especially since the technology for imaging has been around since the 80s.)

And probably everyone will agree with my strategy and then we can make a game and link it on Richards forum in executable form and when he runs it he will be fooled into thinking that we cracked the 3D world.

But then he probably has a way of figuring out that it was done with 3D image trickery.

Of course if he remembers email concerning my plans, he may just figure it out and respond.. But I will not say what it was unless he figures it out.

Also a mention I didn't post my advancement in ASM after Richard had helped with the memory allocation, but I did advance. Here is where I landed with ASM so far.
( controlling graphics would be the end game, but the next task would be to do multiple variable compares and multiple condition jumps.)


Code:
    
 PRINT "Please wait for increment to 2 million"
      PROCassemble
      bcd%=2000000
      bin%=0
      REM REPEAT
      CALL bin2bcd
      REM UNTIL bin%=2000000
      PRINT bin%
      PRINT "DONE"
      END

      DEF PROCassemble
      LOCAL P%, L%, gap%
      DIM gap% &7FF, P% &7FF, L% &7FF
      [OPT 10
      .bin2bcd
      mov eax,[^bin%]
      mov ebx,[^bcd%]
      .loop
      inc eax
      cmp eax,ebx
      jle loop
      mov [^bin%],eax
      ret
      ]
      ENDPROC
  


« Last Edit: Jun 20th, 2016, 02:40am by michael » User IP Logged

I like making program generators and like reinventing the wheel
Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Re: 3D Gaming Project
« Reply #47 on: Jun 20th, 2016, 07:05am »

Morning Michael,
You will have to help me a little, I have had no contact with computer games for 30 years, What is Doom? I have seen some posters, but know no more.
Your loop does what it says it counts to 2000001 and stops.
What do you need help with?
If you want it to stop at 2000000 change the jle loop to jne loop. This will keep looping while bin% and bcd% are not equal.
The variables you have used imply you want to turn binary in to binary coded decimal?


Try this code

Code:
      DIM code% 200                           : REM always reserve too much
      DIM test 100                            : REM reserve memory for variables (the assembler routine used here only needs 12 bytes, memory is cheap, reserve too much)
      !test=0                                 : REM make memory location (32bit dword startimg at test) equal 0
      !(test+4)=2000000                       : REM make memory location (32bit dword startimg at test+4) equal 2000000  (The +4 is in bytes ie 32bits displacement)

      FOR I% = 0 TO 3 STEP 3
        P% = code%
        [
        opt I%
  
        .start
  
        mov           eax,          [test]    ; REM moves the number stored in memory location test to eax
        mov           ebx,          [test+4]  ; REM moves the number stored in memory location test+4 to eax
  
        .loop
  
        inc           eax
        cmp           eax,          ebx
        jne           loop                    ; REM repeats until they are equal
  
        mov           [test+8],     eax       ; REM stores eax in memory location test+8
  
        ret
  
        ]
      NEXT I%

      CALL start
      PRINT "Done ";!(test+8)
 


There is really elegant way using the ecx register if all you want to do is create a loop.

Ric
« Last Edit: Jun 20th, 2016, 07:29am by Ric » User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: 3D Gaming Project
« Reply #48 on: Jun 20th, 2016, 1:44pm »

Here is a vid of the version of DOOM I am speaking of

https://www.youtube.com/watch?v=PEbLOnvCckA

User IP Logged

I like making program generators and like reinventing the wheel
Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Re: 3D Gaming Project
« Reply #49 on: Jun 20th, 2016, 4:25pm »

Can't see a reason why that's not achievable. The routines I am developing are to display true colour sprites in HD. So even if we can't get the initial speed, to replicate the graphics in that demo we could simply change the density to increase speed.

Did the code help or are you further on by now?

Ric
User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: 3D Gaming Project
« Reply #50 on: Jun 20th, 2016, 5:15pm »


I guess the next question would be:
What if I wanted to create more than one condition?

The idea being that I might want to check more than one set of values or boundaries.
This is just one condition and one result label:

cmp eax, ebx
jne loop


And I may be jumping a bit too high on this, but what about controlling the location of an object (pointer or even a sprite) or say drawing in assembly?

(seems to be the holy grail according to Richard, as he voiced his feelings about that on his forum)

But I would like to know that also.



Oh and how much memory can I reserve and how does that apply to huge information ?


Code:
 DIM code% 200                           : REM always reserve too much
      DIM test 100                            : REM reserve memory for variables (the assembler routine used here only needs 12 bytes, memory is cheap, reserve too much)
      !test=0                                 : REM make memory location (32bit dword startimg at test) equal 0
      !(test+4)=2000000                       : REM make memory location (32bit dword startimg at test+4) equal 2000000  (The +4 is in bytes ie 32bits displacement)

      FOR I% = 0 TO 3 STEP 3
        P% = code%
        [
        opt I%
  
 
« Last Edit: Jun 20th, 2016, 5:33pm by michael » User IP Logged

I like making program generators and like reinventing the wheel
Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Re: 3D Gaming Project
« Reply #51 on: Jun 20th, 2016, 5:31pm »

If you think of asm as really simple BASIC, this will probably help your understanding. If you want to test more conditions you simply load the test condition and sample it again and then use another branch, sorry jump.

In essence cmp sets the flags and all the operands beginning with j are IF statements with a THEN condition.

I am out for the evening but will send you the PDF of the asm code I used to reference each oppose.

Ric
User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Re: 3D Gaming Project
« Reply #52 on: Jun 22nd, 2016, 9:32pm »

Michael,
This is the reference I used

http://www.gabrielececchetti.it/Teaching/CalcolatoriElettronici/Docs/i8086_instruction_set.pdf

Also look up simply fpu

Ric
User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: 3D Gaming Project
« Reply #53 on: Jun 24th, 2016, 02:21am »

Thanks. I will study this.
User IP Logged

I like making program generators and like reinventing the wheel
David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: 3D Gaming Project
« Reply #54 on: Jun 24th, 2016, 04:23am »

One idea that could save you a great deal of time, energy and potentially stress (!), is to write speed-critical code in C (or C++), compile it as a DLL and load it into your BB4W as a library, or have the C compiler generate the assembler code. Now, I realise there's an argument as to whether C compilers generate better quality (or more optimal) code than you can with hand-crafted assembly language, but often the C compiler will produce better code because it knows how to sequence (or pipeline) machine code instructions for more efficient execution (fewer stalls, etc.). What you can achieve in a few lines of C in just a few minutes can potentially take hours with assembler code (most of that time debugging), even for relatively experienced Asm coders. Some of my C-coded graphics routines (often written in the space of a few minutes!) are actually faster than their hand-coded Asm equivalents, and that's probably down to better register usage and better pipelining by the C compiler. I learnt the rudiments of C in a few days, so if I can do it.... then so can anyone! BB4W, assembly language and C (via DLLs or assembler code dumps) is such a pleasant and powerful combination.

Check out this program which includes assembly language generated by the GCC C compiler. I remember being very pleased with its efficiency:

http://bb4w.conforums.com/index.cgi?board=assembler&action=display&num=1407003986


I recently renewed my interest in learning C, specifically for the purpose of creating DLLs to be loaded into BB4W, and generating assembly language dumps. It will save so much time and hassle.


David.
--
User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: 3D Gaming Project
« Reply #55 on: Jun 24th, 2016, 04:40am »

Nice code link. I will study that.

« Last Edit: Jun 24th, 2016, 04:56am by michael » User IP Logged

I like making program generators and like reinventing the wheel
Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Re: 3D Gaming Project
« Reply #56 on: Aug 9th, 2016, 8:53pm »

Evening all, its been a long time since the last update, but babies do that to you. If you download this link :-

https://my.pcloud.com/publink/show?code=XZDWdfZJHmqlabpYsbdSKECmqxqIXvQXGoX

it should be the first stages of a 3D design package for BB4W.

Have a play and any feed back would be greatly appreciated.

The only menu driven item that works is:-

Add Object > Quick > huhhuh

The rotation is about the screen axis at the moment and this means that if you do not reverse the steps of each rotation then if you get back to x=0 y=0 z=0 then this might not be the true start position. I will sort the rotation later.

If you left click on the centre node of an object and hold it can be moved in the screen xy plane if you right click on the centre node then the object becomes the centre of focus. Left click on the node again to release it.

Happy playing

Ric.
User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: 3D Gaming Project
« Reply #57 on: Aug 10th, 2016, 10:15am »

Awesome work
User IP Logged

I like making program generators and like reinventing the wheel
DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Re: 3D Gaming Project
« Reply #58 on: Aug 15th, 2016, 3:51pm »

Hi Ric,

That's very impressive!

I like the way you can select and manipulate a single object independently by right-clicking it. Would it be nice to change the top slider from moving the whole view nearer/further, and use it to change the absolute size of the object in this mode?

Presumably in due course we will be able to change the colour of the predefined objects, and to save them as a custom graphics file of some kind?

There's a typo in your title... wink

Best wishes,

D
User IP Logged

Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Re: 3D Gaming Project
« Reply #59 on: Aug 16th, 2016, 4:56pm »

That's a good idea, shouldn't be to difficult to implement. I have the colour version ready to go apart from node highlighting. Will post it tonight.
User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
Pages: 1 2 3 4 5 6  ...  8 Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls