Jump to content

Recommended Posts

Posted (edited)

Maybe just give a break with maps for some time :)

ah? Bitch i ain't stop :P i never stop, beside i made the code. No tested yet but by  looking at it it looks even if still a trashcode. 

Also agree with rootware statset is for complex systems but ahh. still it's 3 properties with subproperties and subproperties. e.t.c

Edited by AccessDenied
Posted (edited)

I mean HashMap, FastMap. Make lists or Sets :)

Same for StatsSet. Make normal class.

Edited by vampir
Posted (edited)

I mean HashMap, FastMap. Make lists or Sets :)

Same for StatsSet. Make normal class.

Oh lel my mistake :P sorry as i mentionted ignore HM and FM are temporary i know they suck. 

 

one of the "cons" Map has is that it replace the value if it exist which sometimes we don't really want.. 

 

Ps. thanks for respond and suggestions

Edited by AccessDenied
Posted

In that case you should make an exception:

if(list.contains(x))

    throw new MyException(x.toString());

else

    list.add(x);

 

The thing is, using list in your case would force more object oriented programming.

Posted (edited)

In that case you should make an exception:

if(list.contains(x))

    throw new MyException(x.toString());

else

    list.add(x);

 

The thing is, using list in your case would force more object oriented programming.

 

Yap i know imma go try it now.

Ps. i don't think your code would work when you load from *.xml  list.add(x); 

 

and since you can make a method that generate events from 1 to 10 you can't really get a null 

 

int rndEvent = Rnd.get(1,10);

 

getMapById(rndEvent). bla bla

 

so null is not option

Edited by AccessDenied
Posted

In xml parser you should create object that will be then put in list(in holder class).

 

So then you have got a holder containing all possible maps.

 

If you want to choose map for the event:

 

EventMap map = Rnd.get(HolderName.getInstance().getAllMaps());

or

EventMap map = HolderName.getInstance().getRandomMap();

 

You might not have Rnd.get in your pack. it returns any object in range of the collection. Throws exception in case it is empty. It doesnt return null.

Posted (edited)

Ah, so you are talking about List<Integer>. I am talking about class X{ int y;}

Btw, why didnt you add Trove but made IntIntHolder on your own?

 

I don't like external libraries. Notably when you use only 2 classes over a whole library. You have to refer on the library javadoc to understand what it does, or what you can do. So I prefer to rely on personal implementations, stored on "commons" package (the only thing russians do fine). Plus IntIntHolder doesn't replace TInt stuff. It just provides most used exotic storage (used 10+ times).

 

Plus, it's a matter of 10mo RAM save for the integrality of List<Integer> and Map<Integer, Integer>. Not worth the point to remember to use Trove.

 

---

 

Access, define your XML structure first, it will normally give you hints about how to load stuff, what variables you need, etc. Create each class accordingly. What's supposed to be owner on MapData ?

Edited by Tryskell
Posted

I don't like external libraries. Notably when you use only 2 classes over a whole library. You have to refer on the library javadoc to understand what it does, or what you can do. So I prefer to rely on personal implementations, stored on "commons" package (the only thing russians do fine). Plus IntIntHolder doesn't replace TInt stuff. It just provides most used exotic storage (used 10+ times).

 

Plus, it's a matter of 10mo RAM save for the integrality of List<Integer> and Map<Integer, Integer>. Not worth the point to remember to use Trove.

 

---

 

Access, define your XML structure first, it will normally give you hints about how to load stuff, what variables you need, etc. Create each class accordingly. What's supposed to be owner on MapData ?

 

Imagine the xml structure i made is like this:

 

 

<Map id="1" mapName="Hello">

       <Owner ="Blue" x="553" y="5353" z="52352">

       <Owner ="Red" x="553" y="5353" z="52352">

</Map>

 

Something like this.

 

The code i made is this:

private final Map<Integer, Data> _eventData = new FastMap<Integer, Data>();	
	private final Map<Integer, MapData> maps = new FastMap<Integer, MapData>();
	
	public class Data
	{
		private Map<Integer, MapData> _map = new FastMap<Integer, MapData>();
		
		private Data(Map<Integer, MapData> map)
		{
			_map = map;
		}
		
		public MapData getMapById(int id)
		{
			return maps.get(id);
		}
	}
	
	public class MapData
	{
		private String _mapName;
		private FastMap<String, int[]> _Locations;
		
		private MapData(String mapName, FastMap<String, int[]> locations)
		{
			_mapName = mapName;
			_Locations = locations;
		}
		
		public int[] getMapLocationByOwner(String owner)
		{
			int[] loc = null;
			
			if (_Locations.containsKey(owner))
				loc = _Locations.get(owner);
			else
				System.out.print("Error: Can't find location for owner");
		
			return loc;
		}
		
		public String getMapName()
		{
			return _mapName;
		}
	}


	/**
	 * @param String mapName
	 * @param Array ArrayList<int[]>
	 */
	public void addNewMap(int eventId, int mapid,  String mapName, FastMap<String, int[]> fastmap)
	{
		MapData mapData = new MapData(mapName, fastmap);
		Map<Integer, MapData> map = new FastMap<Integer,MapData>(); 
		map.put(mapid, mapData);
		Data data = new Data(map);
		_eventData.put(eventId, data);
	}
	
	/**
	 * 
	 * @param id ~> Event ID
	 * @return Return Map Data base on Event ID
	 */
	public Data getMapByEventId(int id)
	{
		if (_eventData.containsKey(id))
			return	_eventData.get(id);
		else
			System.out.print("Error: Map not found for event ID: " + id);
		
		return null;			
	}

But for some reason it hits at "Map not found for event ID" idk why .. 

Posted

Are you aware you must parse your XML ? XMLDocumentFactory.getInstance().loadDocument on aCis. Also, are you aware than with XML you can do things like this (notably useful when you got redundant data) :

<owner type="red">
    <location x="" y="" z="" />
    <location x="" y="" z="" />
    <location x="" y="" z="" />
</owner>
<owner type="blue">
    <location x="" y="" z="" />
    <location x="" y="" z="" />
</owner>

MapData simply needs a String for owner. To retrieve all maps of a owner, you have to for loop maps and filter the owner string. Or you create specific List for each team, but scalability will suck in case you want to add a third or fourth faction.

 

About XML parsing, refer to any datatables. Still.

Posted (edited)

Are you aware you must parse your XML ? XMLDocumentFactory.getInstance().loadDocument on aCis. Also, are you aware than with XML you can do things like this (notably useful when you got redundant data) :

<owner type="red">
    <location x="" y="" z="" />
    <location x="" y="" z="" />
    <location x="" y="" z="" />
</owner>
<owner type="blue">
    <location x="" y="" z="" />
    <location x="" y="" z="" />
</owner>

MapData simply needs a String for owner. To retrieve all maps of a owner, you have to for loop maps and filter the owner string. Or you create specific List for each team, but scalability will suck in case you want to add a third or fourth faction.

 

About XML parsing, refer to any datatables. Still.

 

I am aware of what? LEL tryskell.. afc the load is done upon parse of the xml...   :-[  :-[

Edited by AccessDenied
Posted

That would be true, Trove library would have no purpose to exist, at least for container such as List and Map. And there would have no performance boost, either in RAM or CPU (and the RAM one was currently existing).

 

I doubt Java 8 edited anything prior to that, so you can assume he says wrong things. Fix me if I'm wrong.

 

I get it, denial is the first step. At some point you will accept it, everything in java is an object with few rare exceptions. java is far away from metal code.

 

Optimizing and talking about bullshit for a few cpu cycles makes you only stupid, L2J server will already deal with millions of objects, whats the difference if you "reduce" it by a few hundreds?

 

If we where talking about C/C++ servers then I get it, every byte counts, but in Java that should not be your concern except if you're a paranoid psycho.

 

 

Of course I am a big fun of optimized code, but you guys bring stupidity on a whole new level.

Posted

I get it, denial is the first step. At some point you will accept it, everything in java is an object with few rare exceptions. java is far away from metal code.

 

Optimizing and talking about bullshit for a few cpu cycles makes you only stupid, L2J server will already deal with millions of objects, whats the difference if you "reduce" it by a few hundreds?

 

If we where talking about C/C++ servers then I get it, every byte counts, but in Java that should not be your concern except if you're a paranoid psycho.

 

 

Of course I am a big fun of optimized code, but you guys bring stupidity on a whole new level.

 

No proof, only hate - couldn't expect more from you :P.

 

And that's not because everything is automatized behind than you must code like an idiot. First because you won't stuck to Java all your life, so better keep healthy coding habits. Second because even Java has a use to delay/restrain GC calls (that's computer ressources used for other things). And finally it doesn't cost you to code correctly BUT it costs you to debug a really bad coded / not scalable feature.

 

And hundreds + thousand + hundred... All accumulated you got your million saved objects, one day or another. With Java it can go pretty fast...

 

And I'm far to be a optimizer... Old L2J guys were fond of primitive arrays. I would be a optimizer I would replace every single container and create my own, etc. And anyway you're irrelevant with the whole thread - like almost 90% of your answers. Which will end with a topic lock because of your nonsense. But you know better than me for sure.

Posted

No proof, only hate - couldn't expect more from you :P.

 

And that's not because everything is automatized behind than you must code like an idiot. First because you won't stuck to Java all your life, so better keep healthy coding habits. Second because even Java has a use to delay/restrain GC calls (that's computer ressources used for other things). And finally it doesn't cost you to code correctly BUT it costs you to debug a really bad coded / not scalable feature.

 

And hundreds + thousand + hundred... All accumulated you got your million saved objects, one day or another. With Java it can go pretty fast...

 

And I'm far to be a optimizer... Old L2J guys were fond of primitive arrays. I would be a optimizer I would replace every single container and create my own, etc. And anyway you're irrelevant with the whole thread - like almost 90% of your answers. Which will end with a topic lock because of your nonsense. But you know better than me for sure.

 

 

I believe I do, I've edited java on bytecode level in the past and also worked with unsafe for specific projects to squeeze the most out of them, and I have a hands-on experience with what java can do and how it does it. As for my irrelevant answers thats probably because the content of the topics don't satisfy the low-end of my standards and I don't take them seriously, excuse me for that, that's just me.

 

Don't blame me for nonsense and locked topics, makes you look stupider than you actually are.

 

 

This is no scientific topic neither real professionals/programmers exist on this forum, so proofs are science-fiction, I mainly code in Java and I love it, but at least I accept its cons (fake templates, overheads) and that makes me a better programmer, I use the right tool at the right time, its not just Java 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




  • Posts

    • Opening December 6th at 19:00 (GMT +3)! Open Beta Test from November 30th!   https://l2soe.com/   🌟 Introducing L2 Saga of Eternia: A Revolution in Lineage 2 High Five! 🌟   Dear Lineage 2 enthusiasts, Prepare to witness the future of private servers! L2 Saga of Eternia is not just another High Five project—it’s a game-changing experience designed to compete with the giants of the Lineage 2 private server scene. Built for the community, by the community, we’re here to raise the bar in quality, innovation, and longevity. What Sets Us Apart? 💎 No Wipes, Ever Say goodbye to the fear of losing your progress. Our server is built to last and will never close. Stability and consistency are our promises to you. ⚔️ Weekly New Content Our dedicated development team ensures fresh challenges, events, and updates every week. From custom quests to exclusive features, there will always be something exciting to explore. 💰 No Pay-to-Win Skill and strategy matter most here. Enjoy a balanced gameplay environment where your achievements come from effort, not your wallet. 🌍 A Massive Community With 2000+ players expected, join a vibrant and active community of like-minded adventurers ready to conquer the world of Aden. 🏆 Fair and Competitive Gameplay Our systems are designed to promote healthy competition while avoiding abusive mechanics and exploits. 🔧 Professional Development From advanced bug fixes to carefully curated content, we pride ourselves on smooth performance, no lag, and unparalleled server quality. Key Features Chronicle: High Five with unique interface Rate: Dynamic x10 rates Class Balance: Carefully fine-tuned for a fair experience PvP Focused: PvP Ranking & aura display effect for 3 Top PvPers every week Custom Events: Seasonal and permanent events to keep you engaged Additional Features:   Custom Endgame Content: Introduce unique dungeons, raids, or zones unavailable in other servers. Player-Driven Economy: Implement a strong market system and avoid overinflated drops or rewards. Epic Siege Battles: Announce special large-scale sieges and PvP events. Incentives for Streamers and Clans: Attract influencers and big clans to boost server publicity. Roadmap Transparency: Share a public roadmap of planned updates to build trust and excitemen   Here you can read all the features: https://l2soe.com/features   Video preview: Join the Revolution! This is your chance to be part of something legendary. L2 Saga of Eternia is not just a server; it’s a movement to redefine what Lineage 2 can be. Whether you’re a seasoned veteran or a newcomer to the world of Aden, we invite you to experience Lineage 2 at its finest.   Official Launch Date: December 6th 2024 Website: https://l2soe.com/ Facebook: https://www.facebook.com/l2soe Discord: https://discord.com/invite/l2eternia   Let’s build the ultimate Lineage 2 experience together. See you in-game! 🎮
    • That's like a tutorial on how to run l2 on MacOS Xd but good job for the investigation. 
    • small update: dc robe set sold   wts adena 1kk = 1.5$ 
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hood-services https://campsite.bio/utchihaamkt
    • Why adena in this sever so expensive 🙂
  • Topics

×
×
  • Create New...