Renewable Energy Communities (RECs) are a key mechanism for accelerating the transition toward decentralised, low-carbon electricity systems. However, designing community photovoltaic (PV) and battery storage systems requires balancing conflicting objectives spanning technical performance, economic viability, environmental sustainability, and equitable benefit distribution. This paper proposes a unified 4E optimisation framework that integrates energy, economic, environmental, and equity objectives for residential PV--battery RECs. The framework couples hourly energy dispatch, thermo-economic assessment, carbon-emission accounting, and a Hybrid Capped benefit-allocation mechanism within a common optimisation environment. Two complementary techniques are employed: the Non-dominated Sorting Genetic Algorithm II (NSGA-II) for Pareto-optimal solutions and the Tree-structured Parzen Estimator (TPE) for single-objective cost optimisation. The methodology is demonstrated on two RECs under contrasting regulatory environments, a 102-household community in Italy and a 20-household community in Ireland, incorporating country-specific tariffs, export remuneration, incentives, PV generation profiles, and technology costs. Performance is evaluated through energy (SCR, SSR), economic (NPV, IRR, payback period, annualised total cost), environmental (avoided CO$_2$), and equity (Gini coefficient) indicators, with robustness assessed through multi-seed reproducibility, one-at-a-time analyses, price-escalation scenarios, and correlated Monte Carlo simulations. The results show that optimal PV--battery configurations are strongly influenced by tariff structures, incentives, and charging strategies. Rather than optimising fairness directly, the transparent, revenue-neutral Hybrid Capped rule protects low-consumption and energy-efficient members, reducing the Gini coefficient from approximately 0.19--0.25 under load-proportional sharing to 0.04--0.12 while preserving strong thermo-economic performance. The framework provides a reproducible decision-support methodology for designing residential RECs that jointly address technical efficiency, economic profitability, environmental sustainability, and social equity.