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  ...  8 Notify Send Topic Print
 veryhotthread  Author  Topic: 3D Gaming Project  (Read 1743 times)
DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Re: 3D Gaming Project
« Reply #15 on: Mar 1st, 2016, 08:14am »

Hi Ric,

That looks pretty impressive! If you can really redraw it in one centisecond that gives you quite a bit in hand to actually run the game.

Loading bitmaps: yes, several options. You can use:

*LOAD to load a file to a memory address (you would need to reserve enough space first)

*DISPLAY will load a bitmap file and stick it on the screen - I suspect you may be able to use that to load the image into a DIBSection you could manipulate, but I don't offhand know if you could do that without it appearing on the display - my guess is that it will get loaded into whatever bitmap is selected to the BB4W device context. You might be able to do it by
doing *REFRESH OFF,
selecting the DIBSection into the device context
*DISPLAYing your picture
Deselecting it and reselecting the default display bitmap

In the manual, under "displaying GIF and JPEG images", there is a more general routine for loading an image. If you look at the line

SYS !(!gpp%+32), ....

You will see you specify a device context to render to: in this case memhdc%. I suspect if you had another device context with your DIBSection you could specify that here, and thus be able to load a wide range of picture types to it, to work on "offscreen". Note that that call also appears to allow you to scale the input image to output bitmap (or part of it).

Hope that's helpful. If David Williams is still reading, he might have better ideas.

D
User IP Logged

Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Re: 3D Gaming Project
« Reply #16 on: Mar 1st, 2016, 5:59pm »

Thanks D
I will look into the *DISPLAY method as that would enable a straight edit on the screen.

With regards to the speed of the assembler routine, I have calculated that in order to fill the whole screen I can only refresh about 10fps without any gaming instructions. Really this needs to be upwards of 40fps for HD games so a faster routine is required, I am working on floating point calculations, but never done before so may be a while.
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 #17 on: Mar 23rd, 2016, 09:01am »

Thanks for the hint D, I now have a picture of my son rotating on the cube. The routine to print the sprites is now a combination of asm and fpasm. With no gaming code yet it will run at approx. 55fps. Not bad but I was hoping for more. It is now to big to add here as a code snippet (approx 40000 chars) so I will look for another method of distribution.
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 #18 on: Mar 23rd, 2016, 9:50pm »

DDRM would know how the following technique could be done in BBC basic, or perhaps Richard would know.
1) offset a secondary window for the size of image you want to create
2) capture the image in a sprite
3) post the sprite on the main display window
4) clear the offset window and repeat
This would create flicker free animation and would allow redraws to be done off screen
Also, this would minimize memory use because you are using the same sprite for image capture/ transfer/ display
« Last Edit: Mar 23rd, 2016, 9:53pm 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 #19 on: Mar 24th, 2016, 5:20pm »

Thanks Michael,
I am sure for a man moving across the screen that would work, but the 55fps is for the whole screen rendering a 3d landscape like most modern games. My calculations work out that this will drop to 40fps with game play code. The sprite in question is just one of many used to create the landscape, and using the four corners as nodes can be skewed to create full 3d with depth perception. Originally my challenge to myself was to learn asm and write a 3d game, it's going OK so far. If I moved to a modern laptop this would aid speed as mine currently is a measly 1.9Ghz.
Regards 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 #20 on: Apr 24th, 2016, 9:12pm »

If anyone is still following this link, this is wherein am up to.

https://youtu.be/G-qFv_-0W3Y
User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
Wildmooer
New Member
Image


member is offline

Avatar




PM


Posts: 7
xx Re: 3D Gaming Project
« Reply #21 on: May 2nd, 2016, 2:33pm »

Thank you. I've been reading!
User IP Logged

Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Re: 3D Gaming Project
« Reply #22 on: May 3rd, 2016, 9:27pm »

I think I have found an easy way to post code by using Wikisend, if it works I will post the code so far. The ball now has a globe skin on it.


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 #23 on: May 3rd, 2016, 10:21pm »

That's pretty cool. You able to place more objects on the screen and put them at depth?
User IP Logged

I like making program generators and like reinventing the wheel
Wildmooer
New Member
Image


member is offline

Avatar




PM


Posts: 7
xx Re: 3D Gaming Project
« Reply #24 on: May 4th, 2016, 12:38am »

on Apr 24th, 2016, 9:12pm, Ric wrote:
If anyone is still following this link, this is wherein am up to.

https://youtu.be/G-qFv_-0W3Y


Cool! I'd really like to see the code. I'm new to this and my 3D is still very crude.
User IP Logged

Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Re: 3D Gaming Project
« Reply #25 on: May 5th, 2016, 12:03pm »

I can not yet put multiple objects but that is only because I have only loaded the nodes for one. The depth I am working on, it is a simple calculation involving the z vector and then factor X and y. I will post on Wikisend 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 #26 on: May 5th, 2016, 7:57pm »

Evening all. I was going to post the code on wikisend, but I cannot get the upload to work. I have given in!!! If anyone can tell me how to post the code some how, somewhere I will do so. Or I can email it.

Ric
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 #27 on: May 6th, 2016, 08:23am »

Hi Ric,

I've never used Wikisend, but might Github be a suitable option? I've used that in association with a MOOC course I did, and it seemed OK.

https://github.com/

I think the Wiggio forum and its file storage are still functional: you'll need to sign up to upload, but it's free:

https://wiggio.com/

Richard has now set up what looks something like a mirror of the old Yahoo forum on Groups.io:

https://groups.io/g/bb4w

I haven't really got to grips with that forum yet, but it looks like once you have signed in you have access to a file storage area, though my guess is that that would only be accessible to others who were members.

I'd certainly be interested to see what you've done - both in terms of code and function.

Best wishes,

D
User IP Logged

DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Re: 3D Gaming Project
« Reply #28 on: May 6th, 2016, 08:28am »

on May 4th, 2016, 12:38am, Wildmooer wrote:
Cool! I'd really like to see the code. I'm new to this and my 3D is still very crude.


Hi Wildmooer,

If you are relatively new to programming you may find Ric's code a bit intimidating - most of it is in assembler, I think!

It might be worth playing with the Direct3D library supplied with with BB4W -even that is tricky, but simple things (like a mapped rotating sphere!) are relatively straightforward - indeed a working demo is supplied (world.bbc, in the graphics folder of the examples).

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 #29 on: May 6th, 2016, 11:59am »

Cheers D
I will have a look at these tonight.

You are correct in assuming most of the code is in assembler, with only the setting of parameters in basic. I have loosely annotated it , but even so unless you are very au fait with assembler it will look like gobbledegook😋

Ric
User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
Pages: 1 2 3 4  ...  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