BBC BASIC for Windows
« 3D Gaming Project »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:45pm



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 1767 times)
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.
Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

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

Think this is the right link

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

Try solid and line, check in box does not work yet I know.

I have started to implement object scaling with top slider, it does not work yet!

Sorted typo DDRM
User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Re: 3D Gaming Project
« Reply #61 on: Aug 17th, 2016, 09:40am »

Hi Ric,

That's coming along nicely - once I worked out that I now had to release the individual components using the button in the characteristics box (after saving!). Your code may be quick, but I am slow...

Are the nets for the individual components stored as an array? If the centre of the object is at (0,0,0) then scaling should be a simple matrix multiplication, but otherwise you may need a multiplication plus an offset.

Getting more demanding, would it be possible to make the sliders usable for both the individual component or the composite at the same time? It would be useful to be able to rotate the assembly to check on 3d positioning of each component as you add it. I wondered about using shift, for example. I can see that there's an issue that the slider would keep moving about... Alternatively, put a separate set of sliders on the characteristics box to move/scale the component?

Will it be possible to select and move individual nodes (and/or groups of nodes) of objects, so we can, for example modify a standard cube into a rhombus, or something?

I assume object 1 is the grid, which makes sense from your point of view, but feels a bit counterintuitive to the user. (I presume it won't form part of the final object you save). Could the display show "object 1" for my first added object, even if behind the scenes it's object(2)?

Best wishes,

D
User IP Logged

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