[WIP] C++ rewrite of Terraria

Discussion in 'Released Mods' started by iloveportalz0r, Jul 22, 2012.

?

Is this a good idea?

Yes 49 vote(s) 87.5%
No 7 vote(s) 12.5%
  1. This project is currently not being developed, but it is not abandoned.

    As the title says, I am currently making a C++ version of Terraria. I'm using SDL for the audio and input handling. OpenGL is doing the graphics now.

    Here's some for why I'm doing this:
    • It will run natively on Linux (and possibly Macs, not sure yet)
    • It will be faster (hopefully)
    • It will not depend on Microsoft code (.NET/XNA) or Mono
    • ^ I hate Windows, and I hate Microsoft
    Here's my (short) list of goals. Green = done, purple = partially done, red = not started
    • 100% accurate compatibility with Terraria's config and save files - The data must be exactly the same as Terraria's when reading from and writing to said files
    • Compatibility with the XNA file formats - Reading them directly is too complicated, so convert them to PNG/WAV/etc on the first run (I will not distribute these files, as that goes against the forum rules)
    • Singleplayer :p
    • Multiplayer compatibility - The C++ client must be capable of seamlessly communicating with the C# server, and vice-versa for the C# client/C++ server
    • Multiplayer security - See this thread for more information
    • Code optimizations - There's always something that can be improved, therefore this will never be considered truly done
    Final goal: The average user should not notice any significant differences between the C++ version and the C# version

    Current OS support (I will update this if/when it changes):
    • Windows - Yes
    • Linux - Yes
    • Mac - Unknown (I don't have one)
    Screenshots:
    Show Spoiler
    [IMG]
    Show Spoiler

    [IMG]


    XNA conversions:
    • XNB to WAV - Done! It converts all 104 files in a few seconds :D (code based on this)
    • XNB to PNG - Almost done. Some of the XNB images don't decompress properly.
    Github- The following files have been committed:
    • BinaryReader.h
    • BinaryReader.cpp
    • BinaryWriter.h
    • BinaryWriter.cpp
    • XNAconverter.h
    • XNAconverter.cpp
    Those files are now outdated, and I have not uploaded the latest versions yet. Done.
    I have not committed anything else yet because I do not want to give people unorganized, incomplete, or undocumented code :oops:

    For the lulz, have this thing:
    [IMG]

    Technical note: This is more of a rewrite and a port, since I'm using parts of Terraria's code (variable and function names, etc). Blame the inaccurate title on my typing it after midnight :p

    A question for the mods: The forum rules say that you should never post "Hacks, third party clients, or a way to pirate Terraria/any other game". Does this count as something that shouldn't be posted? (see note about XNA files above)
    plaYer2k, a123b, nababoo and 4 others like this.
  2. Pyrii Cursed Man

    I wanted to do this, but given I suck at programming from scratch I never got past trying to write base code. I approve of this idea and hopefully you'll have the chance to write in extra features and configurability that the original game never had. And built-in mod support :3

    Let us know your progress and when you github the source and/or look for collaboration.
  3. Surfpup Raincoat Zombie

    Good luck! When you're done, I might work on a tConfig version of it.

    That second bullet point though seems kind of pointless. If I understand correctly, there are likely to be various things you can do to improve upon the networking code, which you can't do if it needs to be talking to the original version. I don't think it's that much of a hassle to have people play with other players that are using the same version.
  4. I don't want to put it on github until I have more done.

    Well, I said it must be capable of communication. I didn't say there can't be an option to use a more optimized method :D
  5. LeoMav Squirrel

    Good morning/evening. Terraria, based on C++ - is a great move, indeed.
    How long do you think, it will take to finish your project?
    Are you going to fix the bugs and errors, which were missed by the developers? - link
    And will it still work on Windows OS' as well?
    1. I don't and can't know how long it will take to finish this. Please don't ask again.
    2. I will fix any bugs I see in the code, but I won't focus on fixing bugs until this is an actual game and not a tool for reading Terraria's config files.
    3. I will try to keep it compatible with Windows, but Linux/Mac support has a higher priority for me.
  6. Ace the Best Yellow Slime

    Hmm interesting, Good Luck! Will it be less laggier than the normal Terraria also?
  7. Vairean Slimed Zombie

    I am wondering if you asked Red's consent for rewriting his game.
    topazg likes this.
  8. Berserker66 Umbrella Slime

    Like OpenOffice had NOT to ask microsoft if they can copy microsoft office features?
    Completely rewriting without using any copyrighted material is perfectly fine legal wise.
  9. iPie uDie Green Slime

    I don't want to seem like a dick... But if you're using the same resources, file formats etc. it sounds like it would be an utterly futile effort / wasted time on your part.

    XNA files compiled with visual studio are compressed which will make them an absolute pain for you to get past, the map format is just a big clump of map data making it extremely slow to save and load, the item's and npc's are absolutely horrendously done, the multiplayer 'protocol' is also..... it's absolute garbage. The multiplayer 'protocol' in it's current state only has a SINGLE packet that is split to be used for every piece of data needed, rather than specific packets per data type. There is absolutely NO reason you should aim for your multiplayer protocol to be the same as the existing...

    But if you're serious I might be interested in working with you if you want?

    Re-writing the game would only be doing everybody (including Redigit) a favor...
  10. Dubby Slimed Zombie

    I may be interested in working with you as well. The way the maps are handled is... ugh, very unpleasant. And a rewrite would also allow the implementation of fully-embedded support for custom content, including scripts. A LUA module could be used for custom content, for instance. It'd also stand to reason that if the map is re-engineered to work in a compact and efficient manner, the map could be considerably extended horizontally. Not to mention there is an opportunity to really improve on a lot of elements of the game in general. Of course, at this point you'd have to ask if it wouldn't be worth it to just partner up with Redigit and work on a 'Terraria 2'.
  11. Phlebas Spriter

    I'm making a standing offer to sprite new everythings for a serious new Terraria-like game.
  12. I can't know that until it's done, but I hope so!

    Nope

    1. I plan to make the game convert the files on the first run. I already have PNGs for the sprites and WAVs for the music.
    2. I want to make it the same first, then add optional optimized methods for things that might break compatibility with the original C# version. Things that won't break compatibility but will run faster will not be optional.

    I was thinking about adding LUA when the game is in a playable state. How about this. When it's done (or almost done), I'll upload the code somewhere for anyone who wants to help. Github is good for that kind of thing, right?

    This is not supposed to be simply like Terraria, but that's a nice offer to make.
  13. Trace Kern Green Slime

    I *really* wish this project the absolute best of luck. Seeing Terraria's engine re-written for better optimization and performance by itself is a worthy goal, since I hear quite often that the current core code is sloppy, inefficient, and a nightmare overall.

    I have a couple suggestions to make. Try to allow as much customization as you can. Any of us who have attempted tConfig coding should know how many things are effectively hard-coded into Terraria's exe and cannot be touched. It would be wonderful to see a new executable created where so much more can be altered and modified.

    Second, just to cover your ass legally, you should design this so that it cannot be used without first installing a legit copy of Terraria. Like how tConfig cannot install without accessing the Steam'd executable, I would seriously recommend a similar approach. I would hate to see this project get shut down by a Cease & Desist letter from Redigit/Relogic.

    Finally a question. Once you have finished faithfully emulating all the current engine and features of Terraria, will you be passing the project on or will you consider continued development yourself?
    I'm certain that everyone who has posted here has their own wish-list of features to add to Terraria, and I'm equally certain you would have a lot of helpers waiting to sign on.
    topazg likes this.
  14. Thanks :D

    I'll keep that in mind ;)

    It doesn't run properly without Terraria's "Content" folder, but if anyone has any suggestions for something more secure, go ahead and suggest!

    The code will be available to anyone who wants to help, since I won't have much time to contribute when school is in session again. I'll set up a Github thing when I have more done.

    :eek:
  15. Berserker66 Umbrella Slime

    Just to make sure; the way worlds are saved is pretty much the worst method I can think of. The only thing worse would be to save it as text, like xml or cvs.

    You most definitely should not adapt it.

    In collaboration with surfpup we improved it a bit for tConfig, but we can't really make major changes without breaking something, so some nasties had to stay.
  16. I'm new to Terraria and its code, so if you have any changes to make to such things when I put the code on Github, go ahead [IMG]
  17. Berserker66 Umbrella Slime

    I only use C/C++ when absolutely necessary, for a freetime project I would not lower myself to such.. low level languages.

    But I can certainly give you pointers on how to improve the format.
  18. I don't like getting high... or using really high-level languages like C# or J@rva.

    I'll probably need to use pointers to use the pointers you give me :p
  19. Empio Blazing Wheel

    Everything in C# is a smart pointer (they delete themselves when their reference count drops to 0). I think you can use regular points in C# as well, you just need to use /unsafe.

    Pointers aren't really a problem in C++. It might be worth writing up a memory management class to help keep track of any memory leaks you might cause.

Share This Page