1

Topic: Modding Tutorial

Hi everytee.
I was wondering if there were any helpful people out there who could post a quick tutorial on how to start modding, as I'm not sure where to start.
I have a fair amount of knowledge with C and am capable of learning as I go.
Cheers!
GENKI.

2

Re: Modding Tutorial

There is no "quick tutorial" out there for modding, that comes with experience browsing the code and modifying small stuff.
You definitely should look at this page for all the information (but not a "tutorial") you would need: https://www.teeworlds.com/?page=docs&wiki=Hacking.

Not Luck, Just Magic.

3

Re: Modding Tutorial

this is a real issue imho. i have some basic knowledge in c++ up to classes and arrays, but since i only use it for the stuff i need (simple algorithms that are rarely much larger than 100 lines of code), i do not know anything about game developement. the biggest problem is definitly to get the structure. im used to a single .cpp file with all stuff in it, now i have tons of files and do not know where to go for certain features, and there is absolutely no explanation for that (sometimes the name help, but that does not solve it). do i really need to be a game developer for this? i would be pleased if someone of you can make a tutorial on the structure, where to go to find certain features.

4

Re: Modding Tutorial

this is a real issue imho. i have some basic knowledge in c++ up to classes and arrays, but since i only use it for the stuff i need (simple algorithms that are rarely much larger than 100 lines of code), i do not know anything about game developement.

Translation: you're not used to do actual programming. This is not a problem of the Teeworlds code or the documentation.

Not Luck, Just Magic.

5

Re: Modding Tutorial

its a decision of the game developers wether to allow someone who does understand the code you use understand the structure also, or stick to a confusing and obscure structure that maybe most game developers are used to without explaining it, to make sure normal people do not touch your code.
i dont care about your definition of programming, you choosed it so that it fits your argumentation. i did not encounter a single problem yet that was not solvable for me.
again, the developers always decide whom they want to ube able to contribute.

6 (edited by BeaR 2013-11-10 18:47:33)

Re: Modding Tutorial

Arrob wrote:

[..] or stick to a confusing and obscure structure that maybe most game developers are used to without explaining it, to make sure normal people do not touch your code.[..]

lel.
teeworlds architecture is actually pretty clean and simple:

* base : contains all the common functions for I/O, multithreading, string handling, maths, etc
* engine: underlaying game engine, mainly accessed via several interfaces 
 (graphics, input, network, etc.), which are registered on startup (->kernel). 
 Also contains the client and server backend, which run the actual gamecode.
* game: here is the actual gamecode/teeworlds specific stuff like gameworld, entities, etc.

yeah some parts could be refactored but it's pretty easy to work with the current codebase imho


Important parts of the game code are even documentated.

@topic: look at src/game/server/ as a startup for gamespecific stuff like entities or gametypes

7

Re: Modding Tutorial

::Tick() function is called 50 times per second (normal), you can use it for timing stuff smile

character.cpp -> Information about the character (you don't say). health, ammo, current weapon, alive? -> you can kill a character here or takedamage

player.cpp -> Information about the player on the server, if character exists, then there is also a player, this file/class is handling for instance the team, scoreboard score. the ::snap(int SnappingClient) function "renders" the player with some given information for the client with the number snappingclient

laser.cpp / projectile.cpp: here you can modify the projectiles or the laser ray.

gamecontext.cpp is the "global server" (i know it's wrong, but it's easier to imagine, imo)... while player and character are 1 "person", you can handle in this file more players m_apPlayers[...] is the reference to player.cpp, this is a good place for events for example or chat commands

gamecontroler.cpp: decides about weapon on spawn, warmup, handles map-cycling, inactive kick...


well... start with modifiing stuff in character and player or gamecontext, look what happens and so on


i'm sorry for about 100 grammar/sense/spelling mistakes, but i'm quite tired due to the long nights on weekend (WordPress Camp Berlin *yaay*), btw feel free to contact me in skype for further questions

@Dune: i know that this is not the right way of learning c++ and/or programming in general. but this is the easiest way. instead of learning how to deal with a console project by watching tutorials or reading books, it's easier to learn by trying, but the disadventage is, that it takes longer and you need to aks always. in addition to that you learn it only for teeworlds



Pikotee smile

#yemDX is a known troll

8

Re: Modding Tutorial

Arrob wrote:

its a decision of the game developers wether to allow someone who does understand the code you use understand the structure also, or stick to a confusing and obscure structure that maybe most game developers are used to without explaining it, to make sure normal people do not touch your code.

You got me terribly wrong.

Teeworlds code is very well structured and we offer support to people who want to contribute. However saying Teeworlds code is - quoting - confusing and obscure because it's not "everything in one .cpp with no algorithm longer than 100 lines of code" is beyond wrong.

You're just lacking experience - and it's fine to get it on Teeworlds code - just don't crap on the devs or the available documentation for not putting huge efforts in making cheap modding easier.

Not Luck, Just Magic.

9

Re: Modding Tutorial

Yea, the teeworlds code indeed does lack some documentation, except for the baselib (everything in src/base/) basically nothing is well-documented. It would probably be good to add some documentation, not just for the new coders.

10 (edited by GENKIFlare 2013-12-22 18:18:44)

Re: Modding Tutorial

If it is alright if I push this back up, thanks Dune for that link you posted.
I should learn by modifying small sections of the code and seeing what occurs. smile
Perhaps the documentation could be open to edits by developers
if they think they have something valuable to add?
Just a little suggestion.

11 (edited by ReD|FoX43.rus 2014-02-16 12:52:21)

Re: Modding Tutorial

DELETED

12

Re: Modding Tutorial

What if we use style comments for Doxygen?

http://www.stack.nl/~dimitri/doxygen/ma … locks.html

13

Re: Modding Tutorial

I would highly appreciate if somebody adds some kind of documentation and to have an overview of all members and functions and what they do and what they are used for.
The current situation is in my opinion very unsatisfying and requires an high amount of research if you want to take a look 'deeper' into the source, especially for 'newbies'.
Furthermore a good documentation is nothing bad but just good, 'cause it clarifys what the author does and what his intention is and helps to increase the code-quality and bug-finding.

14

Re: Modding Tutorial

unsigned char* wrote:

What if we use style comments for Doxygen?

http://www.stack.nl/~dimitri/doxygen/ma … locks.html

Current documentation uses Natuarl Docs syntax

15

Re: Modding Tutorial

BeaR wrote:
unsigned char* wrote:

What if we use style comments for Doxygen?

http://www.stack.nl/~dimitri/doxygen/ma … locks.html

Current documentation uses Natuarl Docs syntax

yikes Good to knows... and why don't use it?? xDD

And say it in https://www.teeworlds.com/?page=docs&am … menclature  wink

16

Re: Modding Tutorial

It is used, several parts of the code ARE documentated, anyway could be more
Feel free to documentate it ^^

I agree on adding it in the 'Coding Style'

Here a list of some documentated files (just listing those which came to my mind):
https://github.com/teeworlds/teeworlds/ … r/entity.h
https://github.com/teeworlds/teeworlds/ … ntroller.h
https://github.com/teeworlds/teeworlds/ … ameworld.h
https://github.com/teeworlds/teeworlds/ … e/system.h