Author |
Topic: 3D Gaming Project (Read 1746 times) |
|
Ric
Full Member
member is offline
Gender:
Posts: 136
|
|
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
|
|
Logged
|
It's always possible, but not necessarily how you first thought. Chin up and try again.
|
|
|
DDRM
Administrator
member is offline
Gender:
Posts: 321
|
|
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
|
|
Logged
|
|
|
|
Ric
Full Member
member is offline
Gender:
Posts: 136
|
|
Re: 3D Gaming Project
« Reply #62 on: Aug 17th, 2016, 9:41pm » |
|
Evening DDRM,
Thanks for the feedback. I will have a look at the sliders, but it could get rotationally very complicated to do everything live, without saving inbetween, never say die tho'. The node movement is next on the list of things to do along with being able to disable the grid. I agree about the object numbers and have made the necessary adjustment.
Next post will be a while, free time has run out again😁
Ric
|
|
Logged
|
It's always possible, but not necessarily how you first thought. Chin up and try again.
|
|
|
Ric
Full Member
member is offline
Gender:
Posts: 136
|
|
Re: 3D Gaming Project
« Reply #63 on: Sep 3rd, 2016, 7:51pm » |
|
Hello again,
This is where I am up to so far. The axis' are displayed for demonstration purposes to allow me to develop the software. Currently they are executed using BASIC DRAW commands and thus print over the top of the graphics and are not confined to the window but this will change and they will become useful. The rotation of the objects is now around arbitory axis' and you can rotate the grid while focusing on an object. Where the node option boxes are mis-aligned, just try them, they may or may not work.
https://my.pcloud.com/publink/show?code=XZ1OpWZDFb0vnaaMD0054m1yf7Ffj2hEaYV
Ric
|
|
Logged
|
It's always possible, but not necessarily how you first thought. Chin up and try again.
|
|
|
michael
Senior Member
member is offline
Posts: 335
|
|
Re: 3D Gaming Project
« Reply #64 on: Sep 4th, 2016, 04:24am » |
|
On your previous (Nodes) II the sliders were all working properly. On this latest link, it seems like most the sliders are not responding and those that do, do only at times.. I have an idea, that I am trying to work out the technicalities concerning design. Its a matter of brain storming. The thought of small game parts. Universal, that we could make.. They would be a sort of real 3D, and actually manipulated by sprites for size. So for instance we could make sets of eyes and ears on different angles. Not like before. I have some ideas of cropped motion capture of vehicles and other real world objects to make overhead views and rear and side views. Spy hunter anyone? Just throwing ideas. I am working on some code art now and will show them using BMPtoCODE. (by the way I am thinking of making a BBC Basic version of BMPtoCODE. even though I don't really need to. I keep thinking of how a person could store the perspective views in an array instead of a sprite. BMPtoARRAYS? Hmmmm... The thing with arrays is, to make it fast, I would have to eliminate compression. or invent a new smart overlay system that can absorb the image data and read it fast and efficiently. So you would only create the images you needed, and the active parts would only become active depending on say a model's stance, and the different parts would be only called upon to change when the perspective or stance changed.. You know what I mean?
|
« Last Edit: Sep 4th, 2016, 04:33am by michael » |
Logged
|
I like making program generators and like reinventing the wheel
|
|
|
Ric
Full Member
member is offline
Gender:
Posts: 136
|
|
Re: 3D Gaming Project
« Reply #65 on: Sep 4th, 2016, 09:24am » |
|
Michael, when you say don't respond, can you be more specific please, they all work ok on my laptop. the inner four sliders only work when an object is selected by using right mouse button on the object centre node.
Has anyone else had the same problems as Michael?
Ric
|
|
Logged
|
It's always possible, but not necessarily how you first thought. Chin up and try again.
|
|
|
Ric
Full Member
member is offline
Gender:
Posts: 136
|
|
Re: 3D Gaming Project
« Reply #66 on: Sep 4th, 2016, 09:30am » |
|
On a separate note, creating bmp to arrays could incur massive memory usage even if the components for each object are small and multifunctional. I don't see why it could not work tho. To move objects over each other you simply store the screen pixels(where you want to print your sprite) in an array print your sprite and when you move the sprite put the screen pixels back.
Ric
|
|
Logged
|
It's always possible, but not necessarily how you first thought. Chin up and try again.
|
|
|
michael
Senior Member
member is offline
Posts: 335
|
|
Re: 3D Gaming Project
« Reply #67 on: Sep 4th, 2016, 2:18pm » |
|
Oh! I got it to work. I am surprised that you actually made it so I could interact directly with the mouse in center. Very nice work.. only once slider on each side works far as I can tell. But that's all that's needed.
As for the arrays, anything with a value of 0 (black would not be plotted, so the image could be plotted fast.
I am still thinking that compression might be needed to keep the arrays small. BMPtoCODE is actually fairly fast. And all your image data is within the program itself instead of an array.
(I can make the black color not plot, and that would make it faster and overlay) Although using that approach, I would need to clear and redraw the scene every time animation frame changes. * REFRESH
Here is an example of what BMPtoCODE can do,
Code: VDU 22,8
VDU 23,23,1|
OFF:VDU 5:COLOUR 0:CLG
PROC_image(100,500)
WAIT 0:END
DEF PROC_image(h,v)
u=0:r=0:g=0:b=0:a=0:c=0:t=0
ost$=""
READ x,y:REPEAT
READ nst$,t
IF nst$="0" THEN r=0:g=0:b=0 :REM 'black 0 0 0
IF nst$="1" THEN r=192:g=128:b=64:REM ' brown 192 128 64
IF nst$="2" THEN r=64:g=64:b=192 :REM'dark blue 64 64 192
IF nst$="3" THEN r=128:g=128:b=128:REM' dark grey 128 128 128
IF nst$="4" THEN r=128:g=0:b=0:REM'dark red 128 0 0
IF nst$="5" THEN r=224:g=192:b=0 :REM'dark yellow 224 192 0
IF nst$="6" THEN r=128:g=160:b=192:REM'flat blue 128 160 192
IF nst$="7" THEN r=32:g=192:b=64 :REM'green 32 192 64
IF nst$="8" THEN r=166:g=202:b=240:REM'light blue 166 202 240
IF nst$="9" THEN r=192:g=192:b=192:REM 'light gray 192 192 192
IF nst$="a" THEN r=192:g=224:b=0:REM 'light green 192 224 0
IF nst$="b" THEN r=224:g=32:b=64:REM'light red 224 32 64
IF nst$="c" THEN r=0:g=160:b=192 :REM'medblue 0 160 192
IF nst$="d" THEN r=224:g=128:b=64 :REM 'orange 224 128 64
IF nst$="e" THEN r=224:g=160:b=192:REM'pink 224 160 192
IF nst$="f" THEN r=160:g=64:b=192:REM'purple 160 64 192
IF nst$="g" THEN r=192:g=220:b=192:REM'tan 192 220 192
IF nst$="h" THEN r=255:g=255:b=255:REM'white 255 255 255
IF nst$="i" THEN r=255:g=255:b=0:REM'yellow 255 255 0
COLOUR 0,r,g,b:GCOL 0
FOR u=0 TO t
a=a+1: MOVE h+c,v-a:DRAW h+c,v-a:IF a>x THEN c=c+1:a=0
NEXT u
UNTIL nst$="100000"
MOVE 0,0:ENDPROC
DATA 79,79
DATA 0,595,b,9,0,65,b,17,0,57,b,25,0,51,b,29,0,48,b,31,0,45,b,12,0,9,b,12,0,42,b,10,0,16,b,10,0,38,b,9,0
DATA 21,b,9,0,36,b,8,0,25,b,8,0,34,b,7,0,29,b,7,0,32,b,7,0,32,b,6,0,30,b,6,0,35,b,6,0,28,b,6,0,37
DATA b,6,0,27,b,5,0,39,b,6,0,25,b,5,0,41,b,5,0,24,b,5,0,28,i,3,0,10,b,5,0,23,b,5,0,28,i,4,0,10,b
DATA 5,0,21,b,5,0,29,i,4,0,10,b,5,0,20,b,5,0,30,i,5,0,10,b,5,0,19,b,5,0,12,i,2,0,15,i,5,0,9,b,5
DATA 0,18,b,5,0,11,i,6,0,14,i,4,0,10,b,5,0,17,b,5,0,11,i,7,0,13,i,5,0,9,b,5,0,17,b,4,0,12,i,7,0
DATA 14,i,4,0,10,b,4,0,17,b,4,0,12,i,7,0,15,i,4,0,9,b,4,0,16,b,5,0,12,i,5,0,17,i,4,0,10,b,4,0,15
DATA b,4,0,37,i,4,0,10,b,4,0,15,b,4,0,37,i,4,0,10,b,4,0,15,b,4,0,38,i,4,0,9,b,4,0,14,b,4,0,39,i
DATA 4,0,10,b,4,0,13,b,4,0,39,i,4,0,10,b,4,0,13,b,4,0,39,i,4,0,10,b,4,0,13,b,4,0,39,i,4,0,10,b,4
DATA 0,13,b,4,0,39,i,4,0,10,b,4,0,13,b,4,0,39,i,5,0,9,b,4,0,13,b,4,0,39,i,5,0,9,b,4,0,13,b,4,0
DATA 39,i,5,0,9,b,4,0,13,b,4,0,39,i,4,0,10,b,4,0,13,b,4,0,39,i,4,0,10,b,4,0,14,b,4,0,38,i,4,0,9
DATA b,4,0,15,b,4,0,16,i,2,0,17,i,5,0,9,b,4,0,15,b,4,0,15,i,4,0,16,i,4,0,10,b,4,0,15,b,4,0,14,i
DATA 6,0,15,i,4,0,10,b,4,0,16,b,4,0,12,i,7,0,14,i,5,0,9,b,5,0,16,b,4,0,12,i,7,0,14,i,4,0,10,b,4
DATA 0,17,b,5,0,12,i,5,0,15,i,3,0,10,b,5,0,17,b,5,0,33,i,4,0,10,b,5,0,18,b,5,0,31,i,5,0,9,b,5,0
DATA 19,b,5,0,30,i,4,0,11,b,5,0,20,b,5,0,29,i,3,0,11,b,5,0,22,b,4,0,29,i,2,0,12,b,5,0,22,b,5,0,43
DATA b,5,0,24,b,5,0,41,b,5,0,25,b,6,0,39,b,6,0,26,b,6,0,37,b,6,0,28,b,6,0,35,b,6,0,30,b,6,0,33,b
DATA 6,0,32,b,7,0,29,b,7,0,34,b,8,0,25,b,8,0,36,b,9,0,21,b,9,0,38,b,10,0,17,b,10,0,41,b,12,0,9,b,12
DATA 0,44,b,33,0,47,b,29,0,51,b,25,0,57,b,18,0,64,b,9,100000,0
|
« Last Edit: Sep 4th, 2016, 2:52pm by michael » |
Logged
|
I like making program generators and like reinventing the wheel
|
|
|
Ric
Full Member
member is offline
Gender:
Posts: 136
|
|
Re: 3D Gaming Project
« Reply #68 on: Sep 4th, 2016, 3:45pm » |
|
Michael
Seems to work pretty nice. I have altered the code a bit to speed it up and make it loop until you press spacebar. If you were to change the code to make the pixels a colour on a bitmap instead of DRAWing them this would speed thing up massively, (DRAW is very slow) and you would have the beginnings of a sprite printing routine.
Code: VDU 22,8
VDU 23,23,1|
OFF:VDU 5:COLOUR 0:CLG
REPEAT REM ****** HERE ******
PROC_image(RND(1000),RND(1000))
RESTORE
UNTIL INKEY(-99)=-1
WAIT 0:END
DEF PROC_image(h,v)
u=0:r=0:g=0:b=0:a=0:c=0:t=0
ost$=""
READ x,y:REPEAT
READ nst$,t
IF nst$="0" THEN r=0:g=0:b=0 :REM 'black 0 0 0
IF nst$="1" THEN r=192:g=128:b=64:REM ' brown 192 128 64
IF nst$="2" THEN r=64:g=64:b=192 :REM'dark blue 64 64 192
IF nst$="3" THEN r=128:g=128:b=128:REM' dark grey 128 128 128
IF nst$="4" THEN r=128:g=0:b=0:REM'dark red 128 0 0
IF nst$="5" THEN r=224:g=192:b=0 :REM'dark yellow 224 192 0
IF nst$="6" THEN r=128:g=160:b=192:REM'flat blue 128 160 192
IF nst$="7" THEN r=32:g=192:b=64 :REM'green 32 192 64
IF nst$="8" THEN r=166:g=202:b=240:REM'light blue 166 202 240
IF nst$="9" THEN r=192:g=192:b=192:REM 'light gray 192 192 192
IF nst$="a" THEN r=192:g=224:b=0:REM 'light green 192 224 0
IF nst$="b" THEN r=224:g=32:b=64:REM'light red 224 32 64
IF nst$="c" THEN r=0:g=160:b=192 :REM'medblue 0 160 192
IF nst$="d" THEN r=224:g=128:b=64 :REM 'orange 224 128 64
IF nst$="e" THEN r=224:g=160:b=192:REM'pink 224 160 192
IF nst$="f" THEN r=160:g=64:b=192:REM'purple 160 64 192
IF nst$="g" THEN r=192:g=220:b=192:REM'tan 192 220 192
IF nst$="h" THEN r=255:g=255:b=255:REM'white 255 255 255
IF nst$="i" THEN r=255:g=255:b=0:REM'yellow 255 255 0
COLOUR 0,r,g,b:GCOL 0
FOR u=0 TO t
a=a+1: MOVE h+c,v-a
IF nst$<>"0" THEN DRAW h+c,v-a : REM ****** HERE ******
IF a>x THEN c=c+1:a=0
NEXT u
UNTIL nst$="100000"
MOVE 0,0:ENDPROC
DATA 79,79
DATA 0,595,b,9,0,65,b,17,0,57,b,25,0,51,b,29,0,48,b,31,0,45,b,12,0,9,b,12,0,42,b,10,0,16,b,10,0,38,b,9,0
DATA 21,b,9,0,36,b,8,0,25,b,8,0,34,b,7,0,29,b,7,0,32,b,7,0,32,b,6,0,30,b,6,0,35,b,6,0,28,b,6,0,37
DATA b,6,0,27,b,5,0,39,b,6,0,25,b,5,0,41,b,5,0,24,b,5,0,28,i,3,0,10,b,5,0,23,b,5,0,28,i,4,0,10,b
DATA 5,0,21,b,5,0,29,i,4,0,10,b,5,0,20,b,5,0,30,i,5,0,10,b,5,0,19,b,5,0,12,i,2,0,15,i,5,0,9,b,5
DATA 0,18,b,5,0,11,i,6,0,14,i,4,0,10,b,5,0,17,b,5,0,11,i,7,0,13,i,5,0,9,b,5,0,17,b,4,0,12,i,7,0
DATA 14,i,4,0,10,b,4,0,17,b,4,0,12,i,7,0,15,i,4,0,9,b,4,0,16,b,5,0,12,i,5,0,17,i,4,0,10,b,4,0,15
DATA b,4,0,37,i,4,0,10,b,4,0,15,b,4,0,37,i,4,0,10,b,4,0,15,b,4,0,38,i,4,0,9,b,4,0,14,b,4,0,39,i
DATA 4,0,10,b,4,0,13,b,4,0,39,i,4,0,10,b,4,0,13,b,4,0,39,i,4,0,10,b,4,0,13,b,4,0,39,i,4,0,10,b,4
DATA 0,13,b,4,0,39,i,4,0,10,b,4,0,13,b,4,0,39,i,5,0,9,b,4,0,13,b,4,0,39,i,5,0,9,b,4,0,13,b,4,0
DATA 39,i,5,0,9,b,4,0,13,b,4,0,39,i,4,0,10,b,4,0,13,b,4,0,39,i,4,0,10,b,4,0,14,b,4,0,38,i,4,0,9
DATA b,4,0,15,b,4,0,16,i,2,0,17,i,5,0,9,b,4,0,15,b,4,0,15,i,4,0,16,i,4,0,10,b,4,0,15,b,4,0,14,i
DATA 6,0,15,i,4,0,10,b,4,0,16,b,4,0,12,i,7,0,14,i,5,0,9,b,5,0,16,b,4,0,12,i,7,0,14,i,4,0,10,b,4
DATA 0,17,b,5,0,12,i,5,0,15,i,3,0,10,b,5,0,17,b,5,0,33,i,4,0,10,b,5,0,18,b,5,0,31,i,5,0,9,b,5,0
DATA 19,b,5,0,30,i,4,0,11,b,5,0,20,b,5,0,29,i,3,0,11,b,5,0,22,b,4,0,29,i,2,0,12,b,5,0,22,b,5,0,43
DATA b,5,0,24,b,5,0,41,b,5,0,25,b,6,0,39,b,6,0,26,b,6,0,37,b,6,0,28,b,6,0,35,b,6,0,30,b,6,0,33,b
DATA 6,0,32,b,7,0,29,b,7,0,34,b,8,0,25,b,8,0,36,b,9,0,21,b,9,0,38,b,10,0,17,b,10,0,41,b,12,0,9,b,12
DATA 0,44,b,33,0,47,b,29,0,51,b,25,0,57,b,18,0,64,b,9,100000,0
Ric.
ps If you select an object ADD OBJECT>>QUICK>>*any shape (except triangleoid)* Then make the object the centre of focus by right clicking the pink node at its centre, you should get a red node and green axis lines, then the four inner sliders should resize and rotate the object and not the whole picture, also you should be able to change the colour as well.
Happy programming
|
|
Logged
|
It's always possible, but not necessarily how you first thought. Chin up and try again.
|
|
|
DDRM
Administrator
member is offline
Gender:
Posts: 321
|
|
Re: 3D Gaming Project
« Reply #69 on: Sep 5th, 2016, 12:26pm » |
|
Hi Ric,
That's very nice - well done! That's exactly the kind of thing I had in mind for your second sliders.
Would it be useful to be able to type the xyz coordinates of an object, as well as position it manually?
D
|
|
Logged
|
|
|
|
michael
Senior Member
member is offline
Posts: 335
|
|
Re: 3D Gaming Project
« Reply #70 on: Sep 5th, 2016, 4:18pm » |
|
Quote:If you were to change the code to make the pixels a colour on a bitmap instead of DRAWing them this would speed thing up massively |
|
Are you referring to sprites or RECTANGLE TO? Or are you referring to another idea?
|
|
Logged
|
I like making program generators and like reinventing the wheel
|
|
|
Ric
Full Member
member is offline
Gender:
Posts: 136
|
|
Re: 3D Gaming Project
« Reply #71 on: Sep 5th, 2016, 9:57pm » |
|
To DDRM
Yes, but not yet. It will be possible via the existing coordinate display just like a normal windows view/menu, also for the colour sliders, just not got round to it yet.
To Michael
I will send you a piece of code that DDRM sent me a while back to create a DIBsection and thus use pixel colouring instead of DRAWing.
Ric
|
|
Logged
|
It's always possible, but not necessarily how you first thought. Chin up and try again.
|
|
|
Ric
Full Member
member is offline
Gender:
Posts: 136
|
|
Re: 3D Gaming Project
« Reply #72 on: Sep 7th, 2016, 9:17pm » |
|
Evening all,
This will be the last update for a while, I have implemented node manipulation so if you choose solid+nodes or line+nodes when an object has been made the main focus you will be able to move individual nodes and create odd shapes.
This in its self has high lighted a problem that has existed since the beginning. When I first created the asm routines to print the graphics I used rhomboids not triangles as it was easier to implement picture transfer to the object, this will now have to be addressed because the lighting routines only work if all the nodes in a particular rhomboid are on the same plane, which potentially they now may not be! Have a play and you will see that the lighting goes cock-a-hoot if you move a node on the sphere for example.
https://my.pcloud.com/publink/show?code=XZJQEWZlFYfzeoLRsBYMlS1riPYDXr5T2vX
Once I have sorted triangles I will get back to the design IDE.
Ric.
Thanks for the interest.
|
|
Logged
|
It's always possible, but not necessarily how you first thought. Chin up and try again.
|
|
|
michael
Senior Member
member is offline
Posts: 335
|
|
Re: 3D Gaming Project
« Reply #73 on: Sep 13th, 2016, 3:13pm » |
|
Hey Ric, you mentioned you were going to send me something for making a replacement for draws?
|
|
Logged
|
I like making program generators and like reinventing the wheel
|
|
|
Ric
Full Member
member is offline
Gender:
Posts: 136
|
|
Re: 3D Gaming Project
« Reply #74 on: Sep 18th, 2016, 10:50am » |
|
Sorry its taken so long Michael,
Here is the code as promised, I have annotated it and put in a few examples, so hopefully it will do the job.
Code:
REM The 3rd and 4th components of the VDU 23,22 statement must be the same as bmi.Header.Width% and bmi.Header.Height%
VDU 23,22,1024;640;16,16,16,0
DIM BITMAPINFOHEADER{Size%, Width%, Height%, Planes{l&,h&}, BitCount{l&,h&}, Compression%, SizeImage%, XPelsPerMeter%, YPelsPerMeter%, ClrUsed%, ClrImportant%}
DIM bmi{Header{} = BITMAPINFOHEADER{}}
bmi.Header.Size% = DIM(BITMAPINFOHEADER{})
bmi.Header.Width% = 1024
bmi.Header.Height% = 640
bmi.Header.Planes.l& = 1
bmi.Header.BitCount.l& = 32
SYS "CreateDIBSection", @memhdc%, bmi{}, 0, ^bits%, 0, 0 TO hbitmap%
IF hbitmap%=0 ERROR 100, "Couldn't create DIBSection"
SYS "SelectObject", @memhdc%, hbitmap% TO oldhbm%
SYS "DeleteObject", oldhbm%
SYS "InvalidateRect", @hwnd%, 0, 0
REM The code to this point sets the screen size in pixels and creates bitmap to the same size
REM To access the bitmap you need to use bit% :-
REM Each pixel is four bytes
REM You can access one at a time with "bits%?(X,Y)=8_bit_number"
REM Or all four bytes at the same time "bits%!(X,Y)=&aaRRGGBB
REM when setting X and Y remember they are pixel coordinates not graphics coordinates
X=100
Y=100
bits%?( ( X + ( Y * bmi.Header.Width% ) ) * 4 ) = 255 : REM Will put a blue dot at 100,100
X=110
bits%!( ( X + ( Y * bmi.Header.Width% ) ) * 4 ) = &00FF00FF : REM Will put a magenta dot at 110,100
REM The reason for the "* bmi.Header.Width%" is to move the "Y" position up the screen by the correct displacement
REM and the "*4" is because each position on the bit map is four pixels
REM A simple line
FOR loop = 200 TO 400
bits%!( ( loop + ( loop * bmi.Header.Width% ) ) * 4 ) = &00FF8000
NEXT
REM After you have finished accessing the bit map a "*REFRESH" is needed to update the screen
*REFRESH
Regards Ric
|
|
Logged
|
It's always possible, but not necessarily how you first thought. Chin up and try again.
|
|
|
|