1 (edited by necropotame 2016-12-30 17:01:14)

Topic: Portable TeeUniverse Map

I've create a small modification for TeeWorlds to allow server to read "Portable TeeUniverse" maps. PTU maps are pure vanilla maps, but that contains two invisible special groups: "#Entities" and "#Zones".
The concept of zones and entities comes from TeeUniverse and PTU maps are designed to facilitate the integration of maps made with TeeUniverse on existing mods.

A zone is a tile layer or a quad layer that define area in the map with special properties. Typically, "death tile" are a kind of zone, but here, it's also possible to define "death quads". Ultimately, it will be possible to animate those quads and create moving death elements. I will implement this part once the animation tools are done in TeeUniverse. The adventages of zones is that you can define as many zone as you want. You can even create multiple time the same type of zone, the server will take the last non-zero index of all zone of this type. It's much more flexible than the vanilla tile system.

An entity is a point that the server detect to create an in-game entity such armor or gun. In vanilla, entities are added using tiles, but in fact, there is no reason to align them on a grid (except for the sake of beauty, but this should be the decision of the map maker). In PTU maps, entities are represented by quads and then can be located in any part of the map.

https://s27.postimg.org/x3kis1lpv/ptum.png

Here is the code to read PTU maps: https://github.com/teeuniverse/teeworlds-ptum

Tutorial

Entities:

To create an entity, you must have a group called "#Entities". In this group (please enable clipping so players will not see it), create a quad layer called "twHealth". Any quads in this layer will create a heart in game, where the center of the heart is given by the position of the pivot. Vanilla entities are twSpawn, twSpawnRed, twSpawnBlue, twFlagStandRed, twFlagStandBlue, twShotgun, twRifle, twGrenade and twNinja. You can also create you own entity. Just change the name of the quad layer, and in your server, in the function "OnEntity()", check the name of the entity:

if(str_comp(pName, "myEntity") == 0)
{
    //Create something at the position "Pos"
}

Zones:

To create a zone, you must have a group called "#Zones". In this group (please enable clipping so players will not see it), create a quad layer called "twDeath". Any quads in this layer will create a death zone in game. However you must setup the index of this quad (like for tiles). Set the ColorTO value to "1" to make it a death zone. You can also create a tilelayer called "twDeath". Any tiles with the index "1" will be a death zone.

Once again, you can create your own zones by changing the name of the layer and set one of 128 possible index values. In your code, you must first create a handle to the type of zone in the function CGameContext::OnInit

m_ZoneHandle_MyZone = m_Collision.GetZoneHandle("myZone"); //m_ZoneHandle_MyZone is a public variable of CGameContext

Then, you can check this position in your code using this function:

int Index = GameServer()->Collision()->GetZoneValueAt(GameServer()->m_ZoneHandle_MyZone, x, y)

PTU maps are designed to be fully compatible with vanilla editor, without any modification. However, it's not simple to make them because the editor is not made for this. TeeUniverse is of course preferred to do this, and the upcoming version 0.2 will suport import/export of PTU maps. But now, there is no reason to not use them smile In addition, if all mods use the appropriate names for layers, a single maps will be able to run on several mods without collision with indices.

2

Re: Portable TeeUniverse Map

I've updated the repository: zone quads can now be animated with envelopes, the server will compute the transformation according to the round time automatically. It means that you can now create flying death zones, but also moving freeze zone for DDRace, moving shrine for OpenFNG or rising from the ground infected area in InfClass.

The next step will be to animate entities as well. It will allow to create moving pickups.

Small changes in the specifications: The position of an entity is not given by the barycenter of the quad, and no more pivot. Otherwise, it's impossible to animate the entity correctly smile

3 (edited by James_Trj 2017-01-02 19:37:48)

Re: Portable TeeUniverse Map

Really awesome! Movable objects are coming to teeworlds! I've waited over 5 years to make a decent map, this feature will be helpful smile

By the way, I have a few questions: How can you set up a zone quad layer with hookables and unhookables? Are those groups called twHook and twUnhook?  and why do I have to set a specific value in ColorTO?

4

Re: Portable TeeUniverse Map

I've not implemented twHook and twUnhook because the client will not be able to predict it correctly. It's possible to use it to display other tees moving on it (because those ones are not predicted by the client), but not the tee that you play. One can imagine making cinematic with it for example, but it start to be a little bit harder smile

Concerning the ColorTO, you must set it for zones because each quad can represent a different type. In the case of twDeath, there is only one, but you can imagine a DDNet-like zone that have freeze, unfreeze, deep and undeep types. The layer will be called "ddFreeze" and the ColorTO can have the value 1, 2, 3 or 4 (0 = empty) depending if you want to create a freeze quad, an unfreeze quad, a deep quad or a undeep quad. I agree that it's not elegant.

5 (edited by James_Trj 2017-01-02 21:12:16)

Re: Portable TeeUniverse Map

Oh well, thanks for your reply, you're doing a great job! I really like the map editor, it makes easier the artistic job of map makers, and I couldn't imagine how good maps would it be possible to make using Quads as hook/unhookables (ex. "the big tree", "a journey into the mountain", movable platforms, adventure mods, etc...) smile

6

Re: Portable TeeUniverse Map

I urge everyone to join the server at 137.74.156.196:10005, it's really amazing to see this in action!

7

Re: Portable TeeUniverse Map

quite cool

Teeworlds [ friends ] clan
Some YouTube Stuff about Teeworlds

8

Re: Portable TeeUniverse Map

http://s019.radikal.ru/i615/1701/e2/a21ba0958096.png
http://s008.radikal.ru/i304/1701/24/5c95265137fc.png
^^^^^^,,^^^^^^

9

Re: Portable TeeUniverse Map

To sump up:
I have to download the source https://github.com/teeuniverse/teeworlds-ptum, compile it, create a map with the so-complied client, and then CTF, DM, TDM can understand and display this cool things?

I will be banned if I troll again ...

10

Re: Portable TeeUniverse Map

You can create the map with any editor (vanilla is fine). But this map should be executed by the server compiled with teeworlds-ptum, in order to get animated quads smile