in0finite / sanandreasunity Goto Github PK
View Code? Open in Web Editor NEWOpen source reimplementation of GTA San Andreas game engine in Unity
Home Page: https://discord.gg/p6jjud5
License: MIT License
Open source reimplementation of GTA San Andreas game engine in Unity
Home Page: https://discord.gg/p6jjud5
License: MIT License
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)
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.
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) ?
Possibly because initial daytime depends on the current time.
... 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:
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.
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
imGUI details
behaviour update details
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.
This can only be done after #52 is done.
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.
drive-by = free aiming/shooting from vehicles
Here is how it looks like:
https://youtu.be/hbURcBm5Erg?t=100
ToArray()
allocates memory and is slow.
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.
Hi, I have finished initial version of SanAndreasGXTParser
. Check here.
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 ?
And I also don't know what code style should I follow? (naming, comments, etc)
About code. Should we consider efficiency from start? Or we just do what we like and then profile?
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).
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:
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.
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.
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.
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.
Display info from object definition for StaticGeometry
.
Also draw bounding box around Division
, using gizmos.
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:
This issue is related to #34, which also needs colliders attached to each body part.
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?
Remove default folders.
Add folders: /mnt, /home, /media, ...
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.
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?
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.
This issue contains list of tasks suitable for beginners.
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?
Mirror folder is totally empty
Which package you used for it?
Instead of 9.81, it's loaded as 981.
Maybe it happens when float.ToString()
gives e.
This happens only on Windows so far.
Actually, this probably happens because of culture (#65). This seems to be fixed now.
Unity executes scripts at order at which they are loaded. This order can change with every build, which can cause the game to behave differently.
The only way (that I know) to prevent this is to assign execution order to all scripts.
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)
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:
Bones defined in PedModel were mapped like this:
For each bone-containing object Unity created:
We may use this Ped physics structure in two ways:
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.
As the title said.
Nintendo Switch is more capable to run it.
Thanks.
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.
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:
CanvasScaler
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.
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
"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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.