LiteRally, an open source(ish) GeneRally fan-clone

Here you can discuss other GeneRally-like projects.
Post Reply
nothke
Posts: 2
Joined: Thu Feb 09, 2017 4:26 am

LiteRally, an open source(ish) GeneRally fan-clone

Post by nothke »

Hi ppl! I spent around a week making a little GeneRally open source clone in Unity. Just saying open sourceISH because it’s made in Unity, which is not open source, but all my code is!

Why?

So.. Me and my roommate are gamedevs and do various games, I am mostly doing gamejams and got pretty experienced I think in prototyping games quickly. One day we were playing various local mp games and were just ranting how crap they are, Generally was the only game that kept us playing and playing, and how master-able it was, we got better and better and more and more competitive! We just always wished it was a tiny bit better. That night, I just couldn’t wait for GR2, and I felt like.. srsly, I could make this in a week!

In less than 3 hours I made rudimentary tire friction model and then tried to pick surface data from pixels on the ground texture, just like GR, and it worked surprisingly well! And that was kind of the proof of concept to continue doing it. I thought of the name LIteRally instantly, and just kept using it. Tho, it’s not more “lite” than the original :P

The next day, I made a moddable system for tracks and objects, so that you can make your own tracks and even import custom meshes from .obj files. The other days I mostly spent tweaking, adding some tracks, and the menu. I have never done such a mod-friendly game before, so It’s also fun to learn something new. And of course.. I want to play the game with friends and enjoy it with community made mods!

What it has so far?

It has a simple driving model, ( I think ) more advanced and realistic than GR (not neceserally better!). It picks the grip value for each wheel directly from the track texture, but the tire friction is currently working according to contact speed, instead of contact force, which is incorrect, but I’ll improve it some day. At the moment you can play with 1 or 2 players on a few tracks I made so far. You can only select one track and race on it with 5 laps. Adding a season system and more modes would not be so difficult. Right now there is no system for calculating distance (I guess GR used the AI line for it), so I can’t make it “race by km” at the moment. Time-racing would not be hard to implement, I already track time for laptimes.

Why just 2 players? Fooor the moment.. I just want to first be sure to test it with 2 players, and then I can add 8, or 10 or 20 more… Because if I do that now, it could be a pain to change a lot of things.

Obviously there is no AI, I don’t know how necessary is it? I’ve personally never played it with AI because I always play with friends. It would not be hard to implement, but I know it will be hard to make it good, so it is most probably time wasted. But yeah, anyone is free to probe into the code and make some AI :)

There is no damage, fuel or tire wear yet, hence I didn’t bother with pits either. They are drawn on some tracks and there is data structure for them, I just don’t use them yet, need to get the core stuff better till I start working on pits

The menu is quite rudimentary, but functional, you can navigate using any controller in the same way you control the car, and it’s easy to add new options quickly if I need them in code. It’s like a tree structure that saves data in every node. Sure later on it would be nicer to do a proper UI

The sound is quite simple as well, just changing the sample pitch according to speed and throttle. The samples were kindly donated by my roommate from his game, Switchcars.

Height
Currently, there is no height variation on the map, (except by placing objects like jump ramps), but there is 2 ways I am thinking about:

One is importing a custom mesh, which would replace the “ground plane” if defined in the track file, but this would require the author to make it in a modelling software (and properly unwrap the uv for tires to work). I tried this myself and it actually is working pretty well.

The second would be using a heightmap to offset vertices on a dense grid mesh. I am kind of afraid if that’s gonna work well, I did stuff like that before and the terrain produced can be jagged due to limited pixel value (256 in 8bit per channel texture), so surface could be too bumpy and unpredictable. But I have to try first :)

MODDING

Right now, you can add tracks and custom track objects.

Tracks:

All data about the track is stored inside a text based .json file located inside the track folder. Each .json file is one track layout, meaning you can have multiple layouts for a single track texture. The track file is human-readable so you can edit values directly in a text editor. Essentially, you could take some piece, eg. pit positions of one track and copy into another just through the text file, which is really nice to have.

The .json file contains the positions of starting grid, portals (how I call checkpoints), pits, camera position and orientation and names and positions of track objects (for now, I will proly add more stuff)

The problem is that currently, the only way to VISUALLY edit tracks is in Unity editor using my scripts that can pick up objects in the scene and save to the json file. It would be cool to later make the in-game editor as well, so that a track modder doesn’t need to have Unity.

The wheel grip value is taken directly from the track texture underneath the wheel, see this doc for info about it. Essentially everything that is gray is tarmac, anything else at the moment is grass. I am thinking of maybe using a separate “surface” texture where surface type would be defined, so that “the look” can be made independently without thinking “is this gray gonna be gray enough to be tarmac?”

A funny coincidence happened in the feedback loop with pixel setting and getting: as you pass over the grass pixels and set “dirt tracks”, these pixels have a little bit of “bleed” and then you would pick that bled dirt pixel and place it again.. and you will continually stamp dirt even on the tarmac, as if the wheel caught dirt and you spelt it over the road, without me needing to program that s**t in :)

Track objects:

Track objects are .obj meshes in the GameData/Objects/ folder and are used as props around the track. They are loaded at start and placed through positions defined in the track file. Objects themselves also have a json definition file. To add a new custom object, you can simply copy an existing track object folder, rename it text-edit the .json file and add your own mesh. You can also define if the object will have no collision, mesh or box collider surrounding the mesh

One planned feature is to have “bundling”: track objects inside the Track folder as well, so that if you have a special mesh only for a single track, you can bundle it with the track, so for eg. if you want to remove the track, that there is no need to track down objects used by a particular track in the objects folder.

Other things:

Surface grip and resistance can be modded at the moment in the GameData/surfaces.json file

Cars can’t be modded at the moment, but implementing modding in the similar fashion to track objects would not be so hard, since all car data is (almost) already serializable, and could be put into a .json file. I just don’t feel confident exposing the stuff yet since I need to rethink some parts, rearrange the structure and expose some more stuff.

I mean.. it’s funny to say “can’t be modded” since it’s open and anyone can load it up in Unity and change scripts and rebuild the game, so.. EVERYTHING is moddable xD

One thing worth mentioning is that cars are designed in a modular-axle system, you can have as many axles with as many wheels you want and have each axle be powered, steered and/or use brakes or handbrakes, essentially you could make a forklift with rear axle steered if you wanted..

A few things I would like to implement other than what GR already has:
Day night cycle - I already did this numerous times for my other games, should be very easy to implement (cars already have headlights but are always off)
Weather - also did this before, would be easy to make it visually and affect tire grip on the whole map … buuut .. that said .. it would be muuuch better if the rain for example actually washed the dirt away from the track, the drying would happen gradually by driving over!!! But that would ofc require some experiments and time to make
Rally - It has “rally” in the name and you can’t rally? xD by which I mean.. point to point races with cars starting at intervals
Breakable parts - would be cool having some parts flying off, posing danger to other players + broken wings should affect aero for eg.
Tire choices - some tracks with mixed surfaces would need good strategic thinking

Cars I made:

Skewt - 70s rwd rally and GT car (currently the mascot of the game) - overall good, powersliding into every corner
Formulite - F1 like - lots of grip and power, aero for a lot of traction at high speeds, but can oversteer easily

Some car ideas I want to do:
80s 4wd group B car, very powerful, oversteery, good on gravel, awful brakes, awesome sound with pfffriyuyuyu turbo flutter
2000s wrc-like, powerful, well balanced, good grip on all surfaces, some aero
50s F1: superpowerful, s**t steering, essentially no brakes, terrible tires sliding everywhere, would require planning the racing line to like next 4 corners
east europeany car: slow, pretty much worst in every category, but offers close competition
all terrain: relatively slow, but good traction on all surfaces

Also, important notice: The game is quite crappy at the moment, expect bugs, some tracks are unfinished, etc. but consider this was made for a week of part time work.. I was just really impatient to share it with you ppl as soon as possible! :)

All source is here:
https://github.com/nothke/LiteRally

and you can grab the current build here:
https://drive.google.com/file/d/0B6-Kp1 ... sp=sharing

Also I am posting screenshots and updates on Twitter, so follow me there https://twitter.com/Nothke


I hope I will provoke some excitement from you fans, looking forward to hearing your suggestions and possible collaborations ;)
User avatar
Mad Dan
GeneRally Trackmaster
Posts: 2507
Joined: Sun Dec 27, 2009 4:46 pm
Location: Czech Republic

Re: LiteRally, an open source(ish) GeneRally fan-clone

Post by Mad Dan »

It does quite feel like the GR2 demo that was here during the kickstarter thingy :).
So just for fun I imported my landmap from a GR track and replaced one of your tracks with it :D however since I have zero clues how to edit the objects it looks like that :D.

It was very hard for me to drive the cars though, I suppose things can change in the next version? :)
Attachments
Eikster.png
kroeberg.png
nothke
Posts: 2
Joined: Thu Feb 09, 2017 4:26 am

Re: LiteRally, an open source(ish) GeneRally fan-clone

Post by nothke »

Oh that's nice!! I haven't tried to import GR tracks myself :)

Yeah, I guess some sort of in-game editor for objects would be really important to make, since no one would be bothered to download Unity and then look at my messy editor stuff just to place objects for their tracks..

For the driving tho, well, I like it, but it's very different from GR. Once I give you the car tweaking tools, you'll be able to set the values as you wish, so we'll see what people come up with.

The thing is this is a fun side project for me and I am very busy right now so I don't know when I'll work on it again, I hope soon!
Motormann
Posts: 36
Joined: Sat Feb 27, 2010 6:57 pm

Re: LiteRally, an open source(ish) GeneRally fan-clone

Post by Motormann »

I was excited to check out your demo. Not sure if you're planning to work on this any more or not, but I thought I'd give my feedback. I've been really daydreaming about trying my own hand at making a GeneRally clone in Unity. I have a bit of experience in Unity, but I don't think I could get the car handling and feel right though, as that's something I know nothing about, and that's really the most crucial element to this kind of game. Having said that, LiteRally, while a promising early look, is way off on the physics. I'm sure you know it's not as good as GeneRally, but I have to say that it feels really bad to me. Now, please don't take that the wrong way, I don't think I could do it better myself, as I said. I'm just thinking that if you could get it at the level of GeneRally, you'd really have something here.

To be more specific, there's a bit of an odd way the turning works, where it seems like the car is on a pivot somewhere just ahead of the rear axle. You can see this by turning the car while it's not moving fast. It appears to actually drag the front tires across the surface. The sliding/drifting doesn't feel right either, it's too easy to spin the car out completely, which in GeneRally a complete out of control spin almost never occurs (unless you really tweak the car values to something crazy and undriveable).

My opinion on the graphics is that the cars look really nice, but the track texture doesn't look quite as sharp/crisp as GeneRally, so I think that could use some improvement as well.

Please take this as constructive criticism from someone who REEEEEALLY wants to see a new/updated version of GeneRally get made.

If you're curious at all about what I'm doing with Unity, you can have a look at my dev blog at http://blockitect.blogspot.com. It's a physics based block building game/toy, not at all GeneRally related. I would consider myself a bit of a hack/hobbyist with Unity and C# programming, but I've developed a fair few skills and have learned a lot in the course of making my block game (which is far from finished but has a playable version).

If LiteRally is something you are going to really attempt to make better, and if there's a chance you could get the car physics to the standard and feel that makes GeneRally what it is, then I'd be very interested in finding a way to collaborate with you. I've been exploring some ideas and putting out some feelers for what it would take to make this kind of game myself as I said, but the big stumbling block for me is the car physics and AI. I have ideas for the multiplayer that would be very unique and interesting, and I know of a possibility to implement in-game mesh editing, to allow users to create cars and tracks without needing to use external modeling software or use Unity.
Rendy
Posts: 1317
Joined: Sat Jan 02, 2010 2:40 am
Location: Parallel World
Contact:

Re: LiteRally, an open source(ish) GeneRally fan-clone

Post by Rendy »

Looks cool! I'll try this one out!
Y'all, I just woke up... what did I miss?

GeneRally Catalogue - [R]GARAGE - Twitter - Blog
User avatar
Elharter
Posts: 51
Joined: Fri Feb 21, 2014 9:13 am
Location: Vienna

Re: LiteRally, an open source(ish) GeneRally fan-clone

Post by Elharter »

Good Job!!! Looks great! i will follow you
Post Reply