Hi im a C programmer

Content and general development discussion, including quest scripts and server code. TMW Classic is a project comprising the Legacy tmwAthena server & the designated improved engine server based on evolHercules.


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board.

Its current use is for the continued development of the server and game it has always served: TMW Classic.

Post Reply
treik
Newly Registered User
Posts: 3
Joined: 05 Mar 2012, 16:02

Hi im a C programmer

Post by treik »

How i can contribute to tmw ?
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

Re: Hi im a C programmer

Post by o11c »

tmwA is in the process of being rewritten in C++. It might be helpful to review what I've done at https://gitorious.org/~o11c/tmw-eathena ... a-comments , but despite all the effort I've put into that, I've decided that it's probably better to rewrite the foundation and then port the existing logic onto it (not a total concept rewrite like ManaServ has been struggling with for the last 7 years).

A good understanding of C is very helpful in understanding C++ - it is designed to eliminate some of the painful things in C, like manual resource management. It is a good plan to never use the 'delete' keyword in a C++ program. (and by using unique_ptr and shared_ptr you never have to worry about whether it should be delete or delete[] - it just depends on whether it's a std::unique_ptr<Foo> or std::unique_ptr<Foo[]>. Yes, you can use an array-of-unknown-bound as a template argument, and unique_ptr happens to specialize for it)

A random piece of advice is that std::vector is usually not the best container to use - it's better to not assume or require contiguous storage.

At the moment I'm still sort of planning to use <cstdio> instead of <iostream>, but that might change now that I've actually managed to write a custom output streambuf (in this case it calculates the MD5 hash of whatever is streamed to it, which is easier and more useful than making MD5 *read* from an arbitrary input stream, and more useful in general as partial hashes can be computed). Also up-for-grabs is whether to use *printf() (which I've written a C++ macro + variadic template wrapper for so I can pass arbitrary types like std::string, and still get GCC's attribute format to check it), or give in and use boost::format.


I'm also using Python (2.7) for tools (including gdb scripts) and prototyping (You get used to the whitespace thing after 20 minutes). I've attached something I've been playing with. I could use a converter (in any language, but I would suggest starting from the C codebase from mainline because I'm not 100% sure I haven't broken anything in my rewrite branch) from all the .txt based dbs into the SExpression-based data format - although I will likely change the representation, I want a straight converter first (it will be a good test of my scripting language to transform it). Take particular care of the password field, it may have 2 states currently (depending on the memo field, which IMO is otherwise useless), although the triple-md5 hashing used is an awful idea so we should probably have a 3rd variation and make everyone do a password reset (even if the actual password doesn't change) sometime within the year after this is released, then drop support for the old formats. Hm, this password thing is probably separate project for after the scripting language is done ...
Note that you'll have to use a nested structure for e.g. inventory, since we'll no longer have the mixture of commas and tabs.


My tasks are:
1. implementing a scripting language on top of the S-Expression data structures. For the sake of tools, this will probably stay in python even after the relevant parts are written in C++.
2. Finish writing network handlers and implement timers (trivial for me to do on my own - I already *did* some rewriting on the old branch, I just need to spend some time with it. But this is not as satisfying as 1.)
3. After 2 is done, create the relevant structures and/or code for the tmwA protocol.
4. After 3 is done, port the logic and stuff.


Oh, and ... make sure you have GCC 4.6 installed. Even if you don't need it for the things I've mentioned today, it will be necessary to build my code.

Hopefully there aren't any incomplete phrases in the above, I wrote it with random access.
Attachments
python-toys.zip
(5.68 KiB) Downloaded 108 times
Former programmer for the TMWA server.
Post Reply