Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Heres an Example demonstrating a never ending 3d world

Author
Message
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 8th Apr 2018 03:29 Edited at: 12th Apr 2018 20:05
not sure who will find this useful but it demonstrates a never ending 3d world with blocks by defining a 3D window workspace
you want to work in and then moves within this workspace. It uses a 1000 blocks to demonstrate this where you can move in
the workspace.

If that sounds confusing just try and use arrow keys and a and z to move
fubar
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 8th Apr 2018 07:47 Edited at: 12th Apr 2018 20:05
Possibly a better example is this as never ending terrain just use arrow keys and look forward to a never ending terrain

fubar
Rick Nasher
1
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 8th Apr 2018 11:18 Edited at: 8th Apr 2018 11:32
Cool examples. Movement is a bit jerky, sure that can be worked out.

But wouldn't flat meshes(CreateObjectQuad) be more suitable for this?
[EDIT]
in AppGameKit CreateObjectPlane is actually more like a quad, and CreateObjectQuad is more like a plane. Bit confusing but it works I guess.

Replacing CreateObjectBox with this works:

CreateObjectPlane(num,1,1)
RotateObjectLocalX(num, -90)


Also If you leave out the Rotation and add in:
function moveBlocks(x as float,y as float,z as float)
..
..
SetObjectLookAt(num, GetCameraX(1), GetCameraY(1),GetCameraZ(1),0)
next num
endfunction

Then we've instantly got a nice rudementary billboard function useable for grass and such.
[/EDIT]
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 8th Apr 2018 18:30 Edited at: 12th Apr 2018 20:06
Thanks Rick Nasher using blocks tho allows for modification with SetMeshMemblockVertexPosition and SetObjectMeshFromMemblock like in this example
The above code allows you to change the color of the blocks with the mouse and the function is there to change a texture. It also modified the vertex positions. At the moment
it only raises the front face but try it
just an example but it could be used to create craters etc on the fly
fubar
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 8th Apr 2018 19:29 Edited at: 12th Apr 2018 20:06
Could very easily be made into a driving game where the colors/texture and vertex positions could all be modified as you moved through the 3dwindow workspace on the fly.

fubar
Rick Nasher
1
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 8th Apr 2018 21:59
Interesting stuff.
puzzler2018
1
Years of Service
User Offline
Joined: 8th Oct 2017
Location:
Posted: 8th Apr 2018 22:02
Well done.. keep it up

fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 9th Apr 2018 00:53 Edited at: 12th Apr 2018 20:07
A Mini 3d driving game with an endless map that turns all objects into an exploding particle effect when you crash
and raises and lowers terrain based on a sinewave
fubar
Rick Nasher
1
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 9th Apr 2018 17:12
Wauwzers! That's a nice effect.
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 9th Apr 2018 17:15 Edited at: 12th Apr 2018 20:08
Thanks Rick still trying to perfect the car going up and down on the terrain

The following changes tears the car apart with vertex;s by their faces and adds that to the particle effects. It really should rotate them so as you can see all the faces (I have both explosions routines in there incase)



or theres this version which is much neater and tears the car apart by modifying all of its vertexs which I think simulates the explosion best
fubar
puzzler2018
1
Years of Service
User Offline
Joined: 8th Oct 2017
Location:
Posted: 9th Apr 2018 20:59 Edited at: 9th Apr 2018 20:59
Wow indeed - well done Furbarpk, I like the road lift like policemans hump. and did i see the car (cube) rotate a little to when hit that hump

Great stuff..

note:- ill be back on mnecraft in a day or two, im heavily distracted with work.
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 9th Apr 2018 22:27 Edited at: 9th Apr 2018 22:50
Thanks puzzler

if you change line 210 in the moveBlocks code from y#=y#/75.0 to y#=y#/50.0 you will see a greater range
of road height but until I get the car going back down again its a bit strange with car in air

The car lifts when the land is raised done using raycasting have to modify it so it goes back down again lol
The second raycast the collisions seems to work well.

NOTE:The first collision returned I believe is the ground so in the first raycast just checking for the land height
ahead to raise or lower the car should work

Quote: "ill be back on mnecraft in a day or two, im heavily distracted with work."

All good figured you must be busy
fubar
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 9th Apr 2018 23:05 Edited at: 12th Apr 2018 20:08
Ok that's it I have the car going up and down with the terrain ahead



now just for a nice shadow on the ground and its complete
fubar
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 10th Apr 2018 03:11 Edited at: 23rd Apr 2018 20:31
Complete 3d driving mini game with blocks

Things to try
changing constant mapX from 40 to 20 might give you room to add hills in the distance on the side
and changing constant raiseAmmount will change the obstacles height. lots of other stuff to be
easily changed by looking through the program. Could even set a block a tileable texture and use
the same color to set the road surface.

Or perhaps it would inspire you to write a 3D Night Driver and instead of using sine to raise and lower
the road as in above it could be used to make a winding road spawn some cattle etc on the road
and use the vertex crashes to tear apart the model. The above example should help you make a
3D night driver if that's your wishes just would need to have some cow objects etc
fubar
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 12th Apr 2018 02:44 Edited at: 23rd Apr 2018 20:32
The following changes have been made to the above code
1.It accelerates now over time.
2.Explosion sound created from memblocks when you crash.
3.Now adds a texture created with memblocks to all objects using puzzlers texture creator he shared on another thread.
4.Now uses the Gyroscope for steering if one doesn't exist arrow keys if keyboard present.
5.There are now different color checkpoints.
6.High score and top speed of the day is now displayed
7.The car now rotates with the gyroscope

Quote: "Its Amazing what code you can create without loading Media"


???
could use planes as a sky box that shift the uv maps at a much lower speed proportional to the car speed something like this
Perhaps different textures to the back than the sides. Anyone done this before? How does it look?
fubar
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 15th Apr 2018 06:56 Edited at: 15th Apr 2018 20:03
A Parabolic effect on a terrain mesh

or improved to

Ideally I wanted one hill in the centre, starting and finishing flat lol but the above is close
could be then used for a kind of 3d cannonball game I was thinking
fubar
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 22nd Apr 2018 07:59
A small video displaying the 3D Minigame the video quality is kinda poor but you can get the general idea without trying it
fubar
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 24th Apr 2018 03:37 Edited at: 25th Apr 2018 06:35
3D Night Driver
made from utilizing the code in the 3D Mini Game


no cows etc crossing the road just one car that keeps coming
fubar
puzzler2018
1
Years of Service
User Offline
Joined: 8th Oct 2017
Location:
Posted: 24th Apr 2018 20:42
Your making great progress

Maybe add these little gems to your car

[img]null[/img]


May have to shrink them
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 25th Apr 2018 00:46 Edited at: 30th Apr 2018 21:56
Wow thanks Puzzler those wheels look pretty good even rotating

Im thinking now a truly retro look black and white wireframe cars but those wheels are too good for wireframe
but il definately use them. Also the wireframe makes for really good explosions the wheels I might send into orbit
when I crash . Still have to modify the front and back to go down a bit but that will do for now.

Night Driving


I can remember the Night Driver we got here in Australia had cows crossing the road etc but I cant seem to find
proof on the internet. I may be getting missed up with a dif game but I really loved the way the game was black
and white and when you hit a cow or car it went flying and I think it even destroyed the cars shape-table similar
to my attempt. But I really cant find any game like what's in my head lol and I don't recall taking hallucinogens.

The create car routine A car has one bottom block one tope modified block and 4 wheels
fubar
puzzler2018
1
Years of Service
User Offline
Joined: 8th Oct 2017
Location:
Posted: 25th Apr 2018 07:20
Wow - good work, I love the speed-o-meter too
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 25th Apr 2018 07:23 Edited at: 25th Apr 2018 15:43
Thanks

I decided to release to Google Play as a free app as is.
had to change the titles to Night Driving but apart from that it got approved. The wireframe version
I released to Google Play is a little Different to the code above as it has different textures and a
speedometer etc. Its an early relelease as I may add more car sounds and modify the car blocks mesh
it has at the bottom but that can be next release.

Night Driving Relase
https://play.google.com/store/apps/details?id=night.driver
fubar
puzzler2018
1
Years of Service
User Offline
Joined: 8th Oct 2017
Location:
Posted: 25th Apr 2018 19:04
You could use my wheels example to create something like this



Enjoy
Rick Nasher
1
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 25th Apr 2018 19:16 Edited at: 25th Apr 2018 19:16
Nice code. I once did such a race thingy on the C64 and now it's here again! Vroom vrroomm
puzzler2018
1
Years of Service
User Offline
Joined: 8th Oct 2017
Location:
Posted: 25th Apr 2018 22:44
hmmmm

With sin and cos on vertices on object memblocks, we could potentially create a wavy flag - or a vavy (in the wind) blowing Start / checkpoint / Finish overhead flags

Interesting....
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 25th Apr 2018 23:29 Edited at: 27th Apr 2018 23:16
Thanks Rick
Thanks puzzler the wheels are really great bit too good for the car I think, and create allot of object capsules
I really was after a a car i could create knowing the objectid so i could create other cars etc as just an addition
the carblock roof and four wheels meant the next car had to start at 6 greater than the first car id. I did try
very hard playing with object capsules with your example but had me dumbfounded trying to get them to scale
and then to line up with the car object and I really wanted to cut down on objects. The code i use is still very fast
on my old phone.

Wavy Flag is a great idea I played around with it in the 3D Minigame above didnt have allot of success getting
it the way i wanted. but when i tested the 3d minigame on the phone the frame rate jumped out the window
and didnt come back lol hence why i started the Night Driving one which is still very fast. The Mini-game as
above does have colored checkpoints but I just made them a white line across road. I did try a checkpoint texture
but it didn't look that good.

But with Night Driver
Ive now created a speedo and speedo needle with code 2 sprites 256 by 256 and replaced that in Night Driving
I think it looks much cleaner than the other speedo. Ive also added a cow artifact not sure what people think
of cow but if I use it instead of having a fixed acceleration it could be controlled with the gyroscope
allowing breaking what do people think ?
fubar
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 28th Apr 2018 23:50 Edited at: 15th Jul 2018 01:43
Night Driving
1.Now with improved gyroscope usage and difficulty
2.Speedometer
3.Livestock
4.Improved visuals
5.Completely procedurally created

Video Preview


Full source no media required makes for a great template

And because I thought the community needed it I added to google play but with purchased objects graphics and sound

Google Play Link https://play.google.com/store/apps/details?id=night.driver

Quote: "Anyone can use or modify the code as is."
fubar
Rick Nasher
1
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 29th Apr 2018 19:52
Pretty cool. Is the live stock crossing the road?
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 30th Apr 2018 02:22 Edited at: 30th Apr 2018 05:13
Thanks Rick
Quote: "Pretty cool. Is the live stock crossing the road? "

It probably should and I did originally plan to make that happen and easy enough to make it do so
but I don't think google play would approve it then lol

And I designed livestock as cows but in game they look more like sheep lol

Really want to generate some better sounds from memblocks like car screeching around corners etc
so I converted a dbpro file from the codebase its not a perfect conversion and I don't have DBPro
installed to see how well it worked there.
fubar
Rick Nasher
1
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 30th Apr 2018 18:10 Edited at: 30th Apr 2018 20:22
Pretty cool<< repeating myself here .
Not all sounds 'sound' like the label but nice nevertheless.

Made a slight mod to the keys for wouldn't work on my laptoppy's US international keyboard layout.
Also if you use if GetRawKeyState(32) then starts to sound like a rhythm section.


[EDIT]
Doing a quick exploration for a better explosion I found some rainy weather..




I once did an explosion sound on a commodore a loooooooong time ago so can't really remember the nitty gritty.
Was using attack, sustain, decay, release, but we've got:
frequency, length, loudness, bend, decay, vibratospeed, vibratodepth, tremelospeed, tremelodepth, attack, so perhaps can simulate?



[/EDIT]
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 30th Apr 2018 20:10
The rainy weather works well

you may want to change
sec = .50 to sec = length/1000 that's a better translation

and add the position variable like

That's pretty much how it translated
The original I think was written by another Rick and I think it may have been explained in one of the
Dark Basic newsletters but I cant seem to find that. But from memory it worked allot better in DBPro
fubar
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 30th Apr 2018 20:34 Edited at: 30th Apr 2018 20:53
I found with your rainy weather
changing to

almost an explosion well it kinda gets louder with a static kinda noise
In my night driver I made the crash using an array like [80,53,-25,73,44,0,24,80]
and randomly chose those as the hz values while it was creating the sound. Still
wasn't perfect but did combine a hiss like crash sound with a base rumble

ideally what we need here is a function that can append one soundmemblock to another
making a longer sound as if you played sound 2 directly after sound 1
fubar
Rick Nasher
1
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 30th Apr 2018 22:13 Edited at: 1st May 2018 21:48
Uhuh, this isn't ideal, goes from high volume to low, as in an explosion, but more suitable for shot sounds when duration is shorter.


Idealy it needs a small envelope at the start, to expand very quickly with a high pitch, an low pitch big rumble and then die slowly off.
[EDIT] Guess that's exactly what you said above hehehe [/EDIT]
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 4th May 2018 02:22 Edited at: 11th May 2018 20:12
Rick I might just decide to use wav files for car screeching etc
I have been working on new version of night driving with proper car models what do people think?
Was still going with the retro look so the cars have a wireframe texture i created? Still using the
vertex destruction for collisions



Still good to have the original version as it makes for a good template for others. The above version
has models and sound purchased from https://www.tgcstore.net/ with credits given on start up
and the wheels I created with JL Moondogs primitive Pack https://forum.thegamecreators.com/thread/215819

Now with car sounds
fubar
Rick Nasher
1
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 8th May 2018 00:22
Nice, but I would now decrease the size of the poles to side of the road to match the car size and vary them with longer light poles.

Login to post a reply

Server time is: 2019-03-22 06:21:26
Your offset time is: 2019-03-22 06:21:26