Page 6 of 20

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 4:34 pm
by BrainNoMore
I am kind of shy, noobish on forums, scared of ban due to misread rules and also for most part I don't think I have anything important to say... but I am hopping it's not to late to wish FC good luck and once again I really do respect everything you go through for us :)

Also I am wishing it here instead of proper topic viewtopic.php?f=8&t=5040&hilit=good+luck because I'm scared that would be considered necro.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 4:55 pm
by FlowerChild
Yay! I fixed the hearts on animals issue, and it wasn't too painful in the end :)

Didn't take a custom packet or anything. What I did was convert the inLove variable within EntityAnimal into watchable data. This does much the same thing as what I was talking about earlier in the thread about blocks automatically transmitting their metadata when you call setRequiresSelfNotify() on them, but it works on individual variables as opposed to the whole set of data.

It's a bit messy in terms of the base-class mod required, as I had to change a whole whack of references to that variable to call an accessor function instead, but it shouldn't have any impact on compatibility.

Anyways, don't sweat it if you don't understand the above, as I'm posting it mostly for the benefit of other modders. You can take a look at EntityAgeable (which is a parent class for all animals I believe) for a simple example of how to set up watchable data within an entity.

Raust, you'll probably want to check that out in particular. I think that should be the bulk of what you need to do to get your nasty little curs working again ;)

Oh, one thing though: be careful with adding those objects and back up your save before doing so. An initial error on my part completely wiped out and reset the chunks my animals were in.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 5:00 pm
by Eriottosan
Thanks for the continued insight, FC. It is enlightening, and has given a fair few reference points for when I start updating to 1.3.1. Keep up the good work - I've said it before, but you truly are inspirational!

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 5:04 pm
by TheAnarchitect
Honestly even as a non-coder I appreciate the insight into how you work on your code. I enjoy going through it and stripping out useful general-purpose problem-solving principles.

Do recall that you single-handedly restored my faith in design as something other than taking credit for accidentally having a good idea. I'd kill to get this kind of insight into how Corbusier worked.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 5:07 pm
by RaustBlackDragon
Thanks a ton, this info will really help out! I've been feeling like a 100% noob modder again these past few days because of all the utterly alien SMP concepts I'm confronted with, and this is extremely appreciated :)

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 5:09 pm
by FlowerChild
Eriottosan wrote:Thanks for the continued insight, FC. It is enlightening, and has given a fair few reference points for when I start updating to 1.3.1. Keep up the good work - I've said it before, but you truly are inspirational!
No prob man, it helps keep me sane to be talking about this stuff too :)

I'm just happy my house didn't get wiped out by the bug I mentioned. I had my animal pits right next to it, but luckily they were separated by a chunk boundary. I hadn't made a backup since coming through my portal, so I'd be swearing bloody murder right now if all my play had gotten wiped out by a single oversight like that.

Anyways, that takes care of hearts, which was the primary player feedback issue. I still have to resolve the birthing particles (PLACENTA! WHY DO YOU BETRAY ME?!!!), but those are strictly cosmetic not really providing any useful info to the player, so I feel much more comfortable letting them slide for the time being.

<runs off to make backups...>

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 5:12 pm
by FlowerChild
RaustBlackDragon wrote:Thanks a ton, this info will really help out! I've been feeling like a 100% noob modder again these past few days because of all the utterly alien SMP concepts I'm confronted with, and this is extremely appreciated :)
It'll come man. For your entities, once you get a handle on this watchable data stuff, it should be relatively easy. I think the main other problem you'll face is spawning your custom entities, as I believe that part requires custom packets, as all the ents in the MC-code base are basically special cased for this (take a look in EntityTracker.java).

Once I get to Wind Mills and Water Wheels, I should be able to provide additional info on that part.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 5:16 pm
by Graphite
Yay for being a software developer that can follow an explanation like that. Generally when I hear about bugs, I try to figure out what might've gone wrong, but to be honest I'm drawing blanks on how a mistake here could wipe out entire chunks. Hope you'll excuse me for saying this, but I'm as interested in the errors as in the successes in cases like that :P

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 5:18 pm
by RaustBlackDragon
Custom packets? Ones that vanilla minecraft isn't capable of reading?

That sounds unpleasant, but I'll worry about that later, and I will get through it :)

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 5:19 pm
by FlowerChild
Graphite wrote:Yay for being a software developer that can follow an explanation like that. Generally when I hear about bugs, I try to figure out what might've gone wrong, but to be honest I'm drawing blanks on how a mistake here could wipe out entire chunks. Hope you'll excuse me for saying this, but I'm as interested in the errors as in the successes in cases like that :P
I think what happened is that it caused the MC code-base to think particular animals were corrupt, and it reset the chunks they were in to get rid of them.

That's my best guess anyways, and I'm not interested enough to dig into it further as soon as the game crashed I realized I had forgotten to initialize the variables in question. It's only when I fixed it and reloaded my world that I realized the chunks had reset in a "wtf?" moment.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 5:49 pm
by Sarudak
FlowerChild wrote: Hehe...maybe, but I don't think that's what they teach in school anymore. Over-architecting is definitely a problem that I see a lot of junior programmers develop, and it winds up just slowing down their development speed to a crawl while often creating an inflexible code-base that will ultimately need to be ripped apart and refactored at some point.

I tend to just apply the KISS principle at all stages, keep the code I do write modular and easy to swap out, and get the job done. You'll notice I've never felt the least bit compelled to do a complete rewrite of the BTW code-base, but I will go back from time to time to refactor sections of it when I see the necessity, and rarely will it break anything else.
Lol. When did I say anything about school? I think I could erase everything I learned at school and continue performing my job at the same level. I'm talking about accepted best practice in the field. After all big upfront design and over-architected solutions was one of the things the agile movement was rebelling against. Hence the principle of "maximize the work not done" and the corresponding response of YAGNI (You ain't gonna need it) in response to a proposed 'improvement' to the code that will provide greater 'flexibility' for future features.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 5:57 pm
by FlowerChild
Sarudak wrote:Lol. When did I say anything about school? I think I could erase everything I learned at school and continue performing my job at the same level. I'm talking about accepted best practice in the field. After all big upfront design and over-architected solutions was one of the things the agile movement was rebelling against. Hence the principle of "maximize the work not done" and the corresponding response of YAGNI (You ain't gonna need it) in response to a proposed 'improvement' to the code that will provide greater 'flexibility' for future features.
Hehe...yeah. I kinda got a kick out of when the academics decided to formalize "agile development" by giving it a label. My reaction was along the lines of "you mean keep doing what I've been doing all along? All right then" :)

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 6:01 pm
by morvelaira
Programming is like fashion. Keep doing your own thing for long enough and eventually it will be in style!

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 6:07 pm
by Sarudak
FlowerChild wrote: Hehe...yeah. I kinda got a kick out of when the academics decided to formalize "agile development". My reaction was along the lines of "you mean keep doing what I've been doing all along? All right then" :)
Heh... Yeah. But on the other hand for people who have to work with other people it can be helpful to have a set of principles to look to when you are discussion design decisions. As it can be helpful for those who are not extremely experienced to learn how good programming is done.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 6:09 pm
by FlowerChild
Sarudak wrote: Heh... Yeah. But on the other hand for people who have to work with other people it can be helpful to have a set of principles to look to when you are discussion design decisions. As it can be helpful for those who are not extremely experienced to learn how good programming is done.
Yup, for sure. Heck, I may have even pulled the "it's Agile" card out a couple of times myself during my career.

Still though, I couldn't help but smile at it. I get a kick out of labels in general, like I'm sure you've heard me going on about the whole "AAAAAA game" thing on multiple occasions.

We're going off-topic though. Let's bring this back on course.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 6:16 pm
by Sarudak
FlowerChild wrote: We're going off-topic though. Let's bring this back on course.
Righto. Sorry about that. You know how I like my debates... ;)

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 6:43 pm
by Ulfengaard
Thanks for doing this ongoing thread, FC. It is like a backstory video during installation: you're aching to play, and you are grateful that the dev took the time to give you a piece of candy while you wait.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 7:09 pm
by Ethinolicbob
Forgive me as I am asking this from memory whilst at work. has/do you anticipate the server-client changes to impact much of the mechanical aspect of BTW code?
Just figuring out if how far I should go before you are able to release

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 7:31 pm
by matty79321
RaustBlackDragon wrote:Thanks a ton, this info will really help out! I've been feeling like a 100% noob modder again these past few days because of all the utterly alien SMP concepts I'm confronted with, and this is extremely appreciated :)
And you feel like a noob, I can't even write a mod yet I know a lot of the basics of java.

On topic, this update seems like its a b!tch to do, so best of luck to you, FC.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 7:38 pm
by FlowerChild
Ethinolicbob wrote:Forgive me as I am asking this from memory whilst at work. has/do you anticipate the server-client changes to impact much of the mechanical aspect of BTW code?
Just figuring out if how far I should go before you are able to release
Hardly at all. I don't use Tile Entities for any of that stuff really, so it should be very easy to port over, once I get the Wind Mills and Water Wheels settled.

I wouldn't expect any changes to the system really.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 8:10 pm
by FlowerChild
In further update news:
Spoiler
Show
Image
I've rebuilt my animal pits after the above-mentioned mishap (a little further from my house mind you ;) ), found myself a few wolves, and...

Collected my first piece of brown gold! WOOT!

In honor of tradition, I made sure to do a little dance while waving it and flinging it about :)

I had to give the same treatment to the fed status of the wolves that I did for the love status of animals to make sure the client and server stayed in sync with regards to that.

Next up, it's time for me to start grinding my Hemp to build myself a Wind Mill.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 8:17 pm
by MrLemon
It's interesting to see you working though the tech tree FC! Good luck with the rest of the updating/bug-fixing for 1.3!

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 8:19 pm
by Thorium-232
FlowerChild wrote:In further update news:
Ha, this is exciting. It's like town building in, say, Heroes of Might and Magic, or the progressive upgrade unlocks in late BC/WotLK WoW. Piece by piece your base is coming back online and each part is adding a new visual element to a static screenshot. When all is said and done and BTW is 1.3 compatible, someone needs to turn these into a .gif.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 8:25 pm
by FlowerChild
Oh, just as an aside: upon further reflection, I realized my making inLove a watchable object is probably a performance hog.

I've taken a note to revisit it, but for modders, it may be worth noting that you probably don't want to be sending tick-counters like that as I'm pretty sure it'll guarantee you sending a network packet for each animal in love mode every single tick.

When dealing with stuff like that, it's probably best to have a separate boolean variable that is the watchable one, and tracks whether or not the animal is in love mode, as opposed to the count. This should ensure that a packet is only sent when the animal actually changes state, rather than every tick (which in theory could generate 1/600th the amount of packets).

Anyways, just a small note on performance. Generally in anything to do with multiplayer, you of course want to minimize the amount of network traffic you're generating as it is far from being an infinite resource. In a case like this, the client really doesn't need to know the precise state of the counter, as all it's concerned with is whether it should be displaying hearts or not, and for that, a simple on/off will suffice.

Re: The ongoing 1.3 update epic

Posted: Tue Aug 07, 2012 9:12 pm
by FlowerChild
...and, if you have a block where only certain settings of the meta-data concern the client, instead of using setRequiresSelfNotify() and forcing info to be transfered every time the meta-data changes, you can instead call:

world.markBlockNeedsUpdate() only when the changes you want to be relayed take place.

Which also means that the Hand Crank is now updated to 1.3 ;)

The Hand Crank maintains an internal counter in metadata which corresponds to the clicks that you hear during its operation. However, those changes are of no relevance to the client (sounds are actually automatically transfered from server to client), only the on/off state.