Log In  

My first arcade strait racer 3d (thanks to MOT's code snippet instant 3d+)

enjoy!

Cart #zujanoduje-14 | 2020-06-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
12

P#76996 2020-05-22 00:06 ( Edited 2020-06-05 15:11)

:: Mot
2

Very cool!
(My wife says she likes it too :-) )

The coin-op arcade machine feeling is very well done.

P#77000 2020-05-22 07:36

@Mot thanks! That's alway my style, arcade. Your 3d code Snippet is for good too :)

p.s. update: limited map display to speed the game up 60fps...better!

P#77018 2020-05-22 13:28 ( Edited 2020-05-22 13:58)
:: bigjus

i think its way too hard - too many cars and not enough space to even think about passing them at the speed your going ...

P#77027 2020-05-22 18:21

@bigjus update: fixed the distance between cars. A little bit less hard :)

P#77029 2020-05-22 18:51

Love this!

P#77034 2020-05-22 20:16

I see where you were going with this, and it isn't bad, but the robots are programmed to go in front of the player (I think...) And they don't focus on winning the race, they focus on you NOT winning the race... If that makes sense.

P#77040 2020-05-23 04:48

@BGelais I intend the comments lower down for those people finding this game a little too tricky (as I do). Your game looks good and plays decently within its design choice as a linear racer etc, but I'm not a frequent player of racing games and perhaps because of this I crash very quickly now it has been increased to 60fps.

I have poked into the code briefly - it's very readable and easy to work with; so thank you for that! - and below I provide two tweaks to affect the feel of the game should anyone want them (note to others - BGelais' cart is under the license: CC4-BY-NC-SA) or if you wanted to implement them yourself (but perhaps in a better-than-I've-written-them, adjustable-in-game way, such as easy mode (perhaps with less points for passing cars), and normal mode).

By the way @BGelais I think you have a typo on your menu screen, where it reads "crivals".

Thank you for the game. :)

As I always write at length, I've hidden some of the longer sections.


@Vinnyc11 a quick glance at the code makes their movement look random.

Rival's code and a tweak


From tab 5 (--rivals & stufs)

 if o.spr==7 or o.spr==39 then
    local d=flr(rnd(50))
    if (d==1) o.xd=-.3
    if (d==2) o.xd=.3
    if (d==3) o.xd=0
    if (d==4 and o.spr==39) o.xd=0
 end

If someone wanted to download it and make it easier for themself, the d==1 and d==2 lines could have lower numbers:

    if (d==1) o.xd=-.15
    if (d==2) o.xd=.15

Player's code

What I find difficult is the responsiveness of the car speed.


In tab 1 (player):

--if (btn(⬆️)) pl.sp+=0.1
--if (btn(⬇️)) pl.sp-=0.2

Then:pl.sp=mid(0,pl.sp,5)

pl.sp is then multiplied by 50 to give the player feedback on the speed; tab 4 (draws) oprint(sub("00"..flr(pl.sp*50),-3).." 𝘬𝘮/𝘩",1,120,11)

Analysis of player speed


Presuming I have understood the code correctly with my glance, at 60 frames per second, with a maximum speed of 5, which we get to in 0.1 increments, then we go from 0 to full speed in 5/6ths of a second.

Braking is twice as effective, so when you try to slow to avoid the random x movement of the yellow and red cars, you slow down to nothing in 5/12ths of a second.

I don't have the reactions of a racing driver (0.2 seconds according to racing-elite.com), but I suspect that screen size, button/finger responsiveness, and cramped fingers using the cursor keys for both lateral and speed control also contribute to my many crashes. (I'm going to try out other controls for the version I have downloaded.) When I do catch up to the other cars and try to slow myself - just enough to not crash into them, but not so much as to lose them - the braking is always too much. And if I have overtaken some cars and brake a little too much, a yellow or red car inevitably slams into the back of me.

Perhaps I'm over-reacting in how long I press the decelerate button, whereas perhaps frequent players of racing games have a far finer gradation of control that their fingers exert. I'm not a frequent player of racing games. Anyway, for anyone looking for more gradation of control at higher speeds ...

Tweak to player's code


In tab 1 (player) find player_update and change these two lines:

if (btn(⬆️)) pl.sp+=0.1
if (btn(⬇️)) pl.sp-=0.2

To something like:

local spi,spd,spden=0.05,0.1,1
if (pl.sp>190) spden=((250-190)/3)
spi/=spden spd/=spden

if (btn(⬆️)) pl.sp+=spi
if (btn(⬇️)) pl.sp-=spd

This should allow more control at speeds around 200, which I believe is about what the rival cars are driving at. Note, my code change here isn't designed to be realistic.

Disclaimer: My look into the code really was brief; it might be that other factors also contribute to either the movement of rivals or the player speed.

P#77051 2020-05-23 08:45 ( Edited 2020-05-23 12:02)

@remcode I'm alway open in code suggestions. Thanks a lot! I put you in the credits code and make another update from your suggestion today! :)

P#77072 2020-05-23 13:52

@BGelais Thank you for the mention in the credits code. :)

P#77120 2020-05-24 09:12 ( Edited 2020-05-24 09:13)
1

update: Changed gas/break controls to O and X... plays better, almost for gamepad :)
graphics, added the forgotten threes on the track.

P#77284 2020-05-27 17:40 ( Edited 2020-05-28 14:53)
1

fantastic look and feel to this one! your game has that nice mix of tight controls and tension that classic racers evoke.

i think scoring is bugged though (at least for me). for some reason when i am passing a bunch of cars (right about when i get to a score of 130-155) the score stops increasing. then when i finally crash, the score increases a bit for cars passing my fiery wreckage. once i start again the score starts increasing again, but only for a short while before it stops once more. maybe it is because i hug the rails so to speak? i am not sure.

other than that, i really like this one. i appreciate you sharing your game with all of us! thank you.

P#77644 2020-06-04 09:37
1

@anydayhappyday Thanks a lot! Yes the scoring problem is due to the speed you pass the cars avoiding quickly this condition in the code... if someone got a better solution to fix that, welcome.

 if o.y>106 and o.y<108 then
        if (o.spr==7) score+=20   
        if (o.spr==23) score+=5   
        if (o.spr==39) score+=10   
    end 

By the way, short time after I wrote this, i finally fixed the score bug!! Version 10 ;)

P#77670 2020-06-04 14:34 ( Edited 2020-06-04 16:24)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-07-15 23:36 | 0.138s | 4194k | Q:63