Page 1 of 1

ATG - Another Theft Game [Last Update: 06.03.2017]

Posted: 18 Feb 2017, 09:44
by IceReaper
Hey guys, while working on my primary game project, i decided it would be a good idea to start a second one, just to think different and see different code. This will prevent me from thinking in a single direction. As GTA is another game i really really enjoyed when i was a child, this would fit perfectly for me.

Here is the list of features i'm planning to implement. Feel free to suggest more.

Platforms
The Game will run under Windows / Linux / OSX / Android / iOS. It should not be a port but the game actually compiles the same code base for all these platforms.
When a new version gets released, all of these platforms will get a new release. This also allows people to play multiplayer across different platforms.
As i do not have any experience with Playstation, XBox, WiiU, Switch, 3DS, WindowsPhone, etc. or short: no experience with other platforms,
i will not investigate those currently. If the demand is high enough, this might be an option at a later point of development.

Multiplayer
For the Multiplayer implementation, the game will be split into a client and a server. Playing single player is having a server without a port to listen on.
The client will process input, do some predictions and simply draw whatever its told to draw.
All game logic will be running on the server. This allows the server to run custom scripts which automatically affects all the clients. Clients only need to make sure they have the assets present.

Modding
Modding should be as easy as possible. Therefore the engine will come with some special features and tools:
  • Maps are rather complex, so the engine itself will implement a map-editor.
  • Maps consist of blocks and map-objects (models).
  • Everything around (players, cars, weapons, whatever) are entities with a model attached.
  • Models can be 2d (bounding box with sprite) or 3d models.
  • Definitions for entities, weapons etc. are in .json format.
  • Strings and sounds can be either hard coded or mapped using a translation functionality.
  • Scripts will be in JavaScript. Every map, entity, weapon, etc. may have multiple scripts attached to allow mods to extend functionality and be loaded together.
  • UIs will be written in HTML with full asset support. Communication with game via JavaScript (for getting health etc).
Graphics
Graphics will be powered by OpenGL with full support for shaders, shadows, lighting etc. However advanced graphical features are hold back till the project is in a further state.

Game compatibility
Before implementing the new formats, there has to be some content to work with. However, no copyrighted content will be shipped with the game. So either someone start a free asset pack, or people will need the original games at last to do anything inside the game.
Here is the roadmap:
  • GTA2 data reader. This module will read all GTA2 data and populates the specific game classes.
  • GTA1 data reader (with expansions). This module will do the same with GTA1 data.
  • Both data readers will be refactored to not populate the game classes but to convert them to the new file formats.
  • The new data formats will be loaded then, so the original files need to be loaded once only. (at this point, creating mods may begin)
  • The map-editor will be build, as its the only format which realy needs an editor tool.
Source Code
Source Code might be released at a later point. Releasing it directly might create confusion and results in losing control over the project. So for the near future i'll keep it closed.
If i would ever abandon the project, the source will be put available for everyone on github.

Project Name
The project name should differ from GTA due to rights on the brand name. Feel free to suggest a new name for it.

Feedback
Feedback is welcomed! Got another fancy idea? Tell me! I might put it onto the roadmap or make sure it can be achieved with the modding api.

Status-Log

Current Task: Implementing Characters (Pedestrians and Player).

Re: ATG - Another Theft Game

Posted: 18 Feb 2017, 19:36
by BenMillard
Wow, ambitious project! GTA2 avoids the need for a server by using a (very nearly) 100% 'clockwork universe' and the next frame is only drawn once all input from all players is received by all other players.

This made it very suitable for LAN and in the past 15 years good enough for up to 6 players within 1,000km of each other with about 15-30 frames per second.

Larger sessions, longer distances and more complex control mechanisms are the major limits to that model.

However, the (unique?) advantage is that everyone sees exactly the same action no matter how much is going on. 100 bots, all shooting bullets, it scales beautifully. Only the player inputs need to be sent over the wire - a trivial amount of data, it's just tying that to frame rate makes it extremely sensitive to lag.

Some parts of the world enjoy 1990s LAN speeds as Internet broadband speeds - at that stage the limit is physical distance. Electricity and light takes time to move through a wire or fibre. 60fps the model isn't fast enough for international gaming, I would Fermi estimate.

GTA2 in a server-client model would separate the inputs from the outputs, letting each player see fractionally different action on screen. Or radically different - see GTA5! The competitive split-second gaming GTAMP die-hards love about GTA2 is perhaps the single biggest aspect which has kept some of them playing. Everyone synchronised every frame is unique outside of turn-based strategy games, as far as I know.

Do you think frame-by-frame online play is possible? Even if limited to a distance of 1,000km (15fps) or even 100km (~60fps)? With G-Sync the latency fluctuations could let the scene be 'rendered when ready' more elegantly than the V-sync era allowed? Visible stutters but no tearing or 'dropped bullets' or 'phantom headshots'.

Re: ATG - Another Theft Game

Posted: 20 Feb 2017, 06:29
by IceReaper
I've not fully decided how the server/client sync should work in the end. But i want the server to do all the calculations.
I've tried on my KKnD project (linked above) different approaches:

Approach 1: Everyone has its own simulation but with synchronized ticks, so players wait for every other players input before ticking. Pro: was easy to implement and no prediction etc. Contra: The prototype had immense lag with thousand tanks on the map over internet.

Approach 2: Same as above, but without synchronization. Pro: No more lag, Contra: Heavy desync problems.

Approach 3: Server runs the game actually, while each client is simply kind of a terminal. Sending input to the server, receiving entity and world diffs from the server and animating them. Pro: this actually worked extremely well. Contra: The clients are running behind. When you command an unit to move, you must add the latency towards the server, which then processes the command, executes it, and sends back orders for the clients with another latency added. So with a ping of 100ms, you will have about a little bit more than 200ms delay before the unit starts to move.

Approach 3 was actually the best working. However a RTS game does not care about a small input delay. In the case of Top-Down games, i think i'll need a hybrid approach, by predicting the player entity movement and animating its differences from the server. I need to test this later on.

First of all, client and server are just two classes in the same gamecode. When playing singleplayer, a fake-connection is added instead of a socket. So every packet the server sends to the client will simply be put into the received packets list in the client (and also the other way round).
This also means that simple split-screen implementations will be possible by making multiple connections and simply putting 4 renderers into the viewport. In theory you are running 4 clients connected to one server without real networking happening (shared resources). Other players however could also connect onto that server, with additional networking.

Also to notice why i absolutely want to split client/server code-wise: This would allow people to run specialized custom server mods without the need to publish them. Someone could implement an RPG mod exclusively for their server, or capture the flag or such crazy kind of stuff.

But as said before: i'll first try to implement all the components like a player, vehicles, traffic rules, physis, weapons, uis etc.

Re: ATG - Another Theft Game

Posted: 20 Feb 2017, 06:41
by Sektor
It has my interest. There have been similar projects but they were all put on indefinite hold before getting to any where near gta2 completeness.

Re: ATG - Another Theft Game

Posted: 21 Feb 2017, 19:28
by IceReaper
What map editor do you guys currently recommend? I need a test-map following this pattern:
- flat walkable map (so i can move around ingame)
- allways all 5 faces with tileId 1 textured
- Every block-shape type 8 times: rot0,no-flip | rot0,flip | rot1,no-flip, .... all 4 directions with and without flipped attribute
- one slope type per row. starting with type 0 to type 63. beneath the special case for the diagonals with lid 1023 following the same pattern.

I need this to verify all block shapes and their correct texure mappings, and i want to manualy check every single combination as im very critical about my code.
If no editor actualy allows this currently, i could eventualy build a map via hex-editor...

Re: ATG - Another Theft Game

Posted: 21 Feb 2017, 21:34
by Sektor
The official GTA2 editor is the only block editor.

Re: ATG - Another Theft Game

Posted: 23 Feb 2017, 19:05
by IceReaper
Map rendering basically done. Before advancing towards the eyecandy like lighting, i'll rework some of my code for more performance. After that, i'll start to implement player and peds movement.

Re: ATG - Another Theft Game

Posted: 24 Feb 2017, 01:41
by Sektor
So do you still need a test map? I don't know how to make it with all your requirements anyway, I'm no expert on the editor.

Will you use an existing physics engine? None of those have really felt like GTA2 but maybe they just weren't tweaked enough.

Re: ATG - Another Theft Game

Posted: 24 Feb 2017, 07:09
by IceReaper
Nope, see the link in the changelog, every entry has a progress image linked. I made it after digging through the official map editor.

For the physics, i'm thinking about implementing Bullet physics for this. First of all i need to build the general SpriteModel class, which allows to use a 2d spritesheet like a 3d model -> play a specific animation by name etc.

Then the Character class will be made. The Character is physics affected and should collide with walls etc. Using a collision filter, the collision with other Characters will be disabled. This behavior could be toggled. So you can either be blocked by other Characters or simply walk through them, depends on the setting the player wants to have.

When this is implemented, i'll continue on the Player class with actually is a controllable Character. I'll make Input working with keyboard, mouse, gamepad and touchscreen.

After reaching that state, i'll determine what i'll do next. Currently i'm still looking at performance optimization. Running on an 6 year old intel HD GPU, it works with stable 60FPS, but on my development notebooks old Nvidia Quadro 880M, which is not meant to be used for gaming, i get extremely low fps by simply using an openGL renderer. Just want to look if i can tweak this, so development will be a bit faster.

Re: ATG - Another Theft Game

Posted: 24 Feb 2017, 16:56
by Cuban-Pete
Looks cool so far. Keep us updated!

If you need some images or sounds/music, perhaps I can help.

Re: ATG - Another Theft Game

Posted: 24 Feb 2017, 21:04
by IceReaper
So far for my plans on movement... I thought it would be better to implement GTA1 first, so i'll make sure my approaches will work with both games contents.

Re: ATG - Another Theft Game [Last Update: 27.02.2017]

Posted: 01 Mar 2017, 12:15
by IceReaper
I need some help to identify the character sprites. Its highly possible that animations are always 1,2,4 or 8 frames in length, so i already grouped them. Feel free to comment or correct me if im wrong about my mappings, feedback would be extremely useful:

Code: Select all

// Movement
// 8 000 - 007 // walking
// 8 008 - 015 // running
// 8 016 - 023 // jumping

// TODO not fully sure about the car stuff
// 8 024 - 031 // Entering car
// 1 032 - 032 // Sitting in car
// 4 033 - 036 // Exiting car

// 8 037 - 044 // walking with gun
// 8 045 - 052 // running with gun
// 4 053 - 056 // idle
// 8 057 - 064 // idle (smoking)
// 8 065 - 072 // dying by shot from front
// 8 073 - 080 // dying by shot from behind

// TODO what is used "while" falling? Im very unsure about this whole falling thing!
// 8 081 - 088 // falling begin ?
// 8 089 - 096 // falling end ?
// 1 105 - 106 // dead by falling
// 8 097 - 104 // falling end DUPLICATE?
// 1 105 - 106 // dead by falling DUPLICATE?

// 8 107 - 114 // TODO i suppose its dying by punch OR punch-to-ground? Or is it a duplicate from dying by shot from front?
// 8 115 - 122 // punch while standing
// 8 123 - 130 // punch while walking
// 8 121 - 138 // punch while running
// 4 139 - 142 // TODO no idea what this is?
// 8 143 - 150 // dying by drowning

// TODO im not sure about this part. Dying by electricity is in here and has a length of 4 frames.
// TODO either its 4 electrified dying frames + 1 dead electric-burnt body, or its a generic dead body + 4 electrified dying frames
// ? 151 - 155

// 1 156 - 156 // TODO no idea what this is?
// 1 157 - 157 // TODO no idea what this is?

Re: ATG - Another Theft Game [Last Update: 27.02.2017]

Posted: 04 Mar 2017, 01:18
by Sektor
Some seem to be listed here, not sure if accurate, looks like a different numbering system:

https://github.com/u9oqcd4p/OpenGTA2/bl ... ta2spr.txt

Re: ATG - Another Theft Game [Last Update: 06.03.2017]

Posted: 03 May 2017, 14:04
by Sektor
Are you still working on this?

Re: ATG - Another Theft Game [Last Update: 06.03.2017]

Posted: 03 May 2017, 14:18
by IceReaper
Yup ;)

Re: ATG - Another Theft Game [Last Update: 06.03.2017]

Posted: 08 Jun 2017, 19:44
by elypter
i just came across this thread. great work. about the networking protocol i would suggest a hybrid of all 3 methods. do sync but dont wait for the ok and only retroactively correct if the packet has been lost or timed out. this would cause phantom movements but only if the game would hang anyway and the other players are not affected. also implement the server approach to fix occasional desyncs and to allow purely server side code. this could be done by having 2 types of in game objects. those that are client executed and those which run only on the server. this would allow to run timing important things like player and vehicle positions on the clients and AI decisions and mission logic on the server if that is wanted.

however i am personally in favor for releasing everything to the public but if you want to have server only content i think this is the best way to go.