WIP Driving Game

Announce your Work In Process and finalized projects here.
Post Reply
coolw
Newcomer
Posts: 39
Joined: Wed Aug 29, 2007 11:17 pm
Location: West Virginia
Contact:

WIP Driving Game

Post by coolw »

Just a short note: I am glad Zero is back, now we can get Coolbasic updates!

I am currently working on a Driving game based off Bagards Driving system (no longer avalible due to forums being reset), but customized to be my own!

DOWNLOAD!!! :D CLICK \/ \/
http://files.filefront.com/DrivingCB/;8 ... einfo.html

Instuctions:
-Download the file to the Desktop or somewhere
-Open it in the CB editor
-Hit run!

Keyboard Settings:
-Up = Forward
-Left = Turn Left
-Right = Turn Right
-Down = Slow Down
-Shift = Turbo
-Spacebar (When needed) = Fix Car
-R = Reverse!

Currently have:
-A box for a car, not a line, and no I won't make it a picture because I haven't got any experiance with that.
-Speedometer (made my Bagard)
-Turbo and Turbometer (uses Bagards code, but changed up a bit)
-Limit on screen
-Damage System
-Damage Bar

Working on (or planning on):
-Headlights for car (just so you know which way you are facing) (~20%)
-Damage meter (99%) (open for suggestions)
-Damage (99%) (fixing some algorithms)
-Effects (0%)
-Upgrades for car, like guns, rockets, ect. (0%)
-Weapons (0%)
-Online Play (~10%) (Have code, but I don't know how to use it :cry: )
-Bots (0%)

Ideas/Suggestions???
Post 'em here!

Any Ideas/Suggestions are welcome!
If you want, I am willing to work with someone else of good CB experiance, not great, just average or something, to help me out ;)

Thanks :D
Last edited by coolw on Mon Sep 03, 2007 6:09 am, edited 6 times in total.
My car game! (WIP)
viewtopic.php?f=18&t=53

Code: Select all

Coolw is the best! :)
koodaaja
Moderator
Moderator
Posts: 1583
Joined: Mon Aug 27, 2007 11:24 pm
Location: Otaniemi - Mikkeli -pendelöinti

Re: WIP Driving Game

Post by koodaaja »

I think you need opponents for this game ;D It doesn't have to be a racing game, but it would be nice to have some other cars driving around, so you could wreck them >=) (or blow them up, if you add weapons). But obstacles would be nice, since driving in a black screen isn't that cool.

Good luck with your project!
coolw
Newcomer
Posts: 39
Joined: Wed Aug 29, 2007 11:17 pm
Location: West Virginia
Contact:

Re: WIP Driving Game

Post by coolw »

Yes, I am actually gonna try and make it online! If I can get someone to get the Finnish version of it in english, so I could understand it, that would help, because I have no clue how to use it! Soon, if online play is made, I will make bots that drive randomly and shoot you if you get in their sight!
My car game! (WIP)
viewtopic.php?f=18&t=53

Code: Select all

Coolw is the best! :)
User avatar
Misthema
Advanced Member
Posts: 312
Joined: Mon Aug 27, 2007 8:32 pm
Location: Turku, Finland
Contact:

Re: WIP Driving Game

Post by Misthema »

If you really want to try make your game an online game, maybe I can help you by translating it. :) I'll post here or PM you when I'm done.
But first, you might give us little showup of your game? o_O
koodaaja
Moderator
Moderator
Posts: 1583
Joined: Mon Aug 27, 2007 11:24 pm
Location: Otaniemi - Mikkeli -pendelöinti

Re: WIP Driving Game

Post by koodaaja »

Misthema wrote:If you really want to try make your game an online game, maybe I can help you by translating it. :) I'll post here or PM you when I'm done.
But first, you might give us little showup of your game? o_O
>>Click<<

That's the old topic. And making online games with CB is rather hard, so I would finish the single player mode first.
coolw
Newcomer
Posts: 39
Joined: Wed Aug 29, 2007 11:17 pm
Location: West Virginia
Contact:

Re: WIP Driving Game

Post by coolw »

yes http://www.coolbasic.com/oldforums/inde ... topic=7692 is the old thread, and I don't know if its that hard, but it is hard, I have one in Finnish, and I haven't tested it, but I am sure it works. But yes, if you can help, I can PM you the new code (Not Stable) and would it be easy to edit once its in there? :?:
My car game! (WIP)
viewtopic.php?f=18&t=53

Code: Select all

Coolw is the best! :)
coolw
Newcomer
Posts: 39
Joined: Wed Aug 29, 2007 11:17 pm
Location: West Virginia
Contact:

Re: WIP Driving Game

Post by coolw »

I GOT A DOWNLOAD LINK and I updated alot of stuff!

Changelog:
-Added (Reverse)
-Added (Damage)
-Added (Damage %)
-Fixed (Some coding that wouldn't work
-Added/Fixed (Some things I may not remember!)

Guys please don't tell me about:
-Speed change for gears, I'm trying to make a good formula for it so it works nice :P
-Damage System, it was quick, going to make a formula so it gets damaged based on your speed :)

I will take suggestions on them, I just don't need you telling me its broken or off a bit :shock:

ENJOY!
My car game! (WIP)
viewtopic.php?f=18&t=53

Code: Select all

Coolw is the best! :)
koodaaja
Moderator
Moderator
Posts: 1583
Joined: Mon Aug 27, 2007 11:24 pm
Location: Otaniemi - Mikkeli -pendelöinti

Re: WIP Driving Game

Post by koodaaja »

coolw wrote:I GOT A DOWNLOAD LINK and I updated alot of stuff!

Changelog:
-Added (Reverse)
-Added (Damage)
-Added (Damage %)
-Fixed (Some coding that wouldn't work
-Added/Fixed (Some things I may not remember!)

Guys please don't tell me about:
-Speed change for gears, I'm trying to make a good formula for it so it works nice :P
-Damage System, it was quick, going to make a formula so it gets damaged based on your speed :)

I will take suggestions on them, I just don't need you telling me its broken or off a bit :shock:

ENJOY!
I couldn't get the reverse mode off O.o and the car slows down too slowly. With or without braking. BTW. The code is still so short that you should propably just paste it here in code tags.
coolw
Newcomer
Posts: 39
Joined: Wed Aug 29, 2007 11:17 pm
Location: West Virginia
Contact:

Re: WIP Driving Game

Post by coolw »

koodaaja wrote: I couldn't get the reverse mode off O.o and the car slows down too slowly. With or without braking. BTW. The code is still so short that you should propably just paste it here in code tags.
You just hit forward, and either way, it should slow down! I made it so it shows a positive number when reversing, because your are going in a negative direction, not a negative speed, so it shows up as going your reverse speed, but negative. And I will fix the slow speed. Thanks!
My car game! (WIP)
viewtopic.php?f=18&t=53

Code: Select all

Coolw is the best! :)
coolw
Newcomer
Posts: 39
Joined: Wed Aug 29, 2007 11:17 pm
Location: West Virginia
Contact:

Re: WIP Driving Game

Post by coolw »

Ok new release! V1.0!

Changelog:
-Is now an official game! I have gotten most of the main components working!
-[Added] Colored health!
-[Fixed] Slow down speed!
-[Fixed] Loosing alot of health when you hit the walls!

Next to work on, WEAPONS!

Note:
I am gonna drop the drifting thing, so don't expect it soon. I might do it when I am done with everything else ;)

Well here is a link: (just save it somewhere and run it, its a cb file 8-) ) (Below is the code if you want to copy and paste :))
http://files.filefront.com/DrivingCB/;8466242;/fil

Code: Select all

SCREEN 600,450
x#=200
y#=200
direction#=270
acceleration#=0
maxspeed#=3.0
gear#=1
turboleft#=1
turbomax#=1
damage#=100
breakdown#=0

Repeat
    Cls
    Color 255, 255, 255
    Box 0,0,599,339,0
    
    If x>=586 Then damage = damage - 1
    If x<=10 Then damage = damage - 1
    If y<=10 Then damage = damage - 1
    If y>=328 Then damage = damage - 1
    
    If x>=586 Then 
        x=584
        acceleration = 0
    EndIf
    If x<=10 Then 
        x=13
        acceleration = 0
    EndIf
    If y<=10 Then 
        y=13
        acceleration = 0
    EndIf
    If y>=328 Then 
        y=325
        acceleration = 0
    EndIf

    maxspeed = (gear*.22)+.40
    speedx#=Cos(direction)
    speedy#=Sin(direction)
    x=x+(speedx*acceleration)
    y=y+(speedy*acceleration)
    
    If damage <=0 Then 
        breakdown = True
        damage = 0
    EndIf
    
    If damage >= 100.01 Then 
        damage = 100
        breakdown = False
        x = 200
        y = 200
        gear = 1
        direction = 270
        turboleft = 1
    EndIf
    
    If damage <= 75 And breakdown = False Then
        Text 140, 126, "Your turbo containers have sprung a leak!"
        Text 100, 138, "You will loose air based oh how much more damage you get!"
        If turboleft >= 0 Then
            turboleft = turboleft - (.00001 * (100 - (damage + 25)))
            If turboleft <=0 Then turboleft = 0
            Goto breakdown
        EndIf
    EndIf
    
    breakdown:
    
    If breakdown = True Then
        While breakdown = True
            acceleration = 0
            Text 100,150, "Your car has broken down! Hold SpaceBar to repair it!"
            If (KeyDown(57)) Then
                Text 200,162, "Fixing car!"
                redc = 0
                greenc = 0
                bluec = 255
                fixing = True
                While fixing = True
                     damage = damage + 0.1
                     Goto draw
                Wend
            EndIf
            Goto draw
        Wend
    EndIf
    
    If (KeyDown(200)) Then
      //Accelerating
      If (acceleration<maxspeed) Then acceleration=(acceleration+0.003(gear))+(0.7-acceleration)/1000
    Else
      acceleration=acceleration*0.99 'Reducing speed when not accelerating
    EndIf
    If (KeyDown(208)) And acceleration > 0 Then
      //Braking
      If acceleration>-10 Then acceleration=acceleration-0.008
    EndIf
    If (KeyDown(205)) Then
      //Turn right
      If acceleration > 0 Then
        If direction + 3>360 Then direction = 3 Else direction = direction + (acceleration*2)
      Endif
    EndIf
    If (KeyDown(203)) Then
      //Turn left
      If acceleration > 0 Then
        If direction - 3<0 Then direction = 357 Else direction = direction - (acceleration*2)
      EndIf
    EndIf  
    
    If (KeyDown(19)) And acceleration >= -0.5 Then 
        //reverse
        acceleration = acceleration - 0.01
        reverse = True
    EndIf
    
    
    If (KeyDown(2)) Then
      //Gear 1
      gear = 1
    EndIf
    If (KeyDown(3)) Then
        //Gear 2
        If acceleration > .5 Then gear = 2
    EndIf
    If (KeyDown(4)) Then
        //Gear 3
        If acceleration > .79 Then gear = 3
    EndIf
    If (KeyDown(5)) Then
        //Gear 4
        If acceleration > .99 Then gear = 4
    EndIf
    If (KeyDown(6)) Then
        //Gear 5
        If acceleration > 1.2 Then gear = 5
    EndIf
    If (KeyDown(42)) Then
        //Turbo
        If turboleft>.001 Then 
        maxspeed = maxspeed + .35 
        turboleft=turboleft-.0008
        acceleration = (acceleration+0.01)+(0.7-acceleration)/1000
        
        ElseIf turboleft=0
        acceleration = acceleration
        EndIf
    EndIf

    If acceleration>maxspeed Then acceleration=maxspeed
    If turboleft<=0 Then turboleft=0
    
    Draw:
    
    //Draw the speedometer
    speedometerx=61 'Speedometers X-center
    speedometery=395 'Speedometers Y-center
    Color 46,52,80 'Speedometers background color
    Circle 10, 344, 102 'Speedometers background
    Color 160,160,160 'Color for all the other things
    Circle 10, 344, 102, ontto 'Speedometers border
    Circle 57, 390, 10 'Speedometers circle in center
    Line speedometerx, speedometery, speedometerx+Cos(120+Abs(acceleration*100))*40, speedometery+Sin(120+Abs(acceleration)*100)*40 'Speedometers needle
    Line speedometerx+Cos(120)*45, speedometery+Sin(120)*45, speedometerx+Cos(120)*50, speedometery+Sin(120)*50 '0 km/h line
    Line speedometerx+Cos(120+maxspeed*100)*45, speedometery+Sin(120+maxspeed*100)*45, speedometerx+Cos(120+maxspeed*100)*50, speedometery+Sin(120+maxspeed*100)*50 'Max-speed line
    Text 70,412, ""+RoundDown( Abs(acceleration*100)) 'Show speed by using numbers
    
    //Draw the Turbo Bar
    turbox=500
    turboy=400
    Color 46,52,80
    Circle 460,360, 80
    Color 160,160,160
    Circle 460,360,80, ontto
    Circle 496, 396, 10
    Line turbox, turboy, turbox+Cos(120+(turboleft*100))*27, turboy+Sin(120+turboleft*100)*27
    Text 506,405, ""+RoundDown(turboleft*100)
    Line turbox+Cos(120)*30, turboy+Sin(120)*30, turbox+Cos(120)*38, turboy+Sin(120)*38
    Line turbox+Cos(120+turbomax*100)*35, turboy+Sin(120+turbomax*100)*35, turbox+Cos(120+turbomax*100)*40, turboy+Sin(120+turbomax*100)*40
    
    //Draw the Gear number
    Text 0,0, "Gear"
    If reverse = True Then 
        Text 0,12, "Reverse"
    Else
        Text 0,12, gear
    EndIf
    
    //Draw the Damage Bar
    Box 240, 380, 100, 30, 0
        If damage >= 75 And fixing = False Then
            redc = 0
            greenc = 255
            bluec = 0
        EndIf
        If damage >=25 And damage <75 And fixing = False Then
            redc = 255
            greenc = 255
            bluec = 0
        EndIf
        If damage <25 And fixing = False Then
            redc = 255
            greenc = 0
            bluec = 0
        EndIf
    Color redc, greenc, bluec
    Box 240, 380, damage, 30
    Color 255, 255, 255
    Text 275, 360, Int(damage)+"%"
    
        
    //Draw the "car"
    angled_car ( x, y, (direction+90), 10, 10 ) 

    Function angled_car(x,y,direction,width#,height#)
   
        bot_l_x = x+(-(width/1)) * Cos(direction) - (height/1) * Sin(direction)
        bot_l_y = y+(-(width/1)) * Sin(direction) + (height/1) * Cos(direction)
   
        top_l_x = x+(-(width/1)) * Cos(direction) - (-(height/1)) * Sin(direction)
        top_l_y = y+(-(width/1)) * Sin(direction) + (-(height/1)) * Cos(direction)
   
        bot_r_x = x+(width/3) * Cos(direction) - (height/1) * Sin(direction)
        bot_r_y = y+(width/3) * Sin(direction) + (height/1) * Cos(direction)
   
        top_r_x = x+(width/3) * Cos(direction) - (-(height/1)) * Sin(direction)
        top_r_y = y+(width/3) * Sin(direction) + (-(height/1)) * Cos(direction)
   
        Line bot_r_x, bot_r_y, top_r_x, top_r_y
        Line top_r_x, top_r_y, top_l_x, top_l_y
        Line top_l_x, top_l_y, bot_l_x, bot_l_y
        Line bot_l_x, bot_l_y, bot_r_x, bot_r_y
   
    End Function
    
    DrawScreen
Forever
My car game! (WIP)
viewtopic.php?f=18&t=53

Code: Select all

Coolw is the best! :)
koodaaja
Moderator
Moderator
Posts: 1583
Joined: Mon Aug 27, 2007 11:24 pm
Location: Otaniemi - Mikkeli -pendelöinti

Re: WIP Driving Game

Post by koodaaja »

Wow, the car is now much more realistic, it doesn't take half a minute to accelerate to the full speed and it slows down faster too. Great job. I think the car should take a lot more damage, but that is just my opinion ;D
coolw
Newcomer
Posts: 39
Joined: Wed Aug 29, 2007 11:17 pm
Location: West Virginia
Contact:

Re: WIP Driving Game

Post by coolw »

koodaaja wrote:Wow, the car is now much more realistic, it doesn't take half a minute to accelerate to the full speed and it slows down faster too. Great job. I think the car should take a lot more damage, but that is just my opinion ;D
Thanks :D

I am currently working on a bot!
Right now it is just a car that can go forward. (You can NOT Control the bot in any way, except that he will follow you)
I am having a bit of trouble getting it to turn twords you, but I guess I will work on that later today :roll: (its 1:00am here :o )

So I am gonna grab some sleep then I will work on the following things later:
-Bot turning
-Car Damage Algorithm
-Bot Damage Algorithm (based off of cars but with different variables so you dont loose the bots health :lol: )
-Collision with car and bot
-Few tweaks here and there, but thats my schedule 8-)
My car game! (WIP)
viewtopic.php?f=18&t=53

Code: Select all

Coolw is the best! :)
User avatar
Jonez
Devoted Member
Posts: 575
Joined: Mon Aug 27, 2007 8:37 pm

Re: WIP Driving Game

Post by Jonez »

I don't like the physics. The gears don't make any sense: the acceleration is faster with higher gears, but it should be the opposite. If you use the fifth gear as the first gear, the physics (with that gear) should be all right.

And why's there a key for each gear? It would make sense only if you really could change the gear from, let's say, third to fifth. I recommend using the good old a- and z-keys.

You really should fix the cars physics before proceeding to creating a bot (or anything else), or else you end up renewing the physics AND the bot that doesn't fit with the new, improved physics.
-Vuoden 2008 aloittelijan ystävä -palkinnon voittaja-
Image <- protestipelikilpailun voittaja.
Space War
coolw
Newcomer
Posts: 39
Joined: Wed Aug 29, 2007 11:17 pm
Location: West Virginia
Contact:

Re: WIP Driving Game

Post by coolw »

Jonez wrote:I don't like the physics. The gears don't make any sense: the acceleration is faster with higher gears, but it should be the opposite. If you use the fifth gear as the first gear, the physics (with that gear) should be all right.

And why's there a key for each gear? It would make sense only if you really could change the gear from, let's say, third to fifth. I recommend using the good old a- and z-keys.

You really should fix the cars physics before proceeding to creating a bot (or anything else), or else you end up renewing the physics AND the bot that doesn't fit with the new, improved physics.
1. What do you mean by physics? I will study the stuff about gear accelerations and do it based off those.
2. Well cause then you can shift from 5th to 1st but I guess you can shift from 1st to 5th if you wanted to in real life. I will think about it.
3. What do you mean by PHYSICS? Like when the car hits something? Or what? <------- EXPLAIN PLEASE!!!


Note: I did not get alot of work done today. I was out most of the day.
My car game! (WIP)
viewtopic.php?f=18&t=53

Code: Select all

Coolw is the best! :)
koodaaja
Moderator
Moderator
Posts: 1583
Joined: Mon Aug 27, 2007 11:24 pm
Location: Otaniemi - Mikkeli -pendelöinti

Re: WIP Driving Game

Post by koodaaja »

coolw wrote:
Jonez wrote:I don't like the physics. The gears don't make any sense: the acceleration is faster with higher gears, but it should be the opposite. If you use the fifth gear as the first gear, the physics (with that gear) should be all right.

And why's there a key for each gear? It would make sense only if you really could change the gear from, let's say, third to fifth. I recommend using the good old a- and z-keys.

You really should fix the cars physics before proceeding to creating a bot (or anything else), or else you end up renewing the physics AND the bot that doesn't fit with the new, improved physics.
1. What do you mean by physics? I will study the stuff about gear accelerations and do it based off those.
2. Well cause then you can shift from 5th to 1st but I guess you can shift from 1st to 5th if you wanted to in real life. I will think about it.
3. What do you mean by PHYSICS? Like when the car hits something? Or what? <------- EXPLAIN PLEASE!!!


Note: I did not get alot of work done today. I was out most of the day.
By physics, I think he means... well, physics. The car's acceleration, gears (drifting that doesn't exist for now) and collisions. And yes, you can change directly from 1st gear to 5th gear, but I don't recommend trying it ;D
valscion

Re: WIP Driving Game

Post by valscion »

There's many bugs. Here is just few of them:

When the car is broken and you repair it, the health bar turns to blue. Thats ok. BUT:
- After you've repaired the car, health bar stays on blue, as I think it would've needed to be green. It doesn't change color to yellow and red when it takes damage again
- After repairment, the car is teleported to the middle of the screen, no matter where it was before

The gears...
- After you've once used reverse, the text where should read what gear you're using, it says "Reverse"
- Just like the people before mentioned, the gears aren't the same as in real life; When you accelerate from the speed of 0, higher gears should increase speed (aka accelerate) slower. In this case it doesnt happen
SimppaMan

Re: WIP Driving Game

Post by SimppaMan »

As I was expecting..
Almost every car game have the same problem.. ( Home made ones.. )
It accerlates faster is you just but gear 5 and push throtle.. But.. In a real car that's not how it goes.. So.. If you want to it be real as possible.. Make an "power" section to the RPM's.. So .. Between 3 - 5 k RPM there's most power.. And in 1 - 2,9 k there is as much power. So to get the best accerlation, you have to rev up in gear 1 and then go to gear 2 etc.. Get what I am saying?

Sorry for the bad english ..
mikeful
Moderator
Moderator
Posts: 523
Joined: Mon Aug 27, 2007 8:36 pm
Location: Vaasa, Finalnd
Contact:

Re: WIP Driving Game

Post by mikeful »

Please don't post to this old topics. :P
Pelejä: Pelasta puhe, Grinder
Muuta: Blogi, Twitter
Post Reply