Giter VIP home page Giter VIP logo

sanandreasunity's People

Contributors

antonioganea avatar atirut-w avatar dannywebbie avatar goverlabs avatar in0finite avatar jaan242 avatar ldami avatar lukasgolson avatar quickz avatar spider134 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sanandreasunity's Issues

Map and Vehicle Broblem ?

Error 1: the vehicle doesn't spawn, when I spawn the vehicle sometimes the vehicles come down quickly in the ground

Error 2: When I open the main stage, only waters appear, no other objects appear, the character stands in the air

Note: The Game is not Original (Crack)

How to get into vehicle?

I don't quite understand what can I do in game now. Can I enter vehicle? And if yes, how? All I get is some collision weirdness where I can pass through cars but otherwise no fish.

Implement vehicle hijacking

vehicle hijacking = throwing out other ped and entering vehicle at his seat

Hijacked ped can use VehicleExitingState, but will play a different anim.

Entering ped needs 2 anims, 1 for throwing out other ped and 1 for entering the vehicle.

This requires that 2 peds associate to the same seat, which is not possible at the moment.

Maybe different vehicles will need a different throwing out anim (eg. trucks) ?

Split code into multiple assemblies

... by using asmdef files.

Assemblies to create:

  • SanAndreasUnity.Utilities (90 KB)
  • SanAndreasUnity - main assembly, asmdef file placed in root folder (will be > 340 KB)
  • SanAndreasUnity.Importing (112 KB)
  • SanAndreasUnity.Importing.Audio (17 KB)
  • ...

Benefits:

  • faster compilation (changing a single script will not recompile the whole project)
  • code can be reused in other projects

Don't allocate memory inside ArchiveManager.ReadFile(), but instead cache the buffer per thread - can't be done

This turns out not to be that easy. You can't cache the buffer per thread, because the caller may use the returned buffer in different thread.

Even if each thread has it's own buffer, that buffer will be eventually passed to the main thread. The main thread will read from it (eg. to construct a mesh), and in the meantime, the thread which owns that buffer can receive new read request. This read request will result in reading archive file into the buffer, which is being read by the main thread.

Of course, since we know there are at most 2 threads used for reading archive files, we could only use 2 buffers. Actually... we can't. Let's say that main thread generates multiple read requests which read files into the 2nd buffer. The background thread will read one file into this buffer. After that, it will read another file into the same buffer and overwrite contents.

So, the only way to prevent buffer allocation is to have a pool of buffers. When trying to read new file, obtain a buffer from buffer pool. When finished reading a file (and constructing a mesh, for example), return the buffer to the buffer pool. But, this requires changing a lot of code. No need to make sure that buffer is returned in every situation (in case of an error), because GC will collect him.

We would need to limit this pool to, let's say, 10 buffers. This would allow 10 readings without allocating memory. After 10 readings, every new reading will allocate memory.

Reduce GC allocations

GC causes a lot of freezes in the mobile version.

Here are the screenshots of profiler showing what is allocating the memory (at commit 7725dfb):

Complete list
complete list
imGUI details
GUI details
behaviour update details
behaviour update details


As of version 3.2, GC is freezing the Android game on every 10 seconds, when running at 17 FPS in Demo scene.

As we can see, 7.9 KB out of 11.7 KB (67 %) is taken by imGUI. By converting imGUI to uGUI (see #52 for in-game UI) and using a single OnGUI() function, we can reduce 7.9 KB to only 0.4 KB.

This should be profiled again because #52 is done.

After #106 is done, there will be only a few usages of imGUI, so the most of GC allocations will be done by game logic. Also, this ticket will probably not be important anymore, so it can be closed at that moment.

Don't keep texture data in memory unless it's necessary

When loading textures, specify whether you need them to be kept in memory or not. Usually, they don't need to be in memory, or their data is needed for temporary calculations (flipping the texture).

In case of temporary calculations, when calling Apply(), texture should no longer be kept in memory.

This should greatly reduce amount of memory the application uses.

Can't load the world with some languages

When your OS language is set to some specific language, the world objects can not be loaded. Only water is shown, and player's ped will keep falling and resetting back to original position.

Languages which cause this problem: Turkish, ...

The problem seems to be related to string comparison, when searching for files in an archive.

This should be fixed as of commit cf322da.

How to integrate GXT parser into this project?

Hi, I have finished initial version of SanAndreasGXTParser. Check here.

  1. But how can I integrate this into the project? Would you please offer some help? Perhaps some interface or folder where I should integrate this ?

  2. And I also don't know what code style should I follow? (naming, comments, etc)

  3. About code. Should we consider efficiency from start? Or we just do what we like and then profile?

Aiming/firing position and direction are not good

Possibly it happens because of script execution order. Fire position and direction are obtained after/before skeleton changes or transform update. It can be seen when line is drawn from gun, and ped starts moving to side.

Also, the wrong fire position and direction are sent to the server (when running as a client).

Vehicle's damage system

We are talking about damage to vehicle's health, not to vehicle's mesh.

Most of the stuff is done. What's left to do:

  • multiplayer: Some wheels are not visible to new clients. Only the wheel from the mesh is visible.
  • inflict damage to vehicle on collision
  • detect petrolcap hit (too complicated, and not a priority now). 2 approaches:
    - detect hit on chassis mesh, and check distance from petrolcap - not possible because chassis mesh is usually one-sided, so we can't even detect the hit
    - create box collider on the place of petrolcap - this is difficult, can't remember why right now

Suggestion: Remove "GTA" "San Andreas" from title / description

Hey

just note that a lot of projects get taken down very fast when they do copyright infrightment. Even more when using title and icon directly as project name and at description, let alone assets. Maybe even just using the name together with screenshots is enough to get an issue.

Just keep that in mind. I would suggest to at least change project name/description/icon to NOT say "GTA" "Grand theft auto" "San Andreas" or contain it's icon and say unofficial & unauthorized bold.

GXT Multilingualism support?

There is a language setting in GTX importer.

Should I just hardcoded or put it in config?

If put it in config, then where should I put it? Unity Preference or config.json?

Or we just use English Version for now.

Missing Windows-1252 encoding DLL (Mono, Linux x86_64)

When building the game the necessary files for Windows-1252 encoding will be missing in the exported player.

Copying I18N.West.dll and I18N.dll (from the editor) to the exported game directory or into the *_Data/Managed directory fixes this, as suggested at https://answers.unity.com/questions/42955/codepage-1252-not-supported-works-in-editor-but-no.html

Perhaps Unity could be instructed to include these in Mono builds?
I have not tested if this issue affects Mono builds on other platforms than x86_64 Linux.

Load interiors

Most of the stuff is done.

What's left to do:

  • ped has to collide twice with first and second enexes in order for collision to be processed - maybe the solution is to only ignore collision while ped is finding ground

  • enexes which don't work well: wardrobe, LS skyscraper, desert airport

  • interiors are visible in the sky - we could disable their renderers, but collision must stay - maybe the solution is to move them upward (eg. to 10.000)

Notes:

  • host/server must see all interiors

  • most of the time client won't see other interiors, because objects in interiors have small draw distance and interiors are located high in the sky. Still, if he gets too close to interior, that interior will be loaded.

  • clients will see other peds and vehicles inside interiors - the solution would be to disable objects which are not in the same interior as the local client (only disable their graphics, leave the physics)

  • special case are the interiors which can see the exterior (eg. through windows). This includes seeing peds and vehicles. When client enters this type of interior, he should still see network objects from exterior. Or... for the sake of simplicity, we can treat this type of interior like any other.

  • maybe it would be the best solution to let all clients see all interiors (only static geometry, not dynamic objects)

  • we need to keep track which ped/client belongs to which interior - what happens when client's ped dies ? Should client remain in the same interior ? Probably. Then, when his ped is spawned again, change his interior to the one where ped is spawned.

Playing radio stations

TODO:

  • sync radio across clients
  • don't play sounds in the order they are stored
  • async loading of sounds - some sounds can take 300 ms to load
  • make sure code works fine when there is no audio in game installation - probably done

Bullet raycasting against ped's body parts

Bullet raycasting should not be done against CharacterController (capsule collider), but against ped's mesh. The problem is that there is no way to raycast against skinned mesh. The best solution seems to be attaching colliders to each body part, and raycasting against them. This creates additional problems. Should these colliders be the same for all peds ? Or should they be generated at runtime based on ped's model (which adds performance costs) ?

This is needed for:

  • Detecting which part of body was hit (so that damage can be applied accordingly).
  • Precise shooting - capsule collider doesn't match ped's body.
  • Damaging ped while he is in vehicle - currently, there is no way to kill ped while he is in vehicle. In original game, you can shoot ped at the head while he is sitting, and you can shoot him while he is doing drive-by (?).

This issue is related to #34, which also needs colliders attached to each body part.

What about the version for PsVita?

I, like many, signed up for this project only because of the version for Vita. Therefore, it is interesting that now with the version for this platform?

Issues on case-sensitive file systems

Running the game on Linux with EXT4 and the Steam version of the game, I encounter a lot of errors with files the game is unable to locate due to the case in the path being different.
For instance the "Data" directory has a capital D where as the game looks for "data".
I've had to work around this by creating a disk image with FAT32 and copying the game data there. The code should perhaps be updated to ignore case when looking for files.

Play horn sound

  • identify horn sounds - use different sound for different type of vehicle
  • the horn should work in multiplayer
  • touch input should include a button for playing horn, when ped is in vehicle

Do we need EntryName in GXT?

In GXT File Format, check the GTA San Andreas TKEY.

The EntryName is stored as CRC32. After some research, I can't find a way to get entryname from CRC. Do we need really them?

If we do, do you know where we can find this info?

GXT tokens?

There are some tokens in GXT which is for icons. Has them been imported into the project?

Also there are additional parsing work to do. Some tokens has special meanings works like escape character. I may need some time to test it in game and research on how to handle it.

beginner todo

This issue contains list of tasks suitable for beginners.

  • play vehicle horn (in progress)
  • load gta font
  • load ped movement paths

Unit testing and static object issues

Project doesn't have any unit tests. There are numerous well-known benefits with them. Unity has NUnit integration with specific Play mode.

When I tried to implement a test I found it difficult due to global static variables and singletons couplings.

Example: test Ped.SpawnPed(int, Transform). It calls Item.GetDefinition(int) which searches a static Dictionary for preloaded PedestrianDef.

Such things prevent mocking (e.g. with Moq).

There are alternatives to singletons like Service Locator pattern (a simple Dependency Injection) which is employed in other projects. It is not perfect but in contrast to singletons it allows us to write quality tests with mocks and decouples concrete service implementations.

What do you think of gradual migration to such components structure?

exception: archive not found

i tried to start the game, but i keep getting an error. is something missing?

here's the error:
Exception: Archive not found: D:\github clones\SanAndreasUnity/models/gta3.img
SanAndreasUnity.Behaviours.Loader.StepLoadArchives () (at Assets/Scripts/Behaviours/Loader.cs:271)
SanAndreasUnity.Behaviours.Loader+c__Iterator0.MoveNext () (at Assets/Scripts/Behaviours/Loader.cs:180)
UnityEngine.Debug:LogException(Exception)
SanAndreasUnity.Behaviours.Loader:HandleExceptionDuringLoad(Exception) (at Assets/Scripts/Behaviours/Loader.cs:214)
SanAndreasUnity.Behaviours.c__Iterator0:MoveNext() (at Assets/Scripts/Behaviours/Loader.cs:182)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Ped ragdoll physics

I have applied Unity Ragdoll Wizard to PedModel child objects with Frame components (a.k.a. bones). Here is a result when the Animation component is turned on and then off:

Peek 2019-09-18 23-40

Bones defined in PedModel were mapped like this:

Screenshot from 2019-09-19 00-04-34

For each bone-containing object Unity created:

  • a Collider (of different form, e.g. a sphere for a head and box for a root)
  • a Rigidbody (with different properties like different masses for a head and a hand)
  • (Optional) a Character Joint

We may use this Ped physics structure in two ways:

  • Ragdoll effect upon character death
  • extended collision check (e.g. a bullet hitting a particular body part vs. a bullet hitting a Ped)

The question is: what do you thing about generating such structure runtime for each Ped? Maybe the same time when PedModel Frame children are loaded?

I wanted to ask a community before trying to implement such feature.

Implement better world loading system

  • Don't sort divisions
  • Don't iterate through that many map objects each frame
  • New system will not do any iterations, except when focus point changes it's current division
  • Split all map objects into layers, where each layer contains map objects with certain LOD
  • Requirements:
    • need to detect which objects became visible, and insert them into load queue
    • need to detect which objects became invisible, and insert them into unload queue
    • objects need to have load/unload order calculated - the order in which they are loaded/unloaded
  • ...

Minimap can be loaded faster by not using SetPixel() ?

Can it really ?

There are 144 TXDs to load. Each one contains single texture. Each texture is 128x128. This results in 144x128x128 (2.4M) SetPixel()/GetPixel() calls.

The loading step should be profiled. Maybe texture loading takes most of the time.

Convert UI to new Unity UI system

All in-game UI (health, weapon image, ammo, FPS, FPS image, etc...), main menu, and pause menu should be converted to new Unity UI system.

This will be difficult to do with windows, so we will exclude them for now.

Benefits:

  • better look
  • keeping up with Unity
  • easy to modify
  • able to scale with CanvasScaler
  • no GC allocations, see #40

Better vehicle sync

Vehicle syncing is not good for local players (vehicle drivers).

Drivers should completely control the vehicle, and send it's current state (position, rotation, velocity, angular velocity) to server. Server will check these values, and correct them if needed. If there is no need for correction, he will just accept new state. Otherwise, he sends a packet back to driver, telling him to correct the state.

So, server will allow a certain difference between his state and driver's state. If the difference is small enough, he will accept new state.

Models missing

model folder not found in game
giving following errors while playing:

System.Exception: Archive not found: C:\Users\Adnan\Desktop\SanAndreaseUnity\SanAndreasUnity\SanAndreasUnity\Assets\Resources/models/gta3.img
at SanAndreasUnity.Behaviours.Loader.StepLoadArchives () [0x0005e] in C:\Users\Adnan\Desktop\SanAndreaseUnity\SanAndreasUnity\SanAndreasUnity\Assets\Scripts\Behaviours\Loader.cs:278
at SanAndreasUnity.Behaviours.Loader+d__36.MoveNext () [0x001f6] in C:\Users\Adnan\Desktop\SanAndreaseUnity\SanAndreasUnity\SanAndreasUnity\Assets\Scripts\Behaviours\Loader.cs:184

Add network discovery

"Network discovery" automatically detects all servers on LAN (local area network) and allows the user to easily connect to them.

This would be cool feature, especially if you want to play the game over wifi on Android devices. All you have to do, is to start a server on one device, and scan wifi from the other one.

List of servers can be displayed in JoinGameWindow, in a separate tab. When user clicks "Refresh", LAN will be scanned for servers.

I already implemented network discovery for Mirror, so it is as simple as copying 2 scripts into the project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.